Foren

Empty file stream calling /api/secure/jsonws/dlfileentry/get-file-as-stream

Mdu Mdu, geändert vor 11 Jahren.

Empty file stream calling /api/secure/jsonws/dlfileentry/get-file-as-stream

New Member Beiträge: 12 Beitrittsdatum: 31.10.05 Neueste Beiträge
LF Info:
Version (Runtime and Source) : 6.1.1.ga2


Client Code Snippet:
		BasicHttpContext ctx = new BasicHttpContext();
		ctx.setAttribute(ClientContext.AUTH_CACHE, authCache);

		HttpPost post = new HttpPost("/api/secure/jsonws/dlfileentry/get-file-as-stream");
		List<namevaluepair> params = new ArrayList<namevaluepair>();
		params.add(new BasicNameValuePair("fileEntryId", "40522"));
		params.add(new BasicNameValuePair("version", "1.0"));

		UrlEncodedFormEntity entity = new UrlEncodedFormEntity(params, "UTF-8");
		post.setEntity(entity);

		HttpResponse resp = LiferayPortalDocumentRepositoryImpl.httpclient.execute(targetHost, post, ctx);
		System.out.println("getFolderById Status:[" + resp.getStatusLine() + "]");
		System.out.println("getFolderByName Res:[" + resp + "]");</namevaluepair></namevaluepair>


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

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



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


Question: How do we return file content?

Thanks.
thumbnail
Rahul Rabhadiya, geändert vor 10 Jahren.

RE: Empty file stream calling /api/secure/jsonws/dlfileentry/get-file-as-st

Junior Member Beiträge: 57 Beitrittsdatum: 14.06.13 Neueste Beiträge
Have you got solution of your problem . I am facing same problem like u. Help me out
Mdu Mdu, geändert vor 10 Jahren.

RE: Empty file stream calling /api/secure/jsonws/dlfileentry/get-file-as-st

New Member Beiträge: 12 Beitrittsdatum: 31.10.05 Neueste Beiträge
See http://www.liferay.com/community/forums/-/message_boards/view_message/20990842#_19_message_20990842