Package com.mastfrog.acteur.server
Class WebSocketEvent
java.lang.Object
com.mastfrog.acteur.server.WebSocketEvent
- All Implemented Interfaces:
Event<io.netty.handler.codec.http.websocketx.WebSocketFrame>
public final class WebSocketEvent
extends Object
implements Event<io.netty.handler.codec.http.websocketx.WebSocketFrame>
- Author:
- Tim Boudreau
-
Constructor Summary
ConstructorsConstructorDescriptionWebSocketEvent(io.netty.handler.codec.http.websocketx.WebSocketFrame frame, io.netty.channel.ChannelHandlerContext channel, SocketAddress addr, Codec mapper) -
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()<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.io.netty.handler.codec.http.websocketx.WebSocketFramerequest()Get the actual HTTP request.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.mastfrog.acteur.Event
getChannel, getContent, getContentAsJSON, getRemoteAddress, getRequest
-
Constructor Details
-
WebSocketEvent
public WebSocketEvent(io.netty.handler.codec.http.websocketx.WebSocketFrame frame, io.netty.channel.ChannelHandlerContext channel, SocketAddress addr, Codec mapper)
-
-
Method Details
-
channel
public io.netty.channel.Channel channel()Description copied from interface:EventGet the Netty channel this request is travelling through. -
ctx
public io.netty.channel.ChannelHandlerContext ctx() -
request
public io.netty.handler.codec.http.websocketx.WebSocketFrame request()Description copied from interface:EventGet the actual HTTP request. -
remoteAddress
Description copied from interface:EventGet 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.- Specified by:
remoteAddressin interfaceEvent<io.netty.handler.codec.http.websocketx.WebSocketFrame>- Returns:
- An address
-
jsonContent
Description copied from interface:EventWill use Jackson to parse the request body and return an object of the type requested if possible.- Specified by:
jsonContentin interfaceEvent<io.netty.handler.codec.http.websocketx.WebSocketFrame>- 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
-
content
Description copied from interface:EventGet the raw request body, if any.- Specified by:
contentin interfaceEvent<io.netty.handler.codec.http.websocketx.WebSocketFrame>- Returns:
- A bytebuf if one is available.
- Throws:
IOException- If something goes wrong
-