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

WebSockets options are ignored

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.16.3
    • 2.18.0
    • camel-websocket
    • None
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: