[ 
http://issues.apache.org/jira/browse/TAPESTRY-730?page=comments#action_12427481 
] 
            
A.J. commented on TAPESTRY-730:
-------------------------------

BEA report it as corrected in 8.1 SP6 
(http://edocs.bea.com/wls/docs81/notes/resolved_sp06.html#1864954) but I 
haven't checked it yet.

CR259956 : "... Attempt to change the Content-Type after calling getWriter() 
threw an IllegalStateException.
This exception no longer occurs. However, the new content type is ignored and 
the response is written back to the client with the original content type."

cheers, Ozeebee

> Cannot change charset from 'UTF8' to 'UTF-8 during Redirection
> --------------------------------------------------------------
>
>                 Key: TAPESTRY-730
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-730
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.0
>         Environment: Windows XP - Bea Weblogic 8.1 SP2 - Jdk 142_06 - 
> Tapestry 4.0b11
>            Reporter: Paolo DonĂ 
>
> I'm trying to run this simple page on WLS81 :
> public abstract class Test extends org.apache.tapestry.html.BasePage {
>     
>     // do nothing, just redirect to Home when invoked
>     public Test(){
>         addPageBeginRenderListener(new PageBeginRenderListener(){
>             public void pageBeginRender(PageEvent event) {
>                 throw new RedirectException("Home");
>             }
>         });
>     }
> }
> I've got two html templates: "Home.html" and "Test.html". both of them do not 
> have components, just plain html.
> I wanna perform a redirection from Test to Home, so I try to call 
> http://localhost:8080/app?page=Test&service=page
> On tomcat this call perform the redirection to the "Home" page.
> On WLS 81 I get this exception instead: 
> org.apache.hivemind.ApplicationRuntimeException: Attempt to change 
> ContentType after calling getWriter() (cannot change charset from 'UTF8' to 
> 'UTF-8')
>       at 
> org.apache.tapestry.error.ExceptionPresenterImpl.presentException(ExceptionPresenterImpl.java:64)
>       at 
> $ExceptionPresenter_1073673e5c3.presentException($ExceptionPresenter_1073673e5c3.java)
>       at 
> $ExceptionPresenter_1073673e5c2.presentException($ExceptionPresenter_1073673e5c2.java)
>       at 
> org.apache.tapestry.engine.AbstractEngine.activateExceptionPage(AbstractEngine.java:121)
>       at 
> org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:280)
>       at 
> org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:60)
>       at 
> $WebRequestServicer_1073673e61a.service($WebRequestServicer_1073673e61a.java)
>       at 
> $WebRequestServicer_1073673e616.service($WebRequestServicer_1073673e616.java)
>       at 
> org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:56)
>       at 
> $ServletRequestServicer_1073673e5fa.service($ServletRequestServicer_1073673e5fa.java)
>       at 
> org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55)
>       at 
> $ServletRequestServicerFilter_1073673e5f6.service($ServletRequestServicerFilter_1073673e5f6.java)
>       at 
> $ServletRequestServicer_1073673e5fc.service($ServletRequestServicer_1073673e5fc.java)
>       at 
> org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52)
>       at 
> $ServletRequestServicerFilter_1073673e5f4.service($ServletRequestServicerFilter_1073673e5f4.java)
>       at 
> $ServletRequestServicer_1073673e5fc.service($ServletRequestServicer_1073673e5fc.java)
>       at 
> org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
>       at 
> $ServletRequestServicerFilter_1073673e5f8.service($ServletRequestServicerFilter_1073673e5f8.java)
>       at 
> $ServletRequestServicer_1073673e5fc.service($ServletRequestServicer_1073673e5fc.java)
>       at 
> $ServletRequestServicer_1073673e5ec.service($ServletRequestServicer_1073673e5ec.java)
>       at 
> org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:141)
>       at 
> org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:97)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>       at 
> weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
>       at 
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
>       at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
>       at 
> weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
>       at org.apache.tapestry.RedirectFilter.doFilter(RedirectFilter.java:103)
>       at 
> weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
>       at 
> weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6356)
>       at 
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
>       at 
> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
>       at 
> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
>       at 
> weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
>       at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
>       at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
> Caused by: java.lang.IllegalStateException: Attempt to change ContentType 
> after calling getWriter() (cannot change charset from 'UTF8' to 'UTF-8')
>       at 
> weblogic.servlet.internal.ServletResponseImpl.setEncoding(ServletResponseImpl.java:848)
>       at 
> weblogic.servlet.internal.ServletResponseImpl.setHeader(ServletResponseImpl.java:674)
>       at 
> weblogic.servlet.internal.ServletResponseImpl.setContentType(ServletResponseImpl.java:269)
>       at 
> org.apache.tapestry.web.ServletWebResponse.getPrintWriter(ServletWebResponse.java:77)
>       at 
> $WebResponse_1073673e6ea.getPrintWriter($WebResponse_1073673e6ea.java)
>       at 
> $WebResponse_1073673e5ba.getPrintWriter($WebResponse_1073673e5ba.java)
>       at 
> org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse(ResponseRendererImpl.java:67)
>       at 
> $ResponseRenderer_1073673e5d4.renderResponse($ResponseRenderer_1073673e5d4.java)
>       at 
> org.apache.tapestry.error.ExceptionPresenterImpl.presentException(ExceptionPresenterImpl.java:46)
>       ... 36 more
> It seems that the servletResponse is already committed during redirection. 
> The ServletWebResponse.getPrintWriter(ContentType) method try to reset the 
> contentType and get a new writer without checking if it needs to or not...
> I think ServletWebResponse.getPrintWriter code should be modified this way:
>   public PrintWriter getPrintWriter(ContentType contentType) throws 
> IOException  {
>         Defense.notNull(contentType, "contentType");
>         if (_needsReset)
>             reset();
>         _needsRes et = true;
>         if (!_servletResponse.isCommited( ))
>              _servletResponse.setContentType(contentType.toString());
>          }
>         try {
>             return _servletResponse.getWriter();
>         } catch (IOException ex) {
>             throw new ...
>         }
>     }
> Paolo

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to