Package org.eclipse.jetty.http3.api
Interface Session.Server.Listener
- All Superinterfaces:
Session.Listener
- Enclosing interface:
- Session.Server
The server-side specific Session.Listener
.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Callback method invoked when a connection has been accepted by the server.default Stream.Server.Listener
onRequest
(Stream.Server stream, HeadersFrame frame) Callback method invoked when a request is received.Methods inherited from interface org.eclipse.jetty.http3.api.Session.Listener
onDisconnect, onFailure, onGoAway, onIdleTimeout, onPreface, onSettings
-
Method Details
-
onAccept
Callback method invoked when a connection has been accepted by the server.
- Parameters:
session
- the session
-
onRequest
Callback method invoked when a request is received.
Applications should implement this method to process HTTP/3 requests, typically providing an HTTP/3 response via
Stream.Server.respond(HeadersFrame)
:class MyServer implements Session.Server.Listener { @Override public Stream.Server.Listener onRequest(Stream.Server stream, HeadersFrame frame) { // Send a response. var response = new MetaData.Response(HttpVersion.HTTP_3, HttpStatus.OK_200, HttpFields.EMPTY); stream.respond(new HeadersFrame(response, true)); if (!frame.isLast()) stream.demand(); return null; } }
If there is request content (indicated by the fact that the HEADERS frame is not the last in the stream), then applications either:
- return
null
to indicate that they are not interested in reading the content - must call
Stream.demand()
and return aStream.Server.Listener
that overridesStream.Server.Listener.onDataAvailable(Stream.Server)
that reads and consumes the content.
- Parameters:
stream
- the stream associated with the requestframe
- the HEADERS frame containing the request headers- Returns:
- a
Stream.Server.Listener
that will be notified of stream events - See Also:
- return
-