You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by osamuo <os...@yahoo.co.jp> on 2007/12/25 09:50:25 UTC

T5: 404 http error

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)
------------------------------------


-- 
View this message in context: http://www.nabble.com/T5%3A-404-http-error-tp14493888p14493888.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: 404 http error

Posted by Sven Homburg <ho...@googlemail.com>.
not possible since 5.0.7

signature of ComponentEventResultProcessor was changed


Yoshikazu Kuramochi wrote:
> 
> I am doing as follows.
> 
> ------------------------------------
> public class ErrorResponse {
> 
>      private int _statusCode;
>      private String _message;
> 
>      public ErrorResponse(int statusCode, String message) {
>          super();
>          _statusCode = statusCode;
>          _message = message;
>      }
> 
>      public int getStatusCode() { return _statusCode; }
>      public String getMessage() { return _message; }
> 
>      public static final ErrorResponse NOT_FOUND = new ErrorResponse 
> (404, null);
> }
> ------------------------------------
> 
> ------------------------------------
> public class ErrorResponseResultProcessor implements  
> ComponentEventResultProcessor<ErrorResponse> {
> 
>      public ActionResponseGenerator processComponentEvent(
>              final ErrorResponse errorResponse, Component component,  
> String methodDescripion) {
> 
>          return new ActionResponseGenerator() {
>              public void sendClientResponse(Response response) throws  
> IOException {
>                  response.sendError(errorResponse.getStatusCode(),  
> errorResponse.getMessage());
>              }
>          };
>      }
> }
> ------------------------------------
> 
> Add contributeComponentEventResultProcessor method to AppModule.java
> ------------------------------------
> public void contributeComponentEventResultProcessor(
>          MappedConfiguration<Class, ComponentEventResultProcessor>  
> configuration) {
> 
>      configuration.add(ErrorResponse.class, new  
> ErrorResponseResultProcessor());
> }
> ------------------------------------
> 
> Test.java:
> ------------------------------------
> public class Test{
>      ErrorResponse onActivate(Object[] parameters) {
>          return ErrorResponse.NOT_FOUND;
>      }
> }
> ------------------------------------
> 
> 
> On 2007/12/25, at 17:50, 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.renderP 
>> ageResponse(PageResponseRendererImpl.java:58)
>> 	at
>> $PageResponseRenderer_1171072b261.renderPageResponse 
>> ($PageResponseRenderer_1171072b261.java)
>> 	at
>> org.apache.tapestry.internal.services.PageRenderRequestHandlerImpl.han 
>> dle(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)
>> ------------------------------------
>>
>>
>> -- 
>> View this message in context: http://www.nabble.com/T5%3A-404-http- 
>> error-tp14493888p14493888.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 


-----
---
best regards
Sven
-- 
View this message in context: http://www.nabble.com/T5%3A-404-http-error-tp14493888p14505686.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: 404 http error

Posted by Yoshikazu Kuramochi <yo...@kuramo.ch>.
I am doing as follows.

------------------------------------
public class ErrorResponse {

     private int _statusCode;
     private String _message;

     public ErrorResponse(int statusCode, String message) {
         super();
         _statusCode = statusCode;
         _message = message;
     }

     public int getStatusCode() { return _statusCode; }
     public String getMessage() { return _message; }

     public static final ErrorResponse NOT_FOUND = new ErrorResponse 
(404, null);
}
------------------------------------

------------------------------------
public class ErrorResponseResultProcessor implements  
ComponentEventResultProcessor<ErrorResponse> {

     public ActionResponseGenerator processComponentEvent(
             final ErrorResponse errorResponse, Component component,  
String methodDescripion) {

         return new ActionResponseGenerator() {
             public void sendClientResponse(Response response) throws  
IOException {
                 response.sendError(errorResponse.getStatusCode(),  
errorResponse.getMessage());
             }
         };
     }
}
------------------------------------

Add contributeComponentEventResultProcessor method to AppModule.java
------------------------------------
public void contributeComponentEventResultProcessor(
         MappedConfiguration<Class, ComponentEventResultProcessor>  
configuration) {

     configuration.add(ErrorResponse.class, new  
ErrorResponseResultProcessor());
}
------------------------------------

Test.java:
------------------------------------
public class Test{
     ErrorResponse onActivate(Object[] parameters) {
         return ErrorResponse.NOT_FOUND;
     }
}
------------------------------------


On 2007/12/25, at 17:50, 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.renderP 
> ageResponse(PageResponseRendererImpl.java:58)
> 	at
> $PageResponseRenderer_1171072b261.renderPageResponse 
> ($PageResponseRenderer_1171072b261.java)
> 	at
> org.apache.tapestry.internal.services.PageRenderRequestHandlerImpl.han 
> dle(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)
> ------------------------------------
>
>
> -- 
> View this message in context: http://www.nabble.com/T5%3A-404-http- 
> error-tp14493888p14493888.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: 404 http error

Posted by Sven Homburg <ho...@googlemail.com>.
done


Howard Lewis Ship wrote:
> 
> 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 <ho...@googlemail.com> 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: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator Apache Tapestry and Apache HiveMind
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 


-----
---
best regards
Sven
-- 
View this message in context: http://www.nabble.com/T5%3A-404-http-error-tp14493888p14531399.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: 404 http error

Posted by Howard Lewis Ship <hl...@gmail.com>.
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 <ho...@googlemail.com> 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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: 404 http error

Posted by Sven Homburg <ho...@googlemail.com>.
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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: 404 http error

Posted by osamuo <os...@yahoo.co.jp>.
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)
>> ------------------------------------
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-404-http-error-tp14493888p14503676.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: 404 http error

Posted by Sven Homburg <ho...@googlemail.com>.
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-tp14493888p14501533.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org