Hi Ganesh,

The StatusService#getStatus() method is only called when an exception is raised 
by your code and caught by the engine. Here this
related code from the engine's StatusFilter:

    @Override
    public int doHandle(Request request, Response response) {
        // Normally handle the call
        try {
            super.doHandle(request, response);
        } catch (Throwable t) {
            response.setStatus(getStatus(t, request, response));
        }

        return CONTINUE;
    }

In your case, I'd better override the StatusService#getRepresentation() method 
which is always invoked when your Response has an
error status.

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com



-----Message d'origine-----
De : Ganesh [mailto:[email protected]] 
Envoye : mercredi 7 janvier 2009 16:24
A : [email protected]
Objet : StatusService not invoked

Hi,

       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!! can any one look at my
code and suggest where i am missing? or any code to help is more appreciated :)

Application 
----------
public MYApplication(final Context context) {
super(context);
setStatusService(new ErrorStatusService());
}

ErrorStatusService
------------------
public class ErrorStatusService extends StatusService {
        public ErrorStatusService() {
                super(true);
        }
        @Override
        public Status getStatus(final Throwable throwable, final Request 
request, final Response response) {
        response.redirectTemporary("/error.html");
        return response.getStatus();
}
please help me.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1010040

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1022249

Reply via email to