Hi,
On 15/02/13 18:10, SriramSundararajan01 wrote:
Hi,
I am a new beeie for REST services. I started using apache cxf 2.5.6 for
building rest services. When I want to try changing the
Message.HTTP_REQUEST_METHOD and URI through the request handler, it doesnt
work as expected.

I created a custom RequestHandler and I have added that to my service as a
provider using<jaxrs:providers>

In handleRequest method I wrote the below lines of code
String s  = (String) mess.get(Message.REQUEST_URI);
s = s+"/get/exception/appmessage/";
mess.put(Message.REQUEST_URI, s);
mess.put(Message.HTTP_REQUEST_METHOD, "POST");

I was expecting a error as there was no POST method for the new URI. Instead
the change i made for the URI dint take effect and the method for the
original URI was getting executed.

Please let me know if i am doing anything wrong.

Please use CXF interceptor (phase UNMARSHAL for example) for affecting the match this way. I think in CXF 2.5.6 only replacing the accept type from the handlers can make a difference, but not in later CXFs, this is because starting from CXF 2.7.x one should use JAX-RS 2.0 pre-match ContainerRequestFilter instead, or indeed, regular CXF interceptors

Cheers, Sergey

Thanks,
Sriram



--
View this message in context: 
http://cxf.547215.n5.nabble.com/Modify-Message-HTTP-REQUEST-METHOD-Jax-rs-RequestHandler-tp5723255.html
Sent from the cxf-user mailing list archive at Nabble.com.


Reply via email to