At 07:23 -0800 2009-01-07, Ganesh wrote:
>i am trying to add a custom StatusService to my application, that
>should go to given error page when the resource not found.for the
>known resources it is going fine..if it is an unknown resource the
>getStatus is not called!!
In the message "Re: StatusService not working", dated 2009-01-07,
Stephen Groucutt wrote:
>Not sure exactly, but could you try overriding getStatus(Status,
>Request, Response) and see if that works?
From now-hazy memory, it may have also been necessary to enable
setOverwrite in the parent StatusService instance in order to return
a error response, rather than Restlet's default response:
// Set the default behavior of this status service:
// - Enabled
// - Always overwrite the current HTTP entity body.
super( true );
super.setOverwrite( true );
Aron
P.S. There's also an apparent typo in "return ressponse.getStatus()"
below, but perhaps that's only in the email message, not the actual
code?
>public class ErrorStatusService extends StatusService {
>
>
> public ErrorStatusService() {
> super(true);
> System.out.println("ErrorStatusService");
> //super.setOverwrite(true);
> }
>
> @Override
> public Status getStatus(final Throwable throwable,
>final Request request, final Response response) {
> response.redirectTemporary("/error.html");
> return ressponse.getStatus();
>}
>}
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1010540