Class Directives$
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
org.apache.pekko.http.javadsl.server.directives.TimeoutDirectives
org.apache.pekko.http.javadsl.server.directives.FramedEntityStreamingDirectives
org.apache.pekko.http.javadsl.server.AllDirectives
org.apache.pekko.http.javadsl.server.Directives$
Collects all default directives into one class for simple importing of static functions.
See pekko.http.scaladsl.server.Directives for ScalaDSL equivalent of this class.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.pekko.http.javadsl.server.directives.SecurityDirectives
SecurityDirectives.ProvidedCredentials, SecurityDirectives.ProvidedCredentials$ -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Directives$Static reference to the singleton instance of this Scala object. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<A,B> Route allOf(Function<Function<A, Route>, Route> first, Function<Function<B, Route>, Route> second, BiFunction<A, B, Route> inner) Nests two 1-argument directives together Usage example:allOf(this::extractScheme, this::extractMethod, (scheme, method) -> complete("You did a " + method.name() + " using " + scheme))<A> RouteallOf(Function<Supplier<Route>, Route> first, Function<Function<A, Route>, Route> second, Function<A, Route> inner) Nests one 0-argument and 1-argument directives together Usage example:allOf(bindParameter(this::pathPrefix, "guess"), this::extractMethod, method -> complete("You did a " + method.name()))allOf(Function<Supplier<Route>, Route> first, Function<Supplier<Route>, Route> second, Supplier<Route> inner) Nests two 0-argument directives together Usage example:allOf(bindParameter(this::pathPrefix, "alice"), bindParameter(this::path, "bob"), () -> complete("Charlie!"))<A> RouteanyOf(Function<Function<A, Route>, Route> first, Function<Function<A, Route>, Route> second, Function<A, Route> inner) Composes two 1-argument directives (directives whose inner route takes a parameter) which share the same inner route.anyOf(Function<Supplier<Route>, Route> first, Function<Supplier<Route>, Route> second, Supplier<Route> inner) Composes two 0-argument directives which share the same inner Route.getFromBrowseableDirectories(String... directories) getFromBrowseableDirectories(scala.collection.immutable.Seq<String> directories) Deprecated.Methods inherited from class org.apache.pekko.http.javadsl.server.directives.FramedEntityStreamingDirectives
attribute, authenticateBasic, authenticateBasicAsync, authenticateBasicAsyncOptional, authenticateBasicOptional, authenticateBasicPF, authenticateBasicPFAsync, authenticateOAuth2, authenticateOAuth2Async, authenticateOAuth2AsyncOptional, authenticateOAuth2Optional, authenticateOrRejectWithChallenge, authenticateOrRejectWithChallenge, authorize, authorizeAsync, authorizeAsyncWithRequestContext, authorizeWithRequestContext, cancelRejection, cancelRejections, cancelRejections, checkSameOrigin, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, completeOK, completeOKWithFuture, completeOKWithFuture, completeOKWithFuture, completeOKWithFutureString, completeOKWithFutureString, completeOKWithSource, completeOrRecoverWith, completeWith, completeWithFuture, completeWithFuture, completeWithFuture, completeWithFutureResponse, completeWithFutureStatus, completeWithFutureStatus, completeWithSource, concat, concat, conditional, conditional, conditional, conditional, cookie, decodeRequest, decodeRequestWith, decodeRequestWith, defaultContentTypeResolver, defaultDirectoryRenderer, delete, deleteCookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, encodeResponse, encodeResponseWith, entity, entityAsSourceOf, extract, extractActorSystem, extractClientIP, extractCredentials, extractDataBytes, extractEntity, extractExecutionContext, extractHost, extractLog, extractMatchedPath, extractMaterializer, extractMethod, extractOfferedWsProtocols, extractParserSettings, extractRequest, extractRequestContext, extractRequestEntity, extractRequestTimeout, extractScheme, extractSettings, extractStrictEntity, extractStrictEntity, extractStrictEntity, extractStrictEntity, extractUnmatchedPath, extractUri, extractWebSocketUpgrade, failWith, fileUpload, fileUploadAll, formField, formField, formFieldList, formFieldList, formFieldList, formFieldMap, formFieldMultiMap, formFieldOptional, formFieldOptional, get, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectory, getFromBrowseableDirectory, getFromBrowseableDirectory, getFromBrowseableDirectory, getFromDirectory, getFromDirectory, getFromFile, getFromFile, getFromFile, getFromFile, getFromFile, getFromResource, getFromResource, getFromResource, getFromResource, getFromResourceDirectory, getFromResourceDirectory, getFromResourceDirectory, getFromResourceDirectory, handle, handleExceptions, handleRejections, handleSync, handleWebSocketMessages, handleWebSocketMessagesForOptionalProtocol, handleWebSocketMessagesForProtocol, handleWith, head, headerValue, headerValueByName, headerValueByType, headerValuePF, host, host, host, host, ignoreTrailingSlash, listDirectoryContents, listDirectoryContents, listDirectoryContents, listDirectoryContents, logRequest, logRequest, logRequest, logRequestResult, logRequestResultOptional, logResult, logResult, logResult, mapInnerRoute, mapRejections, mapRequest, mapRequestContext, mapResponse, mapResponseEntity, mapResponseHeaders, mapRouteResult, mapRouteResultFuture, mapRouteResultPF, mapRouteResultWith, mapRouteResultWithPF, mapSettings, mapUnmatchedPath, method, onComplete, onComplete, onCompleteWithBreaker, onSuccess, onSuccess, optionalAttribute, optionalCookie, optionalHeaderValue, optionalHeaderValueByName, optionalHeaderValueByType, optionalHeaderValuePF, options, overrideMethodWithParameter, parameter, parameter, parameterList, parameterList, parameterList, parameterMap, parameterMultiMap, parameterOptional, parameterOptional, parameterOrDefault, parameterRequiredValue, pass, patch, 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, post, provide, put, rawPathPrefix, rawPathPrefix, rawPathPrefix, rawPathPrefix, rawPathPrefixTest, rawPathPrefixTest, rawPathPrefixTest, rawPathPrefixTest, recoverRejections, recoverRejectionsWith, redirect, redirectToNoTrailingSlashIfPresent, redirectToTrailingSlashIfMissing, reject, reject, reject, rejectEmptyResponse, request, requestEncodedWith, requestEntityEmpty, requestEntityPresent, respondWithDefaultHeader, respondWithDefaultHeaders, respondWithHeader, respondWithHeaders, responseEncodingAccepted, scheme, selectPreferredLanguage, setCookie, setCookie, storeUploadedFile, storeUploadedFiles, toStrictEntity, toStrictEntity, toStrictEntity, toStrictEntity, validate, withExecutionContext, withLog, withMaterializer, withoutRequestTimeout, withoutSizeLimit, withPrecompressedMediaTypeSupport, withRangeSupport, withRequestTimeout, withRequestTimeout, withRequestTimeout, withRequestTimeout, withRequestTimeoutResponse, withSettings, withSizeLimitMethods inherited from class org.apache.pekko.http.javadsl.server.directives.TimeoutDirectives
extractRequestTimeout, withoutRequestTimeout, withRequestTimeout, withRequestTimeout, withRequestTimeout, withRequestTimeout, withRequestTimeoutResponseMethods inherited from class org.apache.pekko.http.javadsl.server.directives.WebSocketDirectives
extractOfferedWsProtocols, extractWebSocketUpgrade, handleWebSocketMessages, handleWebSocketMessagesForOptionalProtocol, handleWebSocketMessagesForProtocolMethods 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
-
Field Details
-
MODULE$
Static reference to the singleton instance of this Scala object.
-
-
Constructor Details
-
Directives$
public Directives$()
-
-
Method Details
-
route
- Overrides:
routein classFramedEntityStreamingDirectives
-
getFromBrowseableDirectories
- Overrides:
getFromBrowseableDirectoriesin classFramedEntityStreamingDirectives
-
route
Deprecated.- Overrides:
routein classFramedEntityStreamingDirectives
-
getFromBrowseableDirectories
- Overrides:
getFromBrowseableDirectoriesin classFramedEntityStreamingDirectives
-
anyOf
public Route anyOf(Function<Supplier<Route>, Route> first, Function<Supplier<Route>, Route> second, Supplier<Route> inner) Composes two 0-argument directives which share the same inner Route. This is equivalent tofirst(inner).orElse(second(inner))Usage example:anyOf(this::get, this::post, () -> complete("hi")))- Parameters:
first- the first 0-argument directivesecond- the second 0-argument directiveinner- the inner route Producer- Returns:
- the resulting route
-
anyOf
public <A> Route anyOf(Function<Function<A, Route>, Route> first, Function<Function<A, Route>, Route> second, Function<A, Route> inner) Composes two 1-argument directives (directives whose inner route takes a parameter) which share the same inner route. This is the same asfirst(inner).orElse(second(inner)). This can be used also for directives that take an additional parameter if the directive is partially applied, ie. parameter Usage example:anyOf(bindParameter(this::path, "bar"), bindParameter(this::path, "baz"), () -> complete("bar or baz"))- Parameters:
first- the first 1-argument directivesecond- the second 1-argument directiveinner- the inner route that takes one argument- Returns:
- the resulting route
-
allOf
public Route allOf(Function<Supplier<Route>, Route> first, Function<Supplier<Route>, Route> second, Supplier<Route> inner) Nests two 0-argument directives together Usage example:allOf(bindParameter(this::pathPrefix, "alice"), bindParameter(this::path, "bob"), () -> complete("Charlie!"))- Parameters:
first- the 0-argument directive (outer one)second- the 0-argument directive (inner one)inner- the inner route function- Returns:
- the resulting route
-
allOf
public <A,B> Route allOf(Function<Function<A, Route>, Route> first, Function<Function<B, Route>, Route> second, BiFunction<A, B, Route> inner) Nests two 1-argument directives together Usage example:allOf(this::extractScheme, this::extractMethod, (scheme, method) -> complete("You did a " + method.name() + " using " + scheme))- Parameters:
first- the first 1-argument directive (outer one)second- the second 1-argument directive (inner one)inner- the inner route function that takes 2 different parameters- Returns:
- the resulting route
-
allOf
public <A> Route allOf(Function<Supplier<Route>, Route> first, Function<Function<A, Route>, Route> second, Function<A, Route> inner) Nests one 0-argument and 1-argument directives together Usage example:allOf(bindParameter(this::pathPrefix, "guess"), this::extractMethod, method -> complete("You did a " + method.name()))- Parameters:
first- the 0-argument directive (outer one)second- the 1-argument directive (inner one)inner- the inner route function that takes 1 parameter- Returns:
- the resulting route
-