Class WebSocketDirectives
java.lang.Object
org.apache.pekko.http.javadsl.server.directives.BasicDirectives
org.apache.pekko.http.javadsl.server.directives.CacheConditionDirectives
org.apache.pekko.http.javadsl.server.directives.CodingDirectives
org.apache.pekko.http.javadsl.server.directives.CookieDirectives
org.apache.pekko.http.javadsl.server.directives.DebuggingDirectives
org.apache.pekko.http.javadsl.server.directives.ExecutionDirectives
org.apache.pekko.http.javadsl.server.directives.FileAndResourceDirectives
org.apache.pekko.http.javadsl.server.directives.FileUploadDirectives
org.apache.pekko.http.javadsl.server.directives.FormFieldDirectives
org.apache.pekko.http.javadsl.server.directives.FutureDirectives
org.apache.pekko.http.javadsl.server.directives.HeaderDirectives
org.apache.pekko.http.javadsl.server.directives.AttributeDirectives
org.apache.pekko.http.javadsl.server.directives.HostDirectives
org.apache.pekko.http.javadsl.server.directives.MarshallingDirectives
org.apache.pekko.http.javadsl.server.directives.MethodDirectives
org.apache.pekko.http.javadsl.server.directives.MiscDirectives
org.apache.pekko.http.javadsl.server.directives.ParameterDirectives
org.apache.pekko.http.javadsl.server.directives.PathDirectives
org.apache.pekko.http.javadsl.server.directives.RangeDirectives
org.apache.pekko.http.javadsl.server.directives.RespondWithDirectives
org.apache.pekko.http.javadsl.server.directives.RouteDirectives
org.apache.pekko.http.javadsl.server.directives.SchemeDirectives
org.apache.pekko.http.javadsl.server.directives.SecurityDirectives
org.apache.pekko.http.javadsl.server.directives.WebSocketDirectives
- Direct Known Subclasses:
TimeoutDirectives
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.pekko.http.javadsl.server.directives.SecurityDirectives
SecurityDirectives.ProvidedCredentials, SecurityDirectives.ProvidedCredentials$ -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextractOfferedWsProtocols(Function<List<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.Extract the WebSocketUpgrade attribute if this is a WebSocket request.<T> RoutehandleWebSocketMessages(org.apache.pekko.stream.javadsl.Flow<Message, Message, T> handler) Handles WebSocket requests with the given handler and rejects other requests with anExpectedWebSocketRequestRejection.<T> RoutehandleWebSocketMessagesForOptionalProtocol(org.apache.pekko.stream.javadsl.Flow<Message, Message, T> handler, Optional<String> subprotocol) Handles WebSocket requests with the given handler and rejects other requests with anExpectedWebSocketRequestRejection.<T> RoutehandleWebSocketMessagesForProtocol(org.apache.pekko.stream.javadsl.Flow<Message, Message, T> handler, String subprotocol) Handles WebSocket requests with the given handler if the given subprotocol is offered in the request and rejects other requests with anExpectedWebSocketRequestRejectionor anUnsupportedWebSocketSubprotocolRejection.Methods inherited from class org.apache.pekko.http.javadsl.server.directives.SecurityDirectives
authenticateBasic, authenticateBasicAsync, authenticateBasicAsyncOptional, authenticateBasicOptional, authenticateBasicPF, authenticateBasicPFAsync, authenticateOAuth2, authenticateOAuth2Async, authenticateOAuth2AsyncOptional, authenticateOAuth2Optional, authenticateOrRejectWithChallenge, authenticateOrRejectWithChallenge, authorize, authorizeAsync, authorizeAsyncWithRequestContext, authorizeWithRequestContext, extractCredentialsMethods inherited from class org.apache.pekko.http.javadsl.server.directives.SchemeDirectives
extractScheme, schemeMethods inherited from class org.apache.pekko.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, routeMethods inherited from class org.apache.pekko.http.javadsl.server.directives.RespondWithDirectives
respondWithDefaultHeader, respondWithDefaultHeaders, respondWithHeader, respondWithHeadersMethods inherited from class org.apache.pekko.http.javadsl.server.directives.RangeDirectives
withRangeSupportMethods inherited from class org.apache.pekko.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, redirectToTrailingSlashIfMissingMethods inherited from class org.apache.pekko.http.javadsl.server.directives.ParameterDirectives
parameter, parameter, parameterList, parameterList, parameterList, parameterMap, parameterMultiMap, parameterOptional, parameterOptional, parameterOrDefault, parameterRequiredValueMethods inherited from class org.apache.pekko.http.javadsl.server.directives.MiscDirectives
extractClientIP, rejectEmptyResponse, requestEntityEmpty, requestEntityPresent, selectPreferredLanguage, validate, withoutSizeLimit, withSizeLimitMethods inherited from class org.apache.pekko.http.javadsl.server.directives.MethodDirectives
delete, extractMethod, get, head, method, options, overrideMethodWithParameter, patch, post, putMethods inherited from class org.apache.pekko.http.javadsl.server.directives.MarshallingDirectives
completeWith, entity, handleWith, requestMethods inherited from class org.apache.pekko.http.javadsl.server.directives.HostDirectives
extractHost, host, host, host, hostMethods inherited from class org.apache.pekko.http.javadsl.server.directives.AttributeDirectives
attribute, optionalAttributeMethods inherited from class org.apache.pekko.http.javadsl.server.directives.HeaderDirectives
checkSameOrigin, headerValue, headerValueByName, headerValueByType, headerValuePF, optionalHeaderValue, optionalHeaderValueByName, optionalHeaderValueByType, optionalHeaderValuePFMethods inherited from class org.apache.pekko.http.javadsl.server.directives.FutureDirectives
completeOrRecoverWith, onComplete, onComplete, onCompleteWithBreaker, onSuccess, onSuccessMethods inherited from class org.apache.pekko.http.javadsl.server.directives.FormFieldDirectives
formField, formField, formFieldList, formFieldList, formFieldList, formFieldMap, formFieldMultiMap, formFieldOptional, formFieldOptionalMethods inherited from class org.apache.pekko.http.javadsl.server.directives.FileUploadDirectives
fileUpload, fileUploadAll, storeUploadedFile, storeUploadedFilesMethods inherited from class org.apache.pekko.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, listDirectoryContentsMethods inherited from class org.apache.pekko.http.javadsl.server.directives.ExecutionDirectives
handleExceptions, handleRejectionsMethods inherited from class org.apache.pekko.http.javadsl.server.directives.DebuggingDirectives
logRequest, logRequest, logRequest, logRequestResult, logRequestResultOptional, logResult, logResult, logResultMethods inherited from class org.apache.pekko.http.javadsl.server.directives.CookieDirectives
cookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, optionalCookie, setCookie, setCookieMethods inherited from class org.apache.pekko.http.javadsl.server.directives.CodingDirectives
decodeRequest, decodeRequestWith, decodeRequestWith, encodeResponse, encodeResponseWith, requestEncodedWith, responseEncodingAccepted, withPrecompressedMediaTypeSupportMethods inherited from class org.apache.pekko.http.javadsl.server.directives.CacheConditionDirectives
conditional, conditional, conditional, conditionalMethods inherited from class org.apache.pekko.http.javadsl.server.directives.BasicDirectives
cancelRejection, cancelRejections, cancelRejections, extract, extractActorSystem, extractDataBytes, extractEntity, extractExecutionContext, extractLog, extractMatchedPath, extractMaterializer, extractParserSettings, extractRequest, extractRequestContext, extractRequestEntity, extractSettings, extractStrictEntity, extractStrictEntity, extractStrictEntity, extractStrictEntity, extractUnmatchedPath, extractUri, mapInnerRoute, mapRejections, mapRequest, mapRequestContext, mapResponse, mapResponseEntity, mapResponseHeaders, mapRouteResult, mapRouteResultFuture, mapRouteResultPF, mapRouteResultWith, mapRouteResultWithPF, mapSettings, mapUnmatchedPath, pass, provide, recoverRejections, recoverRejectionsWith, toStrictEntity, toStrictEntity, toStrictEntity, toStrictEntity, withExecutionContext, withLog, withMaterializer, withSettings
-
Constructor Details
-
WebSocketDirectives
public WebSocketDirectives()
-
-
Method Details
-
extractOfferedWsProtocols
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)
-
extractWebSocketUpgrade
Extract the WebSocketUpgrade attribute if this is a WebSocket request. Rejects with anExpectedWebSocketRequestRejection, otherwise.- Parameters:
inner- (undocumented)- Returns:
- (undocumented)
-
handleWebSocketMessages
public <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 anExpectedWebSocketRequestRejection.- Parameters:
handler- (undocumented)- Returns:
- (undocumented)
-
handleWebSocketMessagesForOptionalProtocol
public <T> Route handleWebSocketMessagesForOptionalProtocol(org.apache.pekko.stream.javadsl.Flow<Message, Message, T> handler, Optional<String> subprotocol) Handles WebSocket requests with the given handler and rejects other requests with anExpectedWebSocketRequestRejection.If the
subprotocolparameter is None any WebSocket request is accepted. If thesubprotocolparameter 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 anUnsupportedWebSocketSubprotocolRejectionrejection.To support several subprotocols you may chain several
handleWebSocketMessagesForOptionalProtocolroutes.- Parameters:
handler- (undocumented)subprotocol- (undocumented)- Returns:
- (undocumented)
-
handleWebSocketMessagesForProtocol
public <T> Route handleWebSocketMessagesForProtocol(org.apache.pekko.stream.javadsl.Flow<Message, Message, T> handler, String subprotocol) Handles WebSocket requests with the given handler if the given subprotocol is offered in the request and rejects other requests with anExpectedWebSocketRequestRejectionor anUnsupportedWebSocketSubprotocolRejection.- Parameters:
handler- (undocumented)subprotocol- (undocumented)- Returns:
- (undocumented)
-