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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNettyServerWebSocketUpgradeHandler(NettyEmbeddedServices embeddedServices, WebSocketSessionRepository webSocketSessionRepository, ConversionService conversionService, NettyHttpServerConfiguration serverConfiguration) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpRequest request, CloseableByteBody body, OutboundAccess outboundAccess) Handle a request.voidhandleUnboundError(Throwable cause) Handle an error that is not bound to a request, i.e.voidremoved()Called when the handler is removed.voidresponseWritten(Object attachment) Called roughly when a response has been written.voidsetNext(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:RequestHandlerHandle a request.- Specified by:
acceptin interfaceRequestHandler- Parameters:
ctx- The context this request came in onrequest- The request line and headersbody- The request bodyoutboundAccess- TheOutboundAccessto use for writing the response
-
handleUnboundError
Description copied from interface:RequestHandlerHandle an error that is not bound to a request, i.e. happens outside aStreamedHttpRequest.- Specified by:
handleUnboundErrorin interfaceRequestHandler- Parameters:
cause- The error
-
responseWritten
Description copied from interface:RequestHandlerCalled 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 responsePublisherhas been fully consumed.
This is used for cleaning up the request.- Specified by:
responseWrittenin interfaceRequestHandler- Parameters:
attachment- Object passed toOutboundAccess.attachment(Object)
-
removed
public void removed()Description copied from interface:RequestHandlerCalled when the handler is removed.- Specified by:
removedin interfaceRequestHandler
-
setNext
-