You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Jan-Kees van Andel (JIRA)" <de...@myfaces.apache.org> on 2009/01/26 21:17:59 UTC
[jira] Created: (MYFACES-2142) ClassCastException in
JspViewHandlerImpl: ResponseSwitch != HttpServletResponse
ClassCastException in JspViewHandlerImpl: ResponseSwitch != HttpServletResponse
-------------------------------------------------------------------------------
Key: MYFACES-2142
URL: https://issues.apache.org/jira/browse/MYFACES-2142
Project: MyFaces Core
Issue Type: Bug
Components: JSR-314
Reporter: Jan-Kees van Andel
While running the latest myfaces2 source code with a test JSP page, I've encountered the following error.
java.lang.ClassCastException: org.apache.myfaces.context.servlet.ResponseSwitch cannot be cast to javax.servlet.http.HttpServletResponse
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.buildView(JspViewHandlerImpl.java:487)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:343)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:45)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:167)
at javax.faces.webapp.FacesServlet._handleStandardRequest(FacesServlet.java:428)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:182)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
etc......
As far as I can see, this is a bug, since there is an explicit cast to HttpServletResponse and the given parameter is of type ResponseSwitch, which is not a HttpServletResponse.
It looks like a recent change...
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MYFACES-2142) ClassCastException in
JspViewHandlerImpl: ResponseSwitch != HttpServletResponse
Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/MYFACES-2142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703983#action_12703983 ]
Leonardo Uribe commented on MYFACES-2142:
-----------------------------------------
Disabled the part related on FacesContextImpl temporally, so the error should not appear. Then, when the need of ResponseSwitch arise, the idea is enable it and solve this issue.
> ClassCastException in JspViewHandlerImpl: ResponseSwitch != HttpServletResponse
> -------------------------------------------------------------------------------
>
> Key: MYFACES-2142
> URL: https://issues.apache.org/jira/browse/MYFACES-2142
> Project: MyFaces Core
> Issue Type: Bug
> Components: JSR-314
> Reporter: Jan-Kees van Andel
> Attachments: MYFACES-2142.patch
>
>
> While running the latest myfaces2 source code with a test JSP page, I've encountered the following error.
> java.lang.ClassCastException: org.apache.myfaces.context.servlet.ResponseSwitch cannot be cast to javax.servlet.http.HttpServletResponse
> at org.apache.myfaces.application.jsp.JspViewHandlerImpl.buildView(JspViewHandlerImpl.java:487)
> at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:343)
> at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:45)
> at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:167)
> at javax.faces.webapp.FacesServlet._handleStandardRequest(FacesServlet.java:428)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:182)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> etc......
> As far as I can see, this is a bug, since there is an explicit cast to HttpServletResponse and the given parameter is of type ResponseSwitch, which is not a HttpServletResponse.
> It looks like a recent change...
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MYFACES-2142) ClassCastException in
JspViewHandlerImpl: ResponseSwitch != HttpServletResponse
Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/MYFACES-2142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12704180#action_12704180 ]
Leonardo Uribe commented on MYFACES-2142:
-----------------------------------------
The solution should fix the issue.
I think it is better make ResponseSwitch inherit from HttpServletResponse (creating other class like HttpResponseSwitch) and cast on FacesContextImpl constructor to use one or other. But I'm not found yet the part of the spec that requires use ResponseSwitch, so it is better to put this issue on hold to make a decision about this.
> ClassCastException in JspViewHandlerImpl: ResponseSwitch != HttpServletResponse
> -------------------------------------------------------------------------------
>
> Key: MYFACES-2142
> URL: https://issues.apache.org/jira/browse/MYFACES-2142
> Project: MyFaces Core
> Issue Type: Bug
> Components: JSR-314
> Reporter: Jan-Kees van Andel
> Attachments: MYFACES-2142.patch
>
>
> While running the latest myfaces2 source code with a test JSP page, I've encountered the following error.
> java.lang.ClassCastException: org.apache.myfaces.context.servlet.ResponseSwitch cannot be cast to javax.servlet.http.HttpServletResponse
> at org.apache.myfaces.application.jsp.JspViewHandlerImpl.buildView(JspViewHandlerImpl.java:487)
> at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:343)
> at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:45)
> at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:167)
> at javax.faces.webapp.FacesServlet._handleStandardRequest(FacesServlet.java:428)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:182)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> etc......
> As far as I can see, this is a bug, since there is an explicit cast to HttpServletResponse and the given parameter is of type ResponseSwitch, which is not a HttpServletResponse.
> It looks like a recent change...
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (MYFACES-2142) ClassCastException in
JspViewHandlerImpl: ResponseSwitch != HttpServletResponse
Posted by "Curtiss Howard (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/MYFACES-2142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12704714#action_12704714 ]
Curtiss Howard edited comment on MYFACES-2142 at 4/30/09 10:19 AM:
-------------------------------------------------------------------
Leonardo, I found the text in the spec that talks about this. Section 2.2.6, last bullet:
"For partial requests, where partial view rendering is required, there must be no content written outside of the view
(outside f:view). Response writing must be disabled. Response writing must be enabled again at the start of
encodeBegin."
And I think it's better to extend HttpServletResponseWrapper because otherwise you have to implement all the methods in HttpServletResponse and back them with an existing writer... effectively duplicating the functionality of HttpServletResponseWrapper. The root of the "unwrapping" problem is that ResponseSwitch extends ServletResponseWrapper, not HttpServletResponseWrapper and thus it can't be cast to HttpServletResponse. I think merely fixing that oversight in how ResponseSwitch is defined would be a suitable fix.
was (Author: curtiss):
Leonardo, I found the text in the spec that talks about this. Section 2.2.6, last bullet:
"For partial requests, where partial view rendering is required, there must be no content written outside of the view
(outside f:view). Response writing must be disabled. Response writing must be enabled again at the start of
encodeBegin."
And I think it's better to extend HttpServletResponseWrapper because otherwise you have to implement all the methods in HttpServletResponse and back them with an existing writer... effectively duplicating the functionality of HttpServletResponseWrapper.
> ClassCastException in JspViewHandlerImpl: ResponseSwitch != HttpServletResponse
> -------------------------------------------------------------------------------
>
> Key: MYFACES-2142
> URL: https://issues.apache.org/jira/browse/MYFACES-2142
> Project: MyFaces Core
> Issue Type: Bug
> Components: JSR-314
> Reporter: Jan-Kees van Andel
> Attachments: MYFACES-2142.patch
>
>
> While running the latest myfaces2 source code with a test JSP page, I've encountered the following error.
> java.lang.ClassCastException: org.apache.myfaces.context.servlet.ResponseSwitch cannot be cast to javax.servlet.http.HttpServletResponse
> at org.apache.myfaces.application.jsp.JspViewHandlerImpl.buildView(JspViewHandlerImpl.java:487)
> at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:343)
> at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:45)
> at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:167)
> at javax.faces.webapp.FacesServlet._handleStandardRequest(FacesServlet.java:428)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:182)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> etc......
> As far as I can see, this is a bug, since there is an explicit cast to HttpServletResponse and the given parameter is of type ResponseSwitch, which is not a HttpServletResponse.
> It looks like a recent change...
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MYFACES-2142) ClassCastException in
JspViewHandlerImpl: ResponseSwitch != HttpServletResponse
Posted by "Curtiss Howard (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/MYFACES-2142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12704070#action_12704070 ]
Curtiss Howard commented on MYFACES-2142:
-----------------------------------------
Leonardo, can you try the patch I provided? It should fix the issue, which is simply due to not unwrapping the ResponseSwitch.
> ClassCastException in JspViewHandlerImpl: ResponseSwitch != HttpServletResponse
> -------------------------------------------------------------------------------
>
> Key: MYFACES-2142
> URL: https://issues.apache.org/jira/browse/MYFACES-2142
> Project: MyFaces Core
> Issue Type: Bug
> Components: JSR-314
> Reporter: Jan-Kees van Andel
> Attachments: MYFACES-2142.patch
>
>
> While running the latest myfaces2 source code with a test JSP page, I've encountered the following error.
> java.lang.ClassCastException: org.apache.myfaces.context.servlet.ResponseSwitch cannot be cast to javax.servlet.http.HttpServletResponse
> at org.apache.myfaces.application.jsp.JspViewHandlerImpl.buildView(JspViewHandlerImpl.java:487)
> at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:343)
> at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:45)
> at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:167)
> at javax.faces.webapp.FacesServlet._handleStandardRequest(FacesServlet.java:428)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:182)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> etc......
> As far as I can see, this is a bug, since there is an explicit cast to HttpServletResponse and the given parameter is of type ResponseSwitch, which is not a HttpServletResponse.
> It looks like a recent change...
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (MYFACES-2142) ClassCastException in
JspViewHandlerImpl: ResponseSwitch != HttpServletResponse
Posted by "Curtiss Howard (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/MYFACES-2142?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Curtiss Howard updated MYFACES-2142:
------------------------------------
Status: Patch Available (was: Open)
> ClassCastException in JspViewHandlerImpl: ResponseSwitch != HttpServletResponse
> -------------------------------------------------------------------------------
>
> Key: MYFACES-2142
> URL: https://issues.apache.org/jira/browse/MYFACES-2142
> Project: MyFaces Core
> Issue Type: Bug
> Components: JSR-314
> Reporter: Jan-Kees van Andel
> Attachments: MYFACES-2142.patch
>
>
> While running the latest myfaces2 source code with a test JSP page, I've encountered the following error.
> java.lang.ClassCastException: org.apache.myfaces.context.servlet.ResponseSwitch cannot be cast to javax.servlet.http.HttpServletResponse
> at org.apache.myfaces.application.jsp.JspViewHandlerImpl.buildView(JspViewHandlerImpl.java:487)
> at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:343)
> at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:45)
> at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:167)
> at javax.faces.webapp.FacesServlet._handleStandardRequest(FacesServlet.java:428)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:182)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> etc......
> As far as I can see, this is a bug, since there is an explicit cast to HttpServletResponse and the given parameter is of type ResponseSwitch, which is not a HttpServletResponse.
> It looks like a recent change...
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MYFACES-2142) ClassCastException in
JspViewHandlerImpl: ResponseSwitch != HttpServletResponse
Posted by "Curtiss Howard (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/MYFACES-2142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12704714#action_12704714 ]
Curtiss Howard commented on MYFACES-2142:
-----------------------------------------
Leonardo, I found the text in the spec that talks about this. Section 2.2.6, last bullet:
"For partial requests, where partial view rendering is required, there must be no content written outside of the view
(outside f:view). Response writing must be disabled. Response writing must be enabled again at the start of
encodeBegin."
And I think it's better to extend HttpServletResponseWrapper because otherwise you have to implement all the methods in HttpServletResponse and back them with an existing writer... effectively duplicating the functionality of HttpServletResponseWrapper.
> ClassCastException in JspViewHandlerImpl: ResponseSwitch != HttpServletResponse
> -------------------------------------------------------------------------------
>
> Key: MYFACES-2142
> URL: https://issues.apache.org/jira/browse/MYFACES-2142
> Project: MyFaces Core
> Issue Type: Bug
> Components: JSR-314
> Reporter: Jan-Kees van Andel
> Attachments: MYFACES-2142.patch
>
>
> While running the latest myfaces2 source code with a test JSP page, I've encountered the following error.
> java.lang.ClassCastException: org.apache.myfaces.context.servlet.ResponseSwitch cannot be cast to javax.servlet.http.HttpServletResponse
> at org.apache.myfaces.application.jsp.JspViewHandlerImpl.buildView(JspViewHandlerImpl.java:487)
> at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:343)
> at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:45)
> at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:167)
> at javax.faces.webapp.FacesServlet._handleStandardRequest(FacesServlet.java:428)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:182)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> etc......
> As far as I can see, this is a bug, since there is an explicit cast to HttpServletResponse and the given parameter is of type ResponseSwitch, which is not a HttpServletResponse.
> It looks like a recent change...
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.