I think we need a new class, ErrorResponse, that can be returned as a
way to invoke response.sendError().  The StreamResponse handler wants
to send a stream of content, which causes problems because after
sendError() the response is committed (meaning you can't legally
obtain an output stream or print writer).

Please add an issue (and a patch :-) ).

On Dec 26, 2007 12:30 PM, Sven Homburg <[EMAIL PROTECTED]> wrote:
>
> i think its not your or a tapestry problem.
> jetty gives tapestry a closed http connection
> if  you set a response error
>
> i dont know, if this a special jetty behavior.
>
> i think it should cool, if howard consider this behavior in
> StreamResponseResultProcessor.processComponentEvent
>
>
>
> osamuo wrote:
> >
> > Thank you for your advice.
> > But I still get an exception.
> >
> >
> >
> > Sven Homburg wrote:
> >>
> >> i have never tested it, its only an idea:
> >>
> >> Test.java:
> >> ------------------------------------
> >> 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 );
> >>       textStream.prepareResponse(response);
> >>     }
> >>     return textStream;
> >>   }
> >> }
> >> ------------------------------------
> >>
> >>
> >>
> >>
> >> osamuo wrote:
> >>>
> >>> Hi,
> >>>
> >>> How can I tell T5 to send an 404 error?
> >>>
> >>> Is the following code right way to show 404 error page on T5?
> >>> Because I got an error after calling "sendError()" in the code.
> >>>
> >>>
> >>> Test.java:
> >>> ------------------------------------
> >>> public class Test{
> >>>   @Inject
> >>>   private Response response;
> >>>
> >>>   void onActivate( Object[] parameters ) throws IOException{
> >>>     //if( parameters == null || parameters.length != 2 ){
> >>>     response.sendError( 404, null );
> >>>     return;
> >>>     //}
> >>>   }
> >>> }
> >>> ------------------------------------
> >>>
> >>> 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)
> >>> ------------------------------------
> >>>
> >>>
> >>>
> >>
> >>
> >
> >
>
>
> -----
> ---
> best regards
> Sven
> --
> View this message in context: 
> http://www.nabble.com/T5%3A-404-http-error-tp14493888p14506058.html
>
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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

Reply via email to