Class WebSocketDirectives
- java.lang.Object
-
- akka.http.javadsl.server.directives.BasicDirectives
-
- akka.http.javadsl.server.directives.CacheConditionDirectives
-
- akka.http.javadsl.server.directives.CodingDirectives
-
- akka.http.javadsl.server.directives.CookieDirectives
-
- akka.http.javadsl.server.directives.DebuggingDirectives
-
- akka.http.javadsl.server.directives.ExecutionDirectives
-
- akka.http.javadsl.server.directives.FileAndResourceDirectives
-
- akka.http.javadsl.server.directives.FileUploadDirectives
-
- akka.http.javadsl.server.directives.FormFieldDirectives
-
- akka.http.javadsl.server.directives.FutureDirectives
-
- akka.http.javadsl.server.directives.HeaderDirectives
-
- akka.http.javadsl.server.directives.AttributeDirectives
-
- akka.http.javadsl.server.directives.HostDirectives
-
- akka.http.javadsl.server.directives.MarshallingDirectives
-
- akka.http.javadsl.server.directives.MethodDirectives
-
- akka.http.javadsl.server.directives.MiscDirectives
-
- akka.http.javadsl.server.directives.ParameterDirectives
-
- akka.http.javadsl.server.directives.PathDirectives
-
- akka.http.javadsl.server.directives.RangeDirectives
-
- akka.http.javadsl.server.directives.RespondWithDirectives
-
- akka.http.javadsl.server.directives.RouteDirectives
-
- akka.http.javadsl.server.directives.SchemeDirectives
-
- akka.http.javadsl.server.directives.SecurityDirectives
-
- akka.http.javadsl.server.directives.WebSocketDirectives
-
- Direct Known Subclasses:
TimeoutDirectives
public abstract class WebSocketDirectives extends SecurityDirectives
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class akka.http.javadsl.server.directives.SecurityDirectives
SecurityDirectives.ProvidedCredentials, SecurityDirectives.ProvidedCredentials$
-
-
Constructor Summary
Constructors Constructor Description WebSocketDirectives()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method 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 {@link Sec-WebSocket-Protocol} header if this is a WebSocket request.Route
extractUpgradeToWebSocket(java.util.function.Function<UpgradeToWebSocket,Route> inner)
Deprecated.usewebSocketUpgrade
instead since 10.2.0Route
extractWebSocketUpgrade(java.util.function.Function<WebSocketUpgrade,Route> inner)
Extract the UpgradeToWebSocket attribute if this is a WebSocket request.<T> Route
handleWebSocketMessages(akka.stream.javadsl.Flow<Message,Message,T> handler)
Handles WebSocket requests with the given handler and rejects other requests with anExpectedWebSocketRequestRejection
.<T> Route
handleWebSocketMessagesForOptionalProtocol(akka.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 anExpectedWebSocketRequestRejection
.<T> Route
handleWebSocketMessagesForProtocol(akka.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 anExpectedWebSocketRequestRejection
or anUnsupportedWebSocketSubprotocolRejection
.-
Methods inherited from class akka.http.javadsl.server.directives.SecurityDirectives
authenticateBasic, authenticateBasicAsync, authenticateBasicAsyncOptional, authenticateBasicOptional, authenticateBasicPF, authenticateBasicPFAsync, authenticateOAuth2, authenticateOAuth2Async, authenticateOAuth2AsyncOptional, authenticateOAuth2Optional, authenticateOrRejectWithChallenge, authenticateOrRejectWithChallenge, authorize, authorizeAsync, authorizeAsyncWithRequestContext, authorizeWithRequestContext, extractCredentials
-
Methods inherited from class akka.http.javadsl.server.directives.SchemeDirectives
extractScheme, scheme
-
Methods inherited from class akka.http.javadsl.server.directives.RouteDirectives
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
-
Methods inherited from class akka.http.javadsl.server.directives.RespondWithDirectives
respondWithDefaultHeader, respondWithDefaultHeaders, respondWithHeader, respondWithHeaders
-
Methods inherited from class akka.http.javadsl.server.directives.RangeDirectives
withRangeSupport
-
Methods inherited from class akka.http.javadsl.server.directives.PathDirectives
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
-
Methods inherited from class akka.http.javadsl.server.directives.ParameterDirectives
parameter, parameter, parameterList, parameterList, parameterList, parameterMap, parameterMultiMap, parameterOptional, parameterOptional, parameterOrDefault, parameterRequiredValue
-
Methods inherited from class akka.http.javadsl.server.directives.MiscDirectives
extractClientIP, rejectEmptyResponse, requestEntityEmpty, requestEntityPresent, selectPreferredLanguage, validate, withoutSizeLimit, withSizeLimit
-
Methods inherited from class akka.http.javadsl.server.directives.MethodDirectives
delete, extractMethod, get, head, method, options, overrideMethodWithParameter, patch, post, put
-
Methods inherited from class akka.http.javadsl.server.directives.MarshallingDirectives
completeWith, entity, handleWith, request
-
Methods inherited from class akka.http.javadsl.server.directives.HostDirectives
extractHost, host, host, host, host
-
Methods inherited from class akka.http.javadsl.server.directives.AttributeDirectives
attribute, optionalAttribute
-
Methods inherited from class akka.http.javadsl.server.directives.HeaderDirectives
checkSameOrigin, headerValue, headerValueByName, headerValueByType, headerValuePF, optionalHeaderValue, optionalHeaderValueByName, optionalHeaderValueByType, optionalHeaderValuePF
-
Methods inherited from class akka.http.javadsl.server.directives.FutureDirectives
completeOrRecoverWith, onComplete, onComplete, onCompleteWithBreaker, onSuccess, onSuccess
-
Methods inherited from class akka.http.javadsl.server.directives.FormFieldDirectives
formField, formField, formFieldList, formFieldList, formFieldList, formFieldMap, formFieldMultiMap, formFieldOptional, formFieldOptional
-
Methods inherited from class akka.http.javadsl.server.directives.FileUploadDirectives
fileUpload, fileUploadAll, storeUploadedFile, storeUploadedFiles
-
Methods inherited from class akka.http.javadsl.server.directives.FileAndResourceDirectives
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
-
Methods inherited from class akka.http.javadsl.server.directives.ExecutionDirectives
handleExceptions, handleRejections
-
Methods inherited from class akka.http.javadsl.server.directives.DebuggingDirectives
logRequest, logRequest, logRequest, logRequestResult, logRequestResultOptional, logResult, logResult, logResult
-
Methods inherited from class akka.http.javadsl.server.directives.CookieDirectives
cookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, optionalCookie, setCookie, setCookie
-
Methods inherited from class akka.http.javadsl.server.directives.CodingDirectives
decodeRequest, decodeRequestWith, decodeRequestWith, encodeResponse, encodeResponseWith, requestEncodedWith, responseEncodingAccepted, withPrecompressedMediaTypeSupport
-
Methods inherited from class akka.http.javadsl.server.directives.CacheConditionDirectives
conditional, conditional, conditional, conditional
-
Methods inherited from class akka.http.javadsl.server.directives.BasicDirectives
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
-
-
-
-
Method Detail
-
extractOfferedWsProtocols
public 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 {@link Sec-WebSocket-Protocol} header if this is a WebSocket request. Rejects with anExpectedWebSocketRequestRejection
, otherwise.- Parameters:
inner
- (undocumented)- Returns:
- (undocumented)
-
extractUpgradeToWebSocket
public Route extractUpgradeToWebSocket(java.util.function.Function<UpgradeToWebSocket,Route> inner)
Deprecated.usewebSocketUpgrade
instead since 10.2.0Extract theUpgradeToWebSocket
header if existent. Rejects with anExpectedWebSocketRequestRejection
, otherwise.- Parameters:
inner
- (undocumented)- Returns:
- (undocumented)
-
extractWebSocketUpgrade
public Route extractWebSocketUpgrade(java.util.function.Function<WebSocketUpgrade,Route> inner)
Extract the UpgradeToWebSocket attribute if this is a WebSocket request. Rejects with anExpectedWebSocketRequestRejection
, otherwise.- Parameters:
inner
- (undocumented)- Returns:
- (undocumented)
-
handleWebSocketMessages
public <T> Route handleWebSocketMessages(akka.stream.javadsl.Flow<Message,Message,T> handler)
Handles WebSocket requests with the given handler and rejects other requests with anExpectedWebSocketRequestRejection
.- Parameters:
handler
- (undocumented)- Returns:
- (undocumented)
-
handleWebSocketMessagesForOptionalProtocol
public <T> Route handleWebSocketMessagesForOptionalProtocol(akka.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 anExpectedWebSocketRequestRejection
.If the
subprotocol
parameter is None any WebSocket request is accepted. If thesubprotocol
parameter isSome(protocol)
a WebSocket request is only accepted if the list of subprotocols supported by the client (as announced in the WebSocket request) containsprotocol
. If the client did not offer the protocol in question the request is rejected with anUnsupportedWebSocketSubprotocolRejection
rejection.To support several subprotocols you may chain several
handleWebSocketMessagesForOptionalProtocol
routes.- Parameters:
handler
- (undocumented)subprotocol
- (undocumented)- Returns:
- (undocumented)
-
handleWebSocketMessagesForProtocol
public <T> Route handleWebSocketMessagesForProtocol(akka.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 anExpectedWebSocketRequestRejection
or anUnsupportedWebSocketSubprotocolRejection
.- Parameters:
handler
- (undocumented)subprotocol
- (undocumented)- Returns:
- (undocumented)
-
-