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, extractCredentialsextractScheme, schemecomplete, 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, routerespondWithDefaultHeader, respondWithDefaultHeaders, respondWithHeader, respondWithHeaderswithRangeSupportignoreTrailingSlash, 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, redirectToTrailingSlashIfMissingparameter, parameter, parameterList, parameterList, parameterList, parameterMap, parameterMultiMap, parameterOptional, parameterOptional, parameterOrDefault, parameterRequiredValueextractClientIP, rejectEmptyResponse, requestEntityEmpty, requestEntityPresent, selectPreferredLanguage, validate, withoutSizeLimit, withSizeLimitdelete, extractMethod, get, head, method, options, overrideMethodWithParameter, patch, post, putcompleteWith, entity, handleWith, requestextractHost, host, host, host, hostattribute, optionalAttributecheckSameOrigin, headerValue, headerValueByName, headerValueByType, headerValuePF, optionalHeaderValue, optionalHeaderValueByName, optionalHeaderValueByType, optionalHeaderValuePFcompleteOrRecoverWith, onComplete, onComplete, onCompleteWithBreaker, onSuccess, onSuccessformField, formField, formFieldList, formFieldList, formFieldList, formFieldMap, formFieldMultiMap, formFieldOptional, formFieldOptionalfileUpload, fileUploadAll, storeUploadedFile, storeUploadedFilesdefaultContentTypeResolver, 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, listDirectoryContentshandleExceptions, handleRejectionslogRequest, logRequest, logRequest, logRequestResult, logRequestResultOptional, logResult, logResult, logResultcookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, optionalCookie, setCookie, setCookiedecodeRequest, decodeRequestWith, decodeRequestWith, encodeResponse, encodeResponseWith, requestEncodedWith, responseEncodingAccepted, withPrecompressedMediaTypeSupportconditional, conditional, conditional, conditionalcancelRejection, 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, withSettingspublic 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)