Re: http error on exception

2009-03-05 Thread Lutz Hühnken
The way I like to do it: decorate the exception handler in your AppModule.java



/**
 * Decorate the exception handler in a way that it will just return error
 * code 500 in production mode. See
 * http://tapestry.apache.org/tapestry5/cookbook/exceptions.html On the
 * bottom of the page, "Version 3".
 */
public RequestExceptionHandler
decorateRequestExceptionHandler(final Logger logger, final Response
response,
@Symbol(SymbolConstants.PRODUCTION_MODE) final boolean
productionMode, final Object service) {
if (!productionMode) {
return null;
}
return new RequestExceptionHandler() {
public void handleRequestException(final Throwable
exception) throws IOException {
logger.error(exception.getMessage(), exception);

response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"Internal Server Error");
}
};
}


Hth,

Lutz


On Mon, Feb 23, 2009 at 6:17 PM, Thomas Clavier  wrote:
>    Hello All,
>
> I search a solution to launch an http error (500) when tapestry throw an
> Exception. I have found documentation on how to override tapestry
> Exception ... but that launch a "200 OK"
>
> have you a solution ?
>
> --
> Thomas Clavier                 http://www.tcweb.org
> Argia Engineering              JabberID : clav...@argia.fr
> +33 (0)6 20 81 81 30           +33 (0)950 783 783
>
>
>



-- 
altocon GmbH
http://www.altocon.de/
Software Development, Consulting
Hamburg, Germany

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



Re: http error on exception

2009-02-25 Thread Peter Stavrinides
simply use:

response_.sendError(code_, message_);

map your custom error page in web.xml and place it in the root of your 
application context.

Cheers,
Peter

- Original Message -
From: "Ulrich Stärk" 
To: "Tapestry users" 
Sent: Monday, 23 February, 2009 20:24:42 GMT +02:00 Athens, Beirut, Bucharest, 
Istanbul
Subject: Re: http error on exception

Never tested it but you should be able to inject Response, call 
response.setStatus(500) and 
response.sendRedirect(Link/String).

Uli

Thomas Clavier schrieb:
> Hello All,
> 
> I search a solution to launch an http error (500) when tapestry throw an
> Exception. I have found documentation on how to override tapestry
> Exception ... but that launch a "200 OK"
> 
> have you a solution ?
> 


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


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



Re: http error on exception

2009-02-23 Thread Ulrich Stärk
Never tested it but you should be able to inject Response, call response.setStatus(500) and 
response.sendRedirect(Link/String).


Uli

Thomas Clavier schrieb:

Hello All,

I search a solution to launch an http error (500) when tapestry throw an
Exception. I have found documentation on how to override tapestry
Exception ... but that launch a "200 OK"

have you a solution ?




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