Hi Fabio,

You can do this by overriding the doHandle() method in your filter. Here is an 
excerpt from 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;
    }

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 : Fabio Mancinelli [mailto:[email protected]] 
Envoye : mardi 6 janvier 2009 19:27
A : [email protected]
Objet : RE: Exception-resistant filters

Did it with a custom StatusService.

I have some code duplication in the filter for successful requests and  in the 
StatusService for handling exceptional cases.

I don't think it's possible to do otherwise, but I am open to suggestions :)

Thanks.

-Fabio

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

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

Reply via email to