Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

How to Maintain Session with CXF?

$
0
0
The service I'm using requires that we "login" and maintain the session.
(Yuck, I know!)

I can do this using regular java and CXF, but can't figure out the right way
with Camel CXF.

This works with Java / CXF.

((BindingProvider)
port).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY,
true);

I've tried adding a header:

<setHeader headerName="org.apache.cxf.message.Message.MAINTAIN_SESSION">
<constant>true</constant>
</setHeader>

and using a processor:

public class SessionProcessor implements Processor {
@Override
public void process(Exchange exchange) throws Exception {
// set up the response context which force start document
Map<String, Object> map = (Map)
exchange.getOut().getHeader(Client.REQUEST_CONTEXT);
if (map == null) {
map = new HashMap<String, Object>();
exchange.getOut().setHeader(Client.REQUEST_CONTEXT, map);

map.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);

but, I think I'm doing it too late.

Viewing all articles
Browse latest Browse all 5648

Trending Articles