You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Sven Homburg (JIRA)" <de...@tapestry.apache.org> on 2007/12/28 21:57:43 UTC
[jira] Created: (TAPESTRY-2001) IllegalStateException if
response.error set to other than 200
IllegalStateException if response.error set to other than 200
-------------------------------------------------------------
Key: TAPESTRY-2001
URL: https://issues.apache.org/jira/browse/TAPESTRY-2001
Project: Tapestry
Issue Type: Improvement
Components: tapestry-core
Affects Versions: unspecified
Environment: Win/XP Java 1.5
Reporter: Sven Homburg
Priority: Minor
public class Test{
@Inject
private Response response;
StreamResponse onActivate( Object[] parameters ) throws IOException{
TextStreamResponse textStream = null;
if( parameters == null || parameters.length != 2 )
{
textStream = new TextStreamResponse("text/html", "this page doesnt exists");
response.sendError( 404, null );
}
return textStream;
}
}
Error:
------------------------------------
[ERROR] RequestExceptionHandler Processing of request failed with uncaught exception: STREAM
java.lang.IllegalStateException: STREAM
at org.mortbay.jetty.Response.getWriter(Response.java:571)
at org.apache.tapestry.internal.services.ResponseImpl.getPrintWriter(ResponseImpl.java:47)
at $Response_1171072b273.getPrintWriter($Response_1171072b273.java)
at $Response_1171072b240.getPrintWriter($Response_1171072b240.java)
at org.apache.tapestry.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:58)
at $PageResponseRenderer_1171072b261.renderPageResponse($PageResponseRenderer_1171072b261.java)
at org.apache.tapestry.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:87)
at $PageRenderRequestHandler_1171072b25d.handle($PageRenderRequestHandler_1171072b25d.java)
at org.apache.tapestry.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:66)
at $Dispatcher_1171072b25f.dispatch($Dispatcher_1171072b25f.java)
at $Dispatcher_1171072b253.dispatch($Dispatcher_1171072b253.java)
at org.apache.tapestry.services.TapestryModule$12.service(TapestryModule.java:905)
------------------------------------
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
[jira] Commented: (TAPESTRY-2001) IllegalStateException if
response.error set to other than 200
Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
[ https://issues.apache.org/jira/browse/TAPESTRY-2001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12580608#action_12580608 ]
Howard M. Lewis Ship commented on TAPESTRY-2001:
------------------------------------------------
when invoking HttpServletResponse.sendError() you shoudl not try and send a stream as well, just the message. The container may use an error page to render the reponse, or it may wrap your message as an HTML page and send that back.
I think the correct solution here is to add a setStatus(int) method to Response. It is accepible to set a status and then follow through with a streamed response, though the spec encourages this to only be used in cases where the status code represents a successful response.
Looking at the patch, I get antsy when I see a special case recognized using instanceof; that is a huge tipoff that the APIs or interfaces are insufficient.
> IllegalStateException if response.error set to other than 200
> -------------------------------------------------------------
>
> Key: TAPESTRY-2001
> URL: https://issues.apache.org/jira/browse/TAPESTRY-2001
> Project: Tapestry
> Issue Type: Improvement
> Components: tapestry-core
> Affects Versions: unspecified
> Environment: Win/XP Java 1.5
> Reporter: Sven Homburg
> Priority: Minor
> Attachments: ErrorStreamResponse.patch
>
>
> public class Test{
> @Inject
> private Response response;
> StreamResponse onActivate( Object[] parameters ) throws IOException{
> TextStreamResponse textStream = null;
>
> if( parameters == null || parameters.length != 2 )
> {
> textStream = new TextStreamResponse("text/html", "this page doesnt exists");
> response.sendError( 404, null );
> }
> return textStream;
> }
> }
> Error:
> ------------------------------------
> [ERROR] RequestExceptionHandler Processing of request failed with uncaught exception: STREAM
> java.lang.IllegalStateException: STREAM
> at org.mortbay.jetty.Response.getWriter(Response.java:571)
> at org.apache.tapestry.internal.services.ResponseImpl.getPrintWriter(ResponseImpl.java:47)
> at $Response_1171072b273.getPrintWriter($Response_1171072b273.java)
> at $Response_1171072b240.getPrintWriter($Response_1171072b240.java)
> at org.apache.tapestry.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:58)
> at $PageResponseRenderer_1171072b261.renderPageResponse($PageResponseRenderer_1171072b261.java)
> at org.apache.tapestry.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:87)
> at $PageRenderRequestHandler_1171072b25d.handle($PageRenderRequestHandler_1171072b25d.java)
> at org.apache.tapestry.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:66)
> at $Dispatcher_1171072b25f.dispatch($Dispatcher_1171072b25f.java)
> at $Dispatcher_1171072b253.dispatch($Dispatcher_1171072b253.java)
> at org.apache.tapestry.services.TapestryModule$12.service(TapestryModule.java:905)
> ------------------------------------
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
[jira] Updated: (TAPESTRY-2001) IllegalStateException if
response.error set to other than 200
Posted by "Sven Homburg (JIRA)" <de...@tapestry.apache.org>.
[ https://issues.apache.org/jira/browse/TAPESTRY-2001?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sven Homburg updated TAPESTRY-2001:
-----------------------------------
Attachment: ErrorStreamResponse.patch
here a possible solutoin
> IllegalStateException if response.error set to other than 200
> -------------------------------------------------------------
>
> Key: TAPESTRY-2001
> URL: https://issues.apache.org/jira/browse/TAPESTRY-2001
> Project: Tapestry
> Issue Type: Improvement
> Components: tapestry-core
> Affects Versions: unspecified
> Environment: Win/XP Java 1.5
> Reporter: Sven Homburg
> Priority: Minor
> Attachments: ErrorStreamResponse.patch
>
>
> public class Test{
> @Inject
> private Response response;
> StreamResponse onActivate( Object[] parameters ) throws IOException{
> TextStreamResponse textStream = null;
>
> if( parameters == null || parameters.length != 2 )
> {
> textStream = new TextStreamResponse("text/html", "this page doesnt exists");
> response.sendError( 404, null );
> }
> return textStream;
> }
> }
> Error:
> ------------------------------------
> [ERROR] RequestExceptionHandler Processing of request failed with uncaught exception: STREAM
> java.lang.IllegalStateException: STREAM
> at org.mortbay.jetty.Response.getWriter(Response.java:571)
> at org.apache.tapestry.internal.services.ResponseImpl.getPrintWriter(ResponseImpl.java:47)
> at $Response_1171072b273.getPrintWriter($Response_1171072b273.java)
> at $Response_1171072b240.getPrintWriter($Response_1171072b240.java)
> at org.apache.tapestry.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:58)
> at $PageResponseRenderer_1171072b261.renderPageResponse($PageResponseRenderer_1171072b261.java)
> at org.apache.tapestry.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:87)
> at $PageRenderRequestHandler_1171072b25d.handle($PageRenderRequestHandler_1171072b25d.java)
> at org.apache.tapestry.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:66)
> at $Dispatcher_1171072b25f.dispatch($Dispatcher_1171072b25f.java)
> at $Dispatcher_1171072b253.dispatch($Dispatcher_1171072b253.java)
> at org.apache.tapestry.services.TapestryModule$12.service(TapestryModule.java:905)
> ------------------------------------
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
[jira] Updated: (TAPESTRY-2001) IllegalStateException if
response.error set to other than 200
Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
[ https://issues.apache.org/jira/browse/TAPESTRY-2001?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Howard M. Lewis Ship updated TAPESTRY-2001:
-------------------------------------------
Affects Version/s: (was: unspecified)
5.0.12
> IllegalStateException if response.error set to other than 200
> -------------------------------------------------------------
>
> Key: TAPESTRY-2001
> URL: https://issues.apache.org/jira/browse/TAPESTRY-2001
> Project: Tapestry
> Issue Type: Improvement
> Components: tapestry-core
> Affects Versions: 5.0.12
> Environment: Win/XP Java 1.5
> Reporter: Sven Homburg
> Priority: Minor
> Attachments: ErrorStreamResponse.patch
>
>
> public class Test{
> @Inject
> private Response response;
> StreamResponse onActivate( Object[] parameters ) throws IOException{
> TextStreamResponse textStream = null;
>
> if( parameters == null || parameters.length != 2 )
> {
> textStream = new TextStreamResponse("text/html", "this page doesnt exists");
> response.sendError( 404, null );
> }
> return textStream;
> }
> }
> Error:
> ------------------------------------
> [ERROR] RequestExceptionHandler Processing of request failed with uncaught exception: STREAM
> java.lang.IllegalStateException: STREAM
> at org.mortbay.jetty.Response.getWriter(Response.java:571)
> at org.apache.tapestry.internal.services.ResponseImpl.getPrintWriter(ResponseImpl.java:47)
> at $Response_1171072b273.getPrintWriter($Response_1171072b273.java)
> at $Response_1171072b240.getPrintWriter($Response_1171072b240.java)
> at org.apache.tapestry.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:58)
> at $PageResponseRenderer_1171072b261.renderPageResponse($PageResponseRenderer_1171072b261.java)
> at org.apache.tapestry.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:87)
> at $PageRenderRequestHandler_1171072b25d.handle($PageRenderRequestHandler_1171072b25d.java)
> at org.apache.tapestry.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:66)
> at $Dispatcher_1171072b25f.dispatch($Dispatcher_1171072b25f.java)
> at $Dispatcher_1171072b253.dispatch($Dispatcher_1171072b253.java)
> at org.apache.tapestry.services.TapestryModule$12.service(TapestryModule.java:905)
> ------------------------------------
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
[jira] Closed: (TAP5-168) IllegalStateException if response.error
set to other than 200
Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TAP5-168?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Howard M. Lewis Ship closed TAP5-168.
-------------------------------------
Resolution: Invalid
> IllegalStateException if response.error set to other than 200
> -------------------------------------------------------------
>
> Key: TAP5-168
> URL: https://issues.apache.org/jira/browse/TAP5-168
> Project: Tapestry 5
> Issue Type: Improvement
> Affects Versions: 5.0.15
> Environment: Win/XP Java 1.5
> Reporter: Sven Homburg
> Priority: Minor
> Attachments: ErrorStreamResponse.patch
>
>
> public class Test{
> @Inject
> private Response response;
> StreamResponse onActivate( Object[] parameters ) throws IOException{
> TextStreamResponse textStream = null;
>
> if( parameters == null || parameters.length != 2 )
> {
> textStream = new TextStreamResponse("text/html", "this page doesnt exists");
> response.sendError( 404, null );
> }
> return textStream;
> }
> }
> Error:
> ------------------------------------
> [ERROR] RequestExceptionHandler Processing of request failed with uncaught exception: STREAM
> java.lang.IllegalStateException: STREAM
> at org.mortbay.jetty.Response.getWriter(Response.java:571)
> at org.apache.tapestry.internal.services.ResponseImpl.getPrintWriter(ResponseImpl.java:47)
> at $Response_1171072b273.getPrintWriter($Response_1171072b273.java)
> at $Response_1171072b240.getPrintWriter($Response_1171072b240.java)
> at org.apache.tapestry.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:58)
> at $PageResponseRenderer_1171072b261.renderPageResponse($PageResponseRenderer_1171072b261.java)
> at org.apache.tapestry.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:87)
> at $PageRenderRequestHandler_1171072b25d.handle($PageRenderRequestHandler_1171072b25d.java)
> at org.apache.tapestry.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:66)
> at $Dispatcher_1171072b25f.dispatch($Dispatcher_1171072b25f.java)
> at $Dispatcher_1171072b253.dispatch($Dispatcher_1171072b253.java)
> at org.apache.tapestry.services.TapestryModule$12.service(TapestryModule.java:905)
> ------------------------------------
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org