Re: ClassCastException using Sun's jsf-portlet.jar in Pluto 2.0

Ate Douma <[email protected]> Fri, 23 Apr 2010 10:27:12 +0200
Newsgroups gmane.comp.jakarta.pluto.user
Message-ID <[email protected]>
Hi Rossen.

I think you did find a bug in Pluto after all :)
As you correctly pointed out, the MimeResponse.getPortletOutputStream only returns a java.io.OutputStream which the Pluto 
HttpServletResponseWrapper simply *assumes* to be upcastable to ServletOutputStream (which it is by default).
As Portlets are allowed to wrap/filter the response however, this assumption cannot be safely made.
I created a new issue for this: https://issues.apache.org/jira/browse/PLUTO-591
This will be fixed with the next 2.0.2 release of Pluto which is planned within the next few weeks.

Thanks for reporting this!

Regards,

Ate

On 04/21/2010 07:28 PM, rstoyanchev wrote:
>
> Hi,
>
> Firstly, I apologize for having my message go out multiple times. I was
> using a forum page (http://old.nabble.com/Pluto---User-f200.html) that
> continues to show 0 replies and a warning that the message has not been
> accepted. I can't see why that is. I've subscribed to the mailing list but I
> don't get any emails either. At the end I found the responses on the mailing
> list archive. Not sure what I'm doing wrong.
>
> @Martin, with regards to your suggestions, did you mean to point to this
> source?
>
> http://fisheye5.cenqua.com/browse/glassfish/appserv-jstl/src/org/apache/taglibs/standard/tag/common/core/ImportSupport.java?r=1.5&k=
>
> The class cast fails on com.sun.faces.portlet.ByteArrayWebOutputStream (as
> opposed to java.io.ByteArrayOutputStream). I'm not sure why changing the
> above source code would have any impact? Also the application is using JSF
> with Facelets, there is no jstl usage.
>
> The reason I pointed to HttpServletPortletResponseWrapper is because it
> calls javax.portlet.MimeResponse.getOutputStream(). For good or for bad the
> JavaDoc for that method says it returns a plain java.io.OutputStream:
>
> http://portals.apache.org/pluto/portlet-2.0-apidocs/javax/portlet/MimeResponse.html#getPortletOutputStream()
>
> Instead of casting to ServletOutputStream, couldn't
> HttpServletPortletResponseWrapper create an instance of ServletOutputStream
> that wraps the OutputStream returned by MimeResponse?
>
> Thanks,
> Rossen
>