Ticket #1851 (closed defect: fixed)
Missing content-type breakes portlets on Jboss Portal
| Reported by: | Jonas Granvik | Owned by: | Marko Gronroos |
|---|---|---|---|
| Priority: | major | Milestone: | User Interface Library 5.2.5 |
| Component: | undefined | Version: | 5.2.4 |
| Keywords: | Cc: | ||
| Known Issue description: | |||
| Hours estimate: | Deadline (dd.mm.yyyy): | ||
| Known Issue version (since): | Known Issue title: | ||
| Hours done: | Depends to: | ||
| Affects documentation: | no | ||
| Known Issue workaround: | Perhaps just call RenderRequest.getResponseContentTypes() and select text/html which should be returned. The call response.setContentType("text/html") and it should work ok. This could be done in e.g. ApplicationPortlet.render() or in the beginning of ApplicationPortlet.writeAjaxWindow() and put it before response.getOutputStream(). An other possible solution is to move the response.setContentType("text/html"); out from it's if(!fragment) block in ApplicationServlet.writeAjaxPage(). | ||
| Affects release notes: | no | Contract: | |
Description
In JBoss portal server the Toolkit applications viewed as portlets do not render, although servlets viewed directly render ok. This is caused by the fact that there is no content-type set for the response which throws an Exception in ApplicationServlet?.writeAjaxPage() when calling response.getOutputStream().
Somehow this seems to work in Liferay without setting the content type for the response.
For me it is a bit unclear whether the container should default to e.g. text/html or not, but I would guess not according to the following quotation and the fact that this is not mentioned specifically in the specs.
Quoted from the Portlet 1.0 specs: "PLT.11.1.7 Response Content Types Portlet developers may code portlets to support multiple content types. A portlet can obtain, using the getResponseContentType method of the request object, a string representing the default content type the portlet container assumes for the output. If the portlet container supports additional content types for the portlet’s output, it must declare the additional content types through the getResponseContentTypes method of the request object. The returned Enumeration of strings should contain the content types the portlet container supports in order of preference. The first element of the enumeration must be the same content type returned by the getResponseContentType method. If a portlet defines support for all content types using a wildcard and the portlet container supports all content types, the getResponseContentType may return the wildcard or the portlet container preferred content type. The getResponseContentTypes method must return only the content types supported by the current portlet mode of the portlet."
