Interface Event<T>

All Known Subinterfaces:
HttpEvent
All Known Implementing Classes:
WebSocketEvent

public interface Event<T>
An HTTP request or similar, which is passed to Pages for their Acteurs to respond to.
Author:
Tim Boudreau
  • Method Summary

    Modifier and Type
    Method
    Description
    io.netty.channel.Channel
    Get the Netty channel this request is travelling through.
    io.netty.buffer.ByteBuf
    Get the raw request body, if any.
    io.netty.channel.ChannelHandlerContext
    ctx()
     
    default io.netty.channel.Channel
    Deprecated.
    default io.netty.buffer.ByteBuf
    Deprecated.
    use content()
    default <T> T
    Deprecated.
    use jsonContent()
    Deprecated.
    use remoteAddress().
    default T
    Deprecated.
    use request()
    <T> T
    jsonContent(Class<T> type)
    Will use Jackson to parse the request body and return an object of the type requested if possible.
    Get the remote address of whoever made the request.
    Get the actual HTTP request.
  • Method Details

    • channel

      io.netty.channel.Channel channel()
      Get the Netty channel this request is travelling through.
      Returns:
      The channel
    • request

      T request()
      Get the actual HTTP request.
      Returns:
      An http request
    • remoteAddress

      SocketAddress remoteAddress()
      Get the remote address of whoever made the request. The framework will take care of interpreting HTTP headers used by proxies to represent the real origin.
      Returns:
      An address
    • jsonContent

      <T> T jsonContent(Class<T> type) throws Exception
      Will use Jackson to parse the request body and return an object of the type requested if possible.

      Type Parameters:
      T - The type
      Parameters:
      type - The type of object to return
      Returns:
      An object of type T
      Throws:
      IOException - if the body is malformed or for some other reason, cannot be parsed
      Exception
    • ctx

      io.netty.channel.ChannelHandlerContext ctx()
    • content

      io.netty.buffer.ByteBuf content() throws IOException
      Get the raw request body, if any.
      Returns:
      A bytebuf if one is available.
      Throws:
      IOException - If something goes wrong
    • getChannel

      @Deprecated default io.netty.channel.Channel getChannel()
      Deprecated.
    • getRequest

      @Deprecated default T getRequest()
      Deprecated.
      use request()
      Get the actual HTTP request.
      Returns:
      An http request
    • getRemoteAddress

      @Deprecated default SocketAddress getRemoteAddress()
      Deprecated.
      use remoteAddress().
      Get the remote address of whoever made the request, if necessary, interpreting HTTP proxy headers to give the real remote address, not that of the reverse proxy.
      Returns:
      An address
    • getContentAsJSON

      @Deprecated default <T> T getContentAsJSON(Class<T> type) throws Exception
      Deprecated.
      use jsonContent()
      Will use Jackson to parse the request body and return an object of the type requested if possible.

      Type Parameters:
      T - The type
      Parameters:
      type - The type of object to return
      Returns:
      An object of type T
      Throws:
      IOException - if the body is malformed or for some other reason, cannot be parsed
      Exception
    • getContent

      @Deprecated default io.netty.buffer.ByteBuf getContent() throws IOException
      Deprecated.
      use content()
      Get the Netty channel this request is travelling through.
      Returns:
      The channel
      Throws:
      IOException