How to answer Request with 500 error

2008-10-07 Thread Stefan Lindner
I try to create a watchdog page for our site. My idea was to check the
neccessary resources and respond with a 500 error in case of failure.
So I placed


getWebRequestCycle().getWebResponse().getHttpServletResponse().setStatus
(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);

in the page constructor and in onAfterRender but the page is displayed
correctly, no 500 error shown in browser.
Any idea?

Stefan

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



AW: How to answer Request with 500 error

2008-10-07 Thread Stefan Lindner
Ah! Thank you.

Stefan.

-Ursprüngliche Nachricht-
Von: Serkan Camurcuoglu [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 7. Oktober 2008 14:18
An: users@wicket.apache.org
Betreff: Re: How to answer Request with 500 error

The WIA book says:

Setting an HTTP status code:
If you want to set an HTTP status code for your page, such as 404 (not 
found), you
can do so by overriding the page's setHeaders method:

@Override
protected void setHeaders(WebResponse response) {
response.getHttpServletResponse().setStatus(
HttpServletResponse.SC_NOT_FOUND);
super.setHeaders(response);
}

Alternatively, you can throw an AbortWithWebErrorCodeException and 
provide it
with the appropriate error code and an optional message.




Stefan Lindner wrote:
 I try to create a watchdog page for our site. My idea was to check the
 neccessary resources and respond with a 500 error in case of failure.
 So I placed

   
 getWebRequestCycle().getWebResponse().getHttpServletResponse().setStatus
 (HttpServletResponse.SC_INTERNAL_SERVER_ERROR);

 in the page constructor and in onAfterRender but the page is displayed
 correctly, no 500 error shown in browser.
 Any idea?

 Stefan

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


   


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


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



Re: How to answer Request with 500 error

2008-10-07 Thread Serkan Camurcuoglu

The WIA book says:

Setting an HTTP status code:
If you want to set an HTTP status code for your page, such as 404 (not 
found), you

can do so by overriding the page’s setHeaders method:

@Override
protected void setHeaders(WebResponse response) {
response.getHttpServletResponse().setStatus(
HttpServletResponse.SC_NOT_FOUND);
super.setHeaders(response);
}

Alternatively, you can throw an AbortWithWebErrorCodeException and 
provide it

with the appropriate error code and an optional message.




Stefan Lindner wrote:

I try to create a watchdog page for our site. My idea was to check the
neccessary resources and respond with a 500 error in case of failure.
So I placed


getWebRequestCycle().getWebResponse().getHttpServletResponse().setStatus
(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);

in the page constructor and in onAfterRender but the page is displayed
correctly, no 500 error shown in browser.
Any idea?

Stefan

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


  



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



Re: How to answer Request with 500 error

2008-10-07 Thread Jeremy Thomerson
Also, see AbortWithHttpStatusException.


-- 
Jeremy Thomerson
http://www.wickettraining.com

On Tue, Oct 7, 2008 at 7:41 AM, Stefan Lindner [EMAIL PROTECTED] wrote:

 Ah! Thank you.

 Stefan.

 -Ursprüngliche Nachricht-
 Von: Serkan Camurcuoglu [mailto:[EMAIL PROTECTED]
 Gesendet: Dienstag, 7. Oktober 2008 14:18
 An: users@wicket.apache.org
 Betreff: Re: How to answer Request with 500 error

 The WIA book says:

 Setting an HTTP status code:
 If you want to set an HTTP status code for your page, such as 404 (not
 found), you
 can do so by overriding the page's setHeaders method:

 @Override
 protected void setHeaders(WebResponse response) {
 response.getHttpServletResponse().setStatus(
 HttpServletResponse.SC_NOT_FOUND);
 super.setHeaders(response);
 }

 Alternatively, you can throw an AbortWithWebErrorCodeException and
 provide it
 with the appropriate error code and an optional message.




 Stefan Lindner wrote:
  I try to create a watchdog page for our site. My idea was to check the
  neccessary resources and respond with a 500 error in case of failure.
  So I placed
 
 
  getWebRequestCycle().getWebResponse().getHttpServletResponse().setStatus
  (HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
 
  in the page constructor and in onAfterRender but the page is displayed
  correctly, no 500 error shown in browser.
  Any idea?
 
  Stefan
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 


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


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