[
https://issues.apache.org/jira/browse/MYFACES-1815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570031#action_12570031
]
Leonardo Uribe commented on MYFACES-1815:
-----------------------------------------
Sorry
I don't like this part of the solution 2:
CharBuffer decodedBuffer = decoder.decode(
ByteBuffer.wrap(_byteArrayOutputStream.toByteArray()));
The code that refer this is:
static class WrappedServletOutputStream extends ServletOutputStream{
/*.................*/
private void writeTo(Writer out, String encoding) throws IOException{
//Get the charset based on the encoding or return the default if
//encoding == null
Charset charset = (encoding == null) ?
Charset.defaultCharset() : Charset.forName(encoding);
CharsetDecoder decoder = charset.newDecoder();
CharBuffer decodedBuffer = decoder.decode(
ByteBuffer.wrap(_byteArrayOutputStream.toByteArray()));
if (decodedBuffer.hasArray()){
out.write(decodedBuffer.array());
}
}
/*.................*/
}
The problem is the method toByteArray(). It creates a copy of the array, but it
should be better if we could access the array inside _byteArrayOutputStream
(since we don't change it). I will investigate how we can do this and see what
happens
> Faces servlet returns empty response for resources when using /faces/* as
> servlet mapping
> -----------------------------------------------------------------------------------------
>
> Key: MYFACES-1815
> URL: https://issues.apache.org/jira/browse/MYFACES-1815
> Project: MyFaces Core
> Issue Type: Bug
> Affects Versions: 1.2.2
> Reporter: Guy Bashan
> Fix For: 1.2.3-SNAPSHOT
>
> Attachments: MYFACES-1815-2.patch, MYFACES-1815.patch
>
>
> Hello,
> I have just upgraded from jsf 1.1.5 to 1.2.2 and it seems like all the
> resources returns empty response when using /faces/* as servlet mapping.
> During the upgrade I made no changes to web.xml. It looks like this:
> <servlet>
> <servlet-name>Faces Servlet</servlet-name>
> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
> <load-on-startup>30</load-on-startup>
> </servlet>
> <servlet-mapping>
> <servlet-name>Faces Servlet</servlet-name>
> <url-pattern>/faces/*</url-pattern>
> </servlet-mapping>
> The web application loaded successfully, but all the resources
> (images/js/stylesheets) seems to be broken.
> I copied one of the images url to try and check a request to image directly.
> For example:
> http://localhost:8080/myapp/faces/images/logo.jpg
> and I got an empty response.
> When I removed the faces:
> http://localhost:8080/myapp/images/logo.jpg
> the image was loaded ok.
> I made further investigation and changed the mapping to: *.faces and it
> seemed to be working fine.
> Thanks,
> Guy.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.