Hi On Fri, Apr 8, 2011 at 10:33 AM, Mignon, Laurent < [email protected]> wrote:
> Hi, > > I've some troubles to deal with the HttpSession in my REST services. > My services are deployed into tomcat and I use the WebClient to call > these. > > The problem is that each time the client call the server, I recieve a > new HttpSession (the id is different between each call) ant thus, data > put into the session by the previous request are not found by the new > request... > You need to set an org.apache.cxf.message.Message.MAINTAIN_SESSION. You can do it by using JAXRSClientFactoryBean: JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean()l bean.setAddress(address); bean.setProperties(Collections.singletonMap(Message.MAINTAIN_SESSION, Boolean.TRUE)); vean.createWebClient(); or WebClient wc = webClient.create(address); WebClient.getConfig(wc).getRequestContext().put(Message.MAINTAIN_SESSION, Boolean.TRUE)); This property can also be injected from Spring. Alternatively, copy Cookies explicitly, by getting Cookies from the current Response and setting them as headers on the current client Hope that helps, Sergey How can I use with HttpSession to manage datas related to the session > between calls. > > Thanks > > lmg >
