Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Mdu Mdu
Empty file stream calling /api/secure/jsonws/dlfileentry/get-file-as-stream
27. Januar 2013 10:26
Antwort

Mdu Mdu

Rang: New Member

Nachrichten: 12

Eintrittsdatum: 30. Oktober 2005

Neue Beiträge

LF Info:
Version (Runtime and Source) : 6.1.1.ga2


Client Code Snippet:
 1        BasicHttpContext ctx = new BasicHttpContext();
 2        ctx.setAttribute(ClientContext.AUTH_CACHE, authCache);
 3
 4        HttpPost post = new HttpPost("/api/secure/jsonws/dlfileentry/get-file-as-stream");
 5        List<NameValuePair> params = new ArrayList<NameValuePair>();
 6        params.add(new BasicNameValuePair("fileEntryId", "40522"));
 7        params.add(new BasicNameValuePair("version", "1.0"));
 8
 9        UrlEncodedFormEntity entity = new UrlEncodedFormEntity(params, "UTF-8");
10        post.setEntity(entity);
11
12        HttpResponse resp = LiferayPortalDocumentRepositoryImpl.httpclient.execute(targetHost, post, ctx);
13        System.out.println("getFolderById Status:[" + resp.getStatusLine() + "]");
14        System.out.println("getFolderByName Res:[" + resp + "]");


Result:
The response stream in HTTP reponse is empty or of length 0.

Notes:
- Returned JSON is null:
1 json = getJSON(mapping, form, request, response); //com.liferay.portal.struts.JSONAction Line 75



- Returned result (FileInputStream) is NOT null:
1Object returnObj = jsonWebServiceAction.invoke(); //com.liferay.portal.jsonwebservice.JSONWebServiceServiceAction Line 104


Question: How do we return file content?

Thanks.
Rahul A Rabhadiya
RE: Empty file stream calling /api/secure/jsonws/dlfileentry/get-file-as-st
3. Juli 2013 07:38
Antwort

Rahul A Rabhadiya

Rang: Junior Member

Nachrichten: 57

Eintrittsdatum: 13. Juni 2013

Neue Beiträge

Have you got solution of your problem . I am facing same problem like u. Help me out
Mdu Mdu
RE: Empty file stream calling /api/secure/jsonws/dlfileentry/get-file-as-st
3. Juli 2013 11:28
Antwort

Mdu Mdu

Rang: New Member

Nachrichten: 12

Eintrittsdatum: 30. Oktober 2005

Neue Beiträge

See http://www.liferay.com/community/forums/-/message_boards/view_message/20990842#_19_message_20990842