Package com.mastfrog.acteur
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 TypeMethodDescriptionio.netty.channel.Channelchannel()Get the Netty channel this request is travelling through.io.netty.buffer.ByteBufcontent()Get the raw request body, if any.io.netty.channel.ChannelHandlerContextctx()default io.netty.channel.ChannelDeprecated.default io.netty.buffer.ByteBufDeprecated.use content()default <T> TgetContentAsJSON(Class<T> type) Deprecated.use jsonContent()default SocketAddressDeprecated.use remoteAddress().default TDeprecated.use request()<T> TjsonContent(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.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
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 parsedException
-
ctx
io.netty.channel.ChannelHandlerContext ctx() -
content
Get the raw request body, if any.- Returns:
- A bytebuf if one is available.
- Throws:
IOException- If something goes wrong
-
getChannel
Deprecated. -
getRequest
Deprecated.use request()Get the actual HTTP request.- Returns:
- An http request
-
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.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 parsedException
-
getContent
Deprecated.use content()Get the Netty channel this request is travelling through.- Returns:
- The channel
- Throws:
IOException
-