miii suuu:
Many thanks for your instruction about JSR168 spec.
1
2portletRequest.getProperty("content-length"); // will return ""
3portletRequest.getProperty("content-type");// will return ""
4portletRequest.getProperty("accept-language"); //will return ""
I only concern that, in this case I do as JSR168 spec, I would like to know why I can not get httpHeader ?
Also I use portletRequest.getPropertyNames() method, but I get null value too,
- suuu
JSR-168:
=======
getLocale()
Returns the preferred Locale in which the portal will accept content.
getResponseContentType()
Returns the portal preferred content type for the response.
HTTP Headers available to PortletRequest depend also on whether it is ActionRequest:
getCharacterEncoding()
Returns the name of the character encoding used in the body of this request.
getContentLength()
Returns the length, in bytes, of the request body which is made available by the input stream, or -1 if the length is not known.
getContentType()
Returns the MIME type of the body of the request, or null if the type is not known.
... ... ...
Only some HTTP headers available explicitly (for file upload request for instance), and not via getProperty()... getProperty() could return HTTP headers, but it's up to Portlet Container implementation... "A portlet can access portal/portlet-container specific properties through this method and, if available, the headers of the HTTP client request."
((com.liferay.portlet.PortletRequestImpl) portletRequest).getHttpServletRequest().getHeader("user-agent");works fine; I tested it with RenderRequest instance.
com.liferay.portlet.PortletRequestImpl
...
public Enumeration<String> getPropertyNames() {
return _portalCtx.getPropertyNames();
}
...
public HttpServletRequest getHttpServletRequest() {
return _req;
}
...