Package org.jgrapes.http.events
Class ProtocolSwitchAccepted
- All Implemented Interfaces:
Future<Void>,Associator,Eligible
Indicates that a component has accepted a
Request.In.Get with
a header that requested an upgrade to another protocol.The HttpServer component listens for such events and
automatically creates the required Response event.
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State -
Field Summary
Fields inherited from class org.jgrapes.core.internal.EventBase
completed, completionEvents, invokedFor -
Constructor Summary
ConstructorsConstructorDescriptionProtocolSwitchAccepted(Request.In request, String protocol) Creates a new event. -
Method Summary
Modifier and TypeMethodDescriptionprotocol()The accepted protocol.Returns the original request.Returns the resource for which the socket was opened.Methods inherited from class org.jgrapes.core.Event
addCompletionEvent, associated, cancel, channels, channels, completionEvents, currentResults, defaultCriterion, forChannels, get, get, handled, handlingError, isCancelled, isDone, isEligibleFor, isStopped, processedBy, results, results, resumeHandling, setAssociated, setChannels, setRequiresResult, setResult, stop, suspendHandling, suspendHandling, tieTo, toStringMethods inherited from class org.jgrapes.core.internal.EventBase
disableTracking, enqueued, firstResultAssigned, isTracked, onCompletionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jgrapes.core.Associator
associated, associated, associated, associatedGetMethods inherited from interface java.util.concurrent.Future
exceptionNow, resultNow, state
-
Constructor Details
-
ProtocolSwitchAccepted
Creates a new event.The request event passed in as parameter is used by the
HttpServerto build the response message and link an existing session to the web socket.To be precise, the
HttpServerretrieves theHttpRequestfrom the request event and uses the prepared response provided byHttpRequest.response()to build the response. The default information contained in this prepared response is sufficient to build the actual response. If required, the accepting component can add special header fields to the prepared response.- Parameters:
request- the base response dataprotocol- the accepted protocol
-
-
Method Details
-
resourceName
Returns the resource for which the socket was opened.- Returns:
- the value
-
requestEvent
Returns the original request.- Returns:
- the value
-
protocol
The accepted protocol.- Returns:
- the protocol
-