0
我需要匹配請求及其相應的響應,所以我試圖將會話ID用於匹配每個請求及其響應。 我在我的構造函數中使用了Phase.PRE_STREAM
。HttpServletRequest在Apache cxf攔截器中爲null
我試圖把HttpServletRequest和下面的會話ID在我的攔截
public void handleMessage(Message msg) {
HttpServletRequest req = (HttpServletRequest)msg.get("HTTP.REQUEST");
}
但我正在逐漸空值。有人能告訴我如何在Apache cxf中使用HttpServletRequest嗎?
我是否需要設置會話ID,同時創造client.I創建我的客戶,如下
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();