You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Thomas Clavier <cl...@argia.fr> on 2009/02/23 18:17:30 UTC

http error on exception

    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 : clavier@argia.fr
+33 (0)6 20 81 81 30           +33 (0)950 783 783



Re: http error on exception

Posted by Lutz Hühnken <lh...@googlemail.com>.
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 <cl...@argia.fr> 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 : clavier@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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: http error on exception

Posted by Peter Stavrinides <P....@albourne.com>.
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" <ul...@spielviel.de>
To: "Tapestry users" <us...@tapestry.apache.org>
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-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: http error on exception

Posted by Ulrich Stärk <ul...@spielviel.de>.
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org