Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-10342

WebSockets options are ignored

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.16.3
    • Fix Version/s: 2.18.0
    • Component/s: camel-websocket
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                davsclaus Claus Ibsen
                Reporter:
                dcendents Daniel Beland
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: