John Davis
John Davis

Reputation: 51

Restricting protocols for a Camel CometD endpoint

Is it possible to restrict which protocols are allowed on a Camel CometD endpoint, or endpoints in general?

For example, I would like to restrict the endpoint so it can only receive calls through websockets, and not allow HTTP.

Upvotes: 0

Views: 52

Answers (1)

sbordet
sbordet

Reputation: 18639

From the CometD point of view, you can easily do this by specifying, in the server configuration, the list of allowed protocols:

<web-app ...>
  <servlet>
    <servlet-name>cometd</servlet-name>
    <servlet-class>org.cometd.server.CometDServlet</servlet-class>
    <init-param>
      <param-name>allowedTransports</param-name>
      <param-value>websocket</param-value>
    </init-param>
  </servlet>
  ... 
</web-app>

The embedded code case is the following:

BayeuxServerImpl bayeuxServer = new BayeuxServerImpl();
bayeuxServer.setAllowedTransports("websocket");
bayeuxServer.start();

If Camel exposes one of these 2 ways to configure the CometD server, then your issue is solved.

Upvotes: 1

Related Questions