Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-4917

Websockets are not working if URL has a hash in it

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 6.3.0
    • 6.4.0
    • None
    • 1) Sun JDK 1.7.09
      2) Ubuntu 12.10
      3) Wicket 6.3.0
      4) Google Chrome 24.0.1312.35 beta

    Description

      I have tried to create "single page" application with custom HomePageMapper to eliminate ?1 at the end of the URL (please see quickstart app attached)

      Inconsistemcy:
      I have used wicket-native-websocket 0.4 which have dependency to wicket-experimental 6.2.0
      should it be 6.3.0 ?

      Errors:
      1) if the following URL is accessed: http://localhost:8080/#testHash
      The following error appears in the Chrome console:
      URL has fragment component ws://localhost:8080/#testHash&pageId=4

      I believe URL constructed should be: ws://localhost:8080/?&pageId=4#testHash

      2) If the following URL is accessed: http://localhost:8080/
      I have Exception in the web server console:

      WARN - ServletHandler - /&pageId=0
      java.lang.IllegalStateException: Request parameter 'pageId' is required!
      at org.apache.wicket.util.lang.Checks.notEmpty(Checks.java:55)
      at org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor.<init>(AbstractWebSocketProcessor.java:77)
      at org.apache.wicket.protocol.ws.jetty.JettyWebSocketProcessor.<init>(JettyWebSocketProcessor.java:70)
      at org.apache.wicket.protocol.http.Jetty7WebSocketFilter.doWebSocketConnect(Jetty7WebSocketFilter.java:81)
      at org.eclipse.jetty.websocket.WebSocketFactory.acceptWebSocket(WebSocketFactory.java:351)
      at org.apache.wicket.protocol.http.Jetty7WebSocketFilter.acceptWebSocket(Jetty7WebSocketFilter.java:75)
      at org.apache.wicket.protocol.http.AbstractUpgradeFilter.processRequest(AbstractUpgradeFilter.java:102)
      at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:245)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1332)
      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:477)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
      at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
      at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
      at org.eclipse.jetty.server.Server.handle(Server.java:348)
      at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
      at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
      at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:884)
      at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:938)
      at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:630)
      at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
      at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
      at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254)
      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
      at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
      at java.lang.Thread.run(Thread.java:722)

      I believe this exception is caused by my custom home page mapper. May be there is workaround how this can be used? or maybe I can add javascript code to open websocket?

      Thanks in advance

      Attachments

        1. fix-WICKET-4917.patch
          1 kB
          Maxim Solodovnik
        2. websockets.tgz
          21 kB
          Maxim Solodovnik

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            solomax Maxim Solodovnik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: