6 jun
2017

HttpServletRequest is coming as null in Apache cxf interceptor

I need to match request along with its corresponding response so i am trying to take session id for matching each request along with its response. I am using Phase.PRE_STREAM in my constructor.

I am trying to take HttpServletRequest and session id as below in my interceptor

public void handleMessage(Message msg) {
    HttpServletRequest req = (HttpServletRequest)msg.get("HTTP.REQUEST");
}

But i am getting null value. Could someone tell me how to take HttpServletRequest in apache cxf?

Do i need to set session id while creating client.I create my client as below

JAXRSClientFactoryBean sf = new JAXRSClientFactoryBean();
sf.setResourceClass(CustomerService.class);
sf.setAddress("http://localhost:9000/");
BindingFactoryManager manager = sf.getBus().getExtension(BindingFactoryManager.class);
JAXRSBindingFactory factory = new JAXRSBindingFactory();
factory.setBus(sf.getBus());
manager.registerBindingFactory(JAXRSBindingFactory.JAXRS_BINDING_ID, factory);
CustomerService service = sf.create(CustomerService.class);
WebClient wc = sf.createWebClient();

COMENTARIOS

DEJA TU COMENTARIO

© 2017 website by Rubit Corporation