Class WebSocketRequestHandler

java.lang.Object
org.apache.wicket.core.request.handler.AbstractPartialPageRequestHandler
org.apache.wicket.protocol.ws.api.WebSocketRequestHandler
All Implemented Interfaces:
IPageClassRequestHandler, IPageRequestHandler, IPartialPageRequestHandler, IWebSocketRequestHandler, ILoggableRequestHandler, IRequestHandler

A handler of WebSocket requests.
Since:
6.0
  • Constructor Details

  • Method Details

    • push

      public void push(CharSequence message)
      Description copied from interface: IWebSocketRequestHandler
      Pushes a text message to the client.
      Specified by:
      push in interface IWebSocketRequestHandler
      Parameters:
      message - the text message to push to the client if the web socket connection is open
    • pushAsync

      public Future<Void> pushAsync(CharSequence message, long timeout)
      Description copied from interface: IWebSocketRequestHandler
      Pushes a text message to the client in an asynchronous way.
      Specified by:
      pushAsync in interface IWebSocketRequestHandler
      Parameters:
      message - the text message to push to the client if the web socket connection is open
      timeout - the timeout for operation
      Returns:
      a Future representing the send operation. Or null if connection is closed.
    • pushAsync

      public Future<Void> pushAsync(CharSequence message)
      Description copied from interface: IWebSocketRequestHandler
      Pushes a text message to the client in an asynchronous way.
      Specified by:
      pushAsync in interface IWebSocketRequestHandler
      Parameters:
      message - the text message to push to the client if the web socket connection is open
      Returns:
      a Future representing the send operation. Or null if connection is closed.
    • push

      public void push(byte[] message, int offset, int length)
      Description copied from interface: IWebSocketRequestHandler
      Pushes a binary message to the client.
      Specified by:
      push in interface IWebSocketRequestHandler
      Parameters:
      message - the binary message to push to the client if the web socket connection is open
      offset - the offset to start to read from the message
      length - how many bytes to read from the message
    • pushAsync

      public Future<Void> pushAsync(byte[] message, int offset, int length)
      Description copied from interface: IWebSocketRequestHandler
      Pushes a binary message to the client.
      Specified by:
      pushAsync in interface IWebSocketRequestHandler
      Parameters:
      message - the binary message to push to the client if the web socket connection is open
      offset - the offset to start to read from the message
      length - how many bytes to read from the message
      Returns:
      a Future representing the send operation. Or null if connection is closed.
    • pushAsync

      public Future<Void> pushAsync(byte[] message, int offset, int length, long timeout)
      Description copied from interface: IWebSocketRequestHandler
      Pushes a binary message to the client.
      Specified by:
      pushAsync in interface IWebSocketRequestHandler
      Parameters:
      message - the binary message to push to the client if the web socket connection is open
      offset - the offset to start to read from the message
      length - how many bytes to read from the message
      timeout - the timeout for operation
      Returns:
      a Future representing the send operation. Or null if connection is closed.
    • shouldPushWhenEmpty

      protected boolean shouldPushWhenEmpty()
      Returns:
      if true then EMPTY partial updates will se send. If false then EMPTY partial updates will be skipped. A possible use case is: a page receives and a push event but no one is listening to it, and nothing is added to WebSocketRequestHandler thus no real push to client is needed. For compatibilities this is set to true. Thus EMPTY updates are sent by default.
    • getUpdate

      Specified by:
      getUpdate in class AbstractPartialPageRequestHandler
    • getComponents

      public Collection<? extends Component> getComponents()
      Description copied from interface: IPartialPageRequestHandler
      Returns an unmodifiable collection of all components added to this target
      Specified by:
      getComponents in interface IPartialPageRequestHandler
      Returns:
      unmodifiable collection of all components added to this target
    • getLogData

      public ILogData getLogData()
      Description copied from interface: ILoggableRequestHandler
      Returns the collected log data for this request handler and should never throw an exception. This method is never called before the request handler is detached.
      Specified by:
      getLogData in interface ILoggableRequestHandler
      Returns:
      The collected log data.
    • respond

      public void respond(IRequestCycle requestCycle)
      Description copied from interface: IRequestHandler
      Generates a response.
      Specified by:
      respond in interface IRequestHandler
      Parameters:
      requestCycle - the current request cycle
    • detach

      public void detach(IRequestCycle requestCycle)
      Description copied from interface: IRequestHandler
      This method is called at the end of a request cycle to indicate that processing is done and that cleaning up of the subject(s) of this target may be done.
      Specified by:
      detach in interface IRequestHandler
      Parameters:
      requestCycle - the current request cycle