On Tue, 24 Jun 2014 09:39:42 -0300, Davide Vecchi <d...@amc.dk> wrote:
Hi,
Hi!
I'm decorating the RequestExceptionHandler in order to handle exceptions
and then redirecting to the previous page (the one I find in the
"Referer" HTTP header).
This works fine for normal page requests but I would like to handle also
the case of Ajax requests. The JavaDoc of
RequestExceptionHandler.handleRequestException
(http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/RequestExceptionHandler.html)
says:
"The handler is also responsible for setting the response status and the
X-Tapestry-ErrorMessage response header. These are very important in
Ajax requests to allow the client-side logic to detect the error and
present it to the user."
I couldn't find documentation to figure out to what values I should set
the response status and the X-Tapestry-ErrorMessage response header.
Does anyone have suggestions ?
If you're actually decorating, not overriding, and calling the
handleRequestException() method from the object you're decorating, this is
already being done. If not, here's the summary of what the default one
does:
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); // HTTP
status code 500 (internal error)
response.setHeader("X-Tapestry-ErrorMessage", exception.getMessage());
where response is a org.apache.tapestry5.services.Response object.
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org