Daniel Beland created CAMEL-10342:
-------------------------------------
Summary: WebSockets options are ignored
Key: CAMEL-10342
URL: https://issues.apache.org/jira/browse/CAMEL-10342
Project: Camel
Issue Type: Bug
Components: camel-websocket
Affects Versions: 2.16.3
Reporter: Daniel Beland
Setting maxTextMessageSize or maxBinaryMessageSize has no effect, messages
above the limit are still consumed and the route is started.
I was debugging it to understand what was wrong and I came to the conclusion
that parameters are set correctly on the camel WebSocketEndpoint and then on
the ServletContextHandler (in camel method
WebSocketComponent.setWebSocketComponentServletInitialParameter).
But then the same values are null in jetty method WebSocketServlet.init() and
they are not set on the WebSocketFactory.
When I open a WebSocket connection I can see the default values are used
instead of my settings in jetty WebSocketFactory.upgrade method.
I think the problem is the init parameters that are set on the camel
ServletContextHandler are not copied on the jetty ServletHolder.
If I override the websocket bean in blueprint.xml with my own and override the
createServlet method to copy the parameters then everything works correctly.
So effectively changing the line in createServlet
handler.addServlet(new ServletHolder(servlet), pathSpec);
By
ServletHolder servletHolder = new ServletHolder(servlet);
servletHolder.setInitParameters(handler.getInitParams());
handler.addServlet(servletHolder, pathSpec);
Also I think the unit test
WebscoketEndpointConfigurationTest.testSetServletInitalparameters is wrong, it
simply verifies that the values are set in camel but never checks they are set
correctly on the jetty side.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)