RE: Exception-resistant filters

2009-01-13 Thread Jerome Louvel
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:fabio.mancine...@gmail.com] 
Envoye : mardi 6 janvier 2009 19:27
A : discuss@restlet.tigris.org
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=4447dsMessageId=1008161

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


RE: Exception-resistant filters

2009-01-06 Thread Fabio Mancinelli
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=4447dsMessageId=1008161