You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by cheng <we...@gmail.com> on 2017/03/08 01:43:11 UTC

atmosphere-websocket - How to dynamically set to uri?

Hi everyone,

I am trying to build a web socket proxy. What i want to achieve is the
following:

from: camel/{somepath}
to: service1Host:80/[userid]/{somepath}

I want to forward camel/somepath to an dynamic path in my service1Host
server. The configuration i had was below.

MyRouteBuilder:
...
from("atmosphere-websocket:///?matchOnUriPrefix=true")
    //.process(requestPathModificationProcessor)
   
.to("atmosphere-websocket:///service1Host:80?bridgeEndpoint=true&throwExceptionOnFailure=false");

web.xml
...
<servlet-mapping>
        <servlet-name>CamelWebSocketServlet</servlet-name>
        <url-pattern>/camel/*</url-pattern>
    </servlet-mapping>

Now I want to add a requestPathModificationProcessor in between to
dynamically change the request path, but i have not found any example or
documentation on this. In camel http, i can easily do it like following.

HttpServletRequest req = exchange.getIn().getBody(HttpServletRequest.class);
 String newPath = modifyPath(req.getPathInfo());
exchange.getIn().setHeader(Exchange.HTTP_PATH, newPath);

But i don't know how to do it in atmosphere-websocket. Can anyone give me a
hint please? Thanks in advance.

Thanks,
Cheng



--
View this message in context: http://camel.465427.n5.nabble.com/atmosphere-websocket-How-to-dynamically-set-to-uri-tp5795050.html
Sent from the Camel - Users mailing list archive at Nabble.com.