Ticket #1851 (closed defect: fixed)

Opened 5 months ago

Last modified 5 months ago

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."

Attachments

HelloPortlet.war (2.3 MB) - added by Jonas Granvik 5 months ago.
Simple hello world portlet to test with JBoss portal.

Change History

Changed 5 months ago by Jonas Granvik

Simple hello world portlet to test with JBoss portal.

follow-up: ↓ 2   Changed 5 months ago by Joonas Lehtinen

  • milestone set to User Interface Library 5.2.5

in reply to: ↑ 1   Changed 5 months ago by Jonas Granvik

The portlet primer in the Jboss manual says: "As in the servlet world, you must declare what content-type the portlet will be responding in. Do this before starting to write content, or the portlet will throw an exception." So I guess you always have to define the response then also for portlets.

  Changed 5 months ago by Marc Englund

  • status changed from new to closed
  • resolution set to fixed

Fixed in [4963]

Also updated PortletConfigurationGenerator? to generate JBoss -specific deployment files. The deploying is very basic, POC quality; more testing and better deployment descriptor generation should be don to achieve 'full support'. For instance, the 'height' element could be generated for jboss, and we should perhaps not deploy to the 'center' of 'default.default' by default?

  Changed 5 months ago by Joonas Lehtinen

  • milestone changed from User Interface Library 5 stable to User Interface Library 5.2.5
Note: See TracTickets for help on using tickets.