Session Support - 6.3

Talend ESB Mediation Developer Guide

EnrichVersion
6.3
EnrichProdName
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
task
Design and Development
EnrichPlatform
Talend ESB

The session support option, sessionSupport, can be used to enable a HttpSession object and access the session object while processing the exchange. For example, the following route enables sessions:

<route>
   <from uri="jetty:http://0.0.0.0/myapp/myservice/?sessionSupport=true"/>
   <processRef ref="myCode"/>
<route>

The myCode Processor can be instantiated by a Spring bean element:

<bean id="myCode"class="com.mycompany.MyCodeProcessor"/>

where the processor implementation can access the HttpSession as follows:

public void process(Exchange exchange) throws Exception {
    HttpSession session = exchange.getIn(HttpMessage.class).getRequest()
        .getSession(); 
    ...
}