Den 07.11.12 09:29, skrev Henrik Brautaset Aronsen:
I've created a sample project that shows two problems I have with RESTEasy interceptors:

A) Somehow neither the MessageBodyReaderInterceptor nor the PreProcessInterceptor triggers. I really can't figure out why.

The MessageBodyReaderInterceptor triggers when the called method is a plain String: post(String formValues). It doesn't trigger if the argument is a MultivaluedMap: post(MultivaluedMap<String,String> formValues. I believe issue is related: https://issues.jboss.org/browse/RESTEASY-568

The PreProcessInterceptor does trigger, I only used it wrong. When AcceptedByMethod.accept() returns true all methods are covered by the interceptor. I've updated the example project to reflect this.

Also, I've added a MessageBodyWriterInterceptor. It does not have the same problems as the MessageBodyReaderInterceptor.

B) I have an ExceptionMapper that works great for @Get requests. When an exception is thrown for a @Post request, though, I get a

org.jboss.resteasy.core.NoMessageBodyWriterFoundFailure: Could not find MessageBodyWriter for response object of type: no.synth.resteasyinterceptordemo.MyExceptionMapper$Error of media type: application/x-www-form-urlencoded

This is still a problem, I have no solution here.

Are these known defects, or am I doing something very stupid? I'd be grateful if someone would like to take a look.

The project is located at https://github.com/henrik242/resteasy-interceptor-demo and I've tried using Tomcat 6 and 7.

I just pushed some updates to this project, with more tests and additional help text.

Henrik

------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to