173.8. 세션 지원

세션 지원 옵션인 sessionSupport 옵션을 사용하여 Exchange를 처리하는 동안 HttpSession 개체를 활성화하고 세션 개체에 액세스할 수 있습니다. 예를 들어 다음 경로는 세션을 활성화합니다.

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

myCode Processor는 Spring 요소에서 인스턴스화할 수 있습니다.

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

프로세서 구현에서 다음과 같이 HttpSession 에 액세스할 수 있는 위치:

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