Class NettyServerWebSocketUpgradeHandler
java.lang.Object
io.micronaut.http.server.netty.websocket.NettyServerWebSocketUpgradeHandler
- All Implemented Interfaces:
RequestHandler
@Internal
public final class NettyServerWebSocketUpgradeHandler
extends Object
implements RequestHandler
Handles WebSocket upgrade requests.
- Since:
- 1.0
- Author:
- graemerocher
-
Field Summary
-
Constructor Summary
ConstructorDescriptionNettyServerWebSocketUpgradeHandler
(NettyEmbeddedServices embeddedServices, WebSocketSessionRepository webSocketSessionRepository, ConversionService conversionService, NettyHttpServerConfiguration serverConfiguration) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpRequest request, CloseableByteBody body, OutboundAccess outboundAccess) Handle a request.void
handleUnboundError
(Throwable cause) Handle an error that is not bound to a request, i.e.void
removed()
Called when the handler is removed.void
responseWritten
(Object attachment) Called roughly when a response has been written.void
setNext
(RoutingInBoundHandler next)
-
Field Details
-
ID
- See Also:
-
SCHEME_WEBSOCKET
- See Also:
-
SCHEME_SECURE_WEBSOCKET
- See Also:
-
COMPRESSION_HANDLER
- See Also:
-
-
Constructor Details
-
NettyServerWebSocketUpgradeHandler
public NettyServerWebSocketUpgradeHandler(NettyEmbeddedServices embeddedServices, WebSocketSessionRepository webSocketSessionRepository, ConversionService conversionService, NettyHttpServerConfiguration serverConfiguration) Default constructor.- Parameters:
embeddedServices
- The embedded server serviceswebSocketSessionRepository
- The websocket session repositoryconversionService
- The conversion serviceserverConfiguration
- The server configuration
-
-
Method Details
-
accept
public void accept(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpRequest request, CloseableByteBody body, OutboundAccess outboundAccess) Description copied from interface:RequestHandler
Handle a request.- Specified by:
accept
in interfaceRequestHandler
- Parameters:
ctx
- The context this request came in onrequest
- The request line and headersbody
- The request bodyoutboundAccess
- TheOutboundAccess
to use for writing the response
-
handleUnboundError
Description copied from interface:RequestHandler
Handle an error that is not bound to a request, i.e. happens outside aStreamedHttpRequest
.- Specified by:
handleUnboundError
in interfaceRequestHandler
- Parameters:
cause
- The error
-
responseWritten
Description copied from interface:RequestHandler
Called roughly when a response has been written. In particular, it's called when the user is "done" with the response and has no way of adding further data. The bytes may not have been fully flushed yet, but e.g. the responsePublisher
has been fully consumed.
This is used for cleaning up the request.- Specified by:
responseWritten
in interfaceRequestHandler
- Parameters:
attachment
- Object passed toOutboundAccess.attachment(Object)
-
removed
public void removed()Description copied from interface:RequestHandler
Called when the handler is removed.- Specified by:
removed
in interfaceRequestHandler
-
setNext
-