I do as below,I can get sessionId of the request,but I cant not get the
context of request,also I can not get the header of the request.Is there any
way to get the context of the session,or the header of the request? Thank
you very much.
<route id="camel-http-proxy-manager">
      <from
uri="jetty://http://192.168.0.154:8181/mymanager/?matchOnUriPrefix=true"/>
           <process ref="myCode"/>
      <to
uri="http://192.168.0.156:8181/mymanager/?bridgeEndpoint=true&amp;throwExceptionOnFailure=false";
/>
      <to uri="log:MyLogger?level=INFO&amp;showAll=true" />
       <choice>
               
                <when>
                    <simple>${header.sessionId} == '0'</simple>
                    <setHeader headerName="CamelHttpUrl">
                      
<constant>"http://192.168.0.154:8181/uiserver/index.jsp";</constant>
                    </setHeader>
                       <to
uri="ahc://http://192.168.0.154:8181/uiserver/index.jsp"; />
                </when>
                <otherwise>
                    <to
uri="http://192.168.0.156:8181/mymanager/?bridgeEndpoint=true&amp;throwExceptionOnFailure=false";
/>
                    <process ref="myCode"/>
                    <to uri="log:MyLogger?level=INFO&amp;showAll=true" />
                </otherwise>
            </choice>
    </route>

<bean id="myCode" class="org.apache.servicemix.examples.camel.MyTransform">

public void process(Exchange exchange) throws Exception {
                String sessionId =
exchange.getIn(HttpMessage.class).getRequest().getRequestedSessionId();
                String contextPath =
exchange.getIn(HttpMessage.class).getRequest().getContextPath();
                if (null==sessionId)
                {
                        exchange.getIn().setHeader("sessionId", "0");
                        exchange.getIn().setHeader("path", contextPath);
                }
                else
                {
                        exchange.getIn().setHeader("sessionId", sessionId);;
                }
        } 



--
View this message in context: 
http://camel.465427.n5.nabble.com/can-camel-get-the-context-of-session-the-request-or-the-context-of-header-of-the-reques-tp5745080.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to