You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Böhringer Jochen <Jo...@tcc-products.de> on 2005/03/14 12:23:42 UTC

Problem with portlet integration (ClassCastException)

Hi,

I tried to run my JSF Application as a portlet (using the latest myfaces version built directly from CVS yesterday). But I got a ClassCastException in UIComponentTag.setupResponseWriter()

In this line: ServletRequest request = (ServletRequest)facesContext.getExternalContext().getRequest();

Because getRequest does not return a ServletRequest in a portlet environment. The request variable is used in the next line to determine the contentType and characterEncoding for the response writer.

So I deleted the line above and determined the characterEncoding and contentType using the pageContext instance variable.

_writer = renderKit.createResponseWriter(new _PageContextOutWriter(pageContext),
                    pageContext.getRequest().getContentType(),
                    pageContext.getRequest().getCharacterEncoding());


Now it works. But this was the first time I looked into the myfaces sources. So I'm not sure if this might have any side effects.

Should I open a bug on this?

Thx
Jochen