public abstract class WebSocketDirectives extends SecurityDirectives
SecurityDirectives.ProvidedCredentials, SecurityDirectives.ProvidedCredentials$
Constructor and Description |
---|
WebSocketDirectives() |
Modifier and Type | Method and Description |
---|---|
Route |
extractOfferedWsProtocols(java.util.function.Function<java.util.List<java.lang.String>,Route> inner)
Extract the list of WebSocket subprotocols as offered by the client in the
Sec-WebSocket-Protocol header if
this is a WebSocket request. |
Route |
extractUpgradeToWebSocket(java.util.function.Function<UpgradeToWebSocket,Route> inner)
Deprecated.
use
webSocketUpgrade instead since Akka HTTP 10.2.0 |
Route |
extractWebSocketUpgrade(java.util.function.Function<WebSocketUpgrade,Route> inner)
Extract the UpgradeToWebSocket attribute if this is a WebSocket request.
|
<T> Route |
handleWebSocketMessages(org.apache.pekko.stream.javadsl.Flow<Message,Message,T> handler)
Handles WebSocket requests with the given handler and rejects other requests with an
ExpectedWebSocketRequestRejection . |
<T> Route |
handleWebSocketMessagesForOptionalProtocol(org.apache.pekko.stream.javadsl.Flow<Message,Message,T> handler,
java.util.Optional<java.lang.String> subprotocol)
Handles WebSocket requests with the given handler and rejects other requests with an
ExpectedWebSocketRequestRejection . |
<T> Route |
handleWebSocketMessagesForProtocol(org.apache.pekko.stream.javadsl.Flow<Message,Message,T> handler,
java.lang.String subprotocol)
Handles WebSocket requests with the given handler if the given subprotocol is offered in the request and
rejects other requests with an
ExpectedWebSocketRequestRejection or an UnsupportedWebSocketSubprotocolRejection . |
authenticateBasic, authenticateBasicAsync, authenticateBasicAsyncOptional, authenticateBasicOptional, authenticateBasicPF, authenticateBasicPFAsync, authenticateOAuth2, authenticateOAuth2Async, authenticateOAuth2AsyncOptional, authenticateOAuth2Optional, authenticateOrRejectWithChallenge, authenticateOrRejectWithChallenge, authorize, authorizeAsync, authorizeAsyncWithRequestContext, authorizeWithRequestContext, extractCredentials
extractScheme, scheme
complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, completeOK, completeOKWithFuture, completeOKWithFuture, completeOKWithFuture, completeOKWithFutureString, completeOKWithFutureString, completeWithFuture, completeWithFuture, completeWithFuture, completeWithFutureResponse, completeWithFutureStatus, completeWithFutureStatus, concat, concat, failWith, handle, handleSync, redirect, reject, reject, reject, route, route
respondWithDefaultHeader, respondWithDefaultHeaders, respondWithHeader, respondWithHeaders
withRangeSupport
ignoreTrailingSlash, path, path, path, path, path, path, pathEnd, pathEndOrSingleSlash, pathPrefix, pathPrefix, pathPrefix, pathPrefix, pathPrefix, pathPrefix, pathPrefixTest, pathPrefixTest, pathPrefixTest, pathPrefixTest, pathSingleSlash, pathSuffix, pathSuffix, pathSuffix, pathSuffix, pathSuffixTest, pathSuffixTest, pathSuffixTest, pathSuffixTest, rawPathPrefix, rawPathPrefix, rawPathPrefix, rawPathPrefix, rawPathPrefixTest, rawPathPrefixTest, rawPathPrefixTest, rawPathPrefixTest, redirectToNoTrailingSlashIfPresent, redirectToTrailingSlashIfMissing
parameter, parameter, parameterList, parameterList, parameterList, parameterMap, parameterMultiMap, parameterOptional, parameterOptional, parameterOrDefault, parameterRequiredValue
extractClientIP, rejectEmptyResponse, requestEntityEmpty, requestEntityPresent, selectPreferredLanguage, validate, withoutSizeLimit, withSizeLimit
delete, extractMethod, get, head, method, options, overrideMethodWithParameter, patch, post, put
completeWith, entity, handleWith, request
extractHost, host, host, host, host
attribute, optionalAttribute
checkSameOrigin, headerValue, headerValueByName, headerValueByType, headerValuePF, optionalHeaderValue, optionalHeaderValueByName, optionalHeaderValueByType, optionalHeaderValuePF
completeOrRecoverWith, onComplete, onComplete, onCompleteWithBreaker, onSuccess, onSuccess
formField, formField, formFieldList, formFieldList, formFieldList, formFieldMap, formFieldMultiMap, formFieldOptional, formFieldOptional
fileUpload, fileUploadAll, storeUploadedFile, storeUploadedFiles
defaultContentTypeResolver, defaultDirectoryRenderer, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectory, getFromBrowseableDirectory, getFromBrowseableDirectory, getFromBrowseableDirectory, getFromDirectory, getFromDirectory, getFromFile, getFromFile, getFromFile, getFromFile, getFromFile, getFromResource, getFromResource, getFromResource, getFromResource, getFromResourceDirectory, getFromResourceDirectory, getFromResourceDirectory, getFromResourceDirectory, listDirectoryContents, listDirectoryContents, listDirectoryContents, listDirectoryContents
handleExceptions, handleRejections
logRequest, logRequest, logRequest, logRequestResult, logRequestResultOptional, logResult, logResult, logResult
cookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, optionalCookie, setCookie, setCookie
decodeRequest, decodeRequestWith, decodeRequestWith, encodeResponse, encodeResponseWith, requestEncodedWith, responseEncodingAccepted, withPrecompressedMediaTypeSupport
conditional, conditional, conditional, conditional
cancelRejection, cancelRejections, cancelRejections, extract, extractActorSystem, extractDataBytes, extractEntity, extractExecutionContext, extractLog, extractMatchedPath, extractMaterializer, extractParserSettings, extractRequest, extractRequestContext, extractRequestEntity, extractSettings, extractStrictEntity, extractStrictEntity, extractUnmatchedPath, extractUri, mapInnerRoute, mapRejections, mapRequest, mapRequestContext, mapResponse, mapResponseEntity, mapResponseHeaders, mapRouteResult, mapRouteResultFuture, mapRouteResultPF, mapRouteResultWith, mapRouteResultWithPF, mapSettings, mapUnmatchedPath, pass, provide, recoverRejections, recoverRejectionsWith, toStrictEntity, toStrictEntity, withExecutionContext, withLog, withMaterializer, withSettings
public Route extractOfferedWsProtocols(java.util.function.Function<java.util.List<java.lang.String>,Route> inner)
Sec-WebSocket-Protocol
header if
this is a WebSocket request. Rejects with an ExpectedWebSocketRequestRejection
, otherwise.inner
- (undocumented)public Route extractUpgradeToWebSocket(java.util.function.Function<UpgradeToWebSocket,Route> inner)
webSocketUpgrade
instead since Akka HTTP 10.2.0UpgradeToWebSocket
header if existent. Rejects with an ExpectedWebSocketRequestRejection
, otherwise.
inner
- (undocumented)public Route extractWebSocketUpgrade(java.util.function.Function<WebSocketUpgrade,Route> inner)
ExpectedWebSocketRequestRejection
, otherwise.inner
- (undocumented)public <T> Route handleWebSocketMessages(org.apache.pekko.stream.javadsl.Flow<Message,Message,T> handler)
ExpectedWebSocketRequestRejection
.handler
- (undocumented)public <T> Route handleWebSocketMessagesForOptionalProtocol(org.apache.pekko.stream.javadsl.Flow<Message,Message,T> handler, java.util.Optional<java.lang.String> subprotocol)
ExpectedWebSocketRequestRejection
.
If the subprotocol
parameter is None any WebSocket request is accepted. If the subprotocol
parameter is
Some(protocol)
a WebSocket request is only accepted if the list of subprotocols supported by the client (as
announced in the WebSocket request) contains protocol
. If the client did not offer the protocol in question
the request is rejected with an UnsupportedWebSocketSubprotocolRejection
rejection.
To support several subprotocols you may chain several handleWebSocketMessagesForOptionalProtocol
routes.
handler
- (undocumented)subprotocol
- (undocumented)public <T> Route handleWebSocketMessagesForProtocol(org.apache.pekko.stream.javadsl.Flow<Message,Message,T> handler, java.lang.String subprotocol)
ExpectedWebSocketRequestRejection
or an UnsupportedWebSocketSubprotocolRejection
.handler
- (undocumented)subprotocol
- (undocumented)