Class HeaderDirectives
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
- Direct Known Subclasses:
AttributeDirectives
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheckSameOrigin
(HttpOriginRange allowed, Supplier<Route> inner) Checks that request comes from the same origin.<T> RouteAdapter
headerValue
(Function<HttpHeader, Optional<T>> f, Function<T, Route> inner) Extracts an HTTP header value using the given function.headerValueByName
(String headerName, Function<String, Route> inner) Extracts the value of the first HTTP request header with the given name.<T extends HttpHeader>
RouteAdapterheaderValueByType
(Class<T> t, Function<T, Route> inner) Extracts the first HTTP request header of the given type.<T> RouteAdapter
headerValuePF
(scala.PartialFunction<HttpHeader, T> pf, Function<T, Route> inner) Extracts an HTTP header value using the given partial function.<T> RouteAdapter
optionalHeaderValue
(Function<HttpHeader, Optional<T>> f, Function<Optional<T>, Route> inner) Extracts an optional HTTP header value using the given function.Extracts the value of the optional HTTP request header with the given name.<T extends HttpHeader>
RouteAdapteroptionalHeaderValueByType
(Class<T> t, Function<Optional<T>, Route> inner) FIXME: WARNING: Custom headers don't work yet with this directive!<T> RouteAdapter
optionalHeaderValuePF
(scala.PartialFunction<HttpHeader, T> pf, Function<Optional<T>, Route> inner) Extracts an optional HTTP header value using the given partial function.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
-
Constructor Details
-
HeaderDirectives
public HeaderDirectives()
-
-
Method Details
-
checkSameOrigin
Checks that request comes from the same origin. Extracts theOrigin
header value and verifies that allowed range contains the obtained value. In the case of absent of theOrigin
header rejects withMissingHeaderRejection
. If the origin value is not in the allowed range rejects with anInvalidOriginRejection
andStatusCodes.FORBIDDEN
status.- Parameters:
allowed
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-
headerValue
Extracts an HTTP header value using the given function. If the function result is undefined for all headers the request is rejected with an empty rejection set. If the given function throws an exception the request is rejected with aMalformedHeaderRejection
.- Parameters:
f
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-
headerValueByName
Extracts the value of the first HTTP request header with the given name. If no header with a matching name is found the request is rejected with aMissingHeaderRejection
.- Parameters:
headerName
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-
headerValueByType
Extracts the first HTTP request header of the given type. If no header with a matching type is found the request is rejected with aMissingHeaderRejection
.- Parameters:
t
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-
headerValuePF
public <T> RouteAdapter headerValuePF(scala.PartialFunction<HttpHeader, T> pf, Function<T, Route> inner) Extracts an HTTP header value using the given partial function. If the function is undefined for all headers the request is rejected with an empty rejection set.- Parameters:
pf
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-
optionalHeaderValue
public <T> RouteAdapter optionalHeaderValue(Function<HttpHeader, Optional<T>> f, Function<Optional<T>, Route> inner) Extracts an optional HTTP header value using the given function. If the given function throws an exception the request is rejected with aMalformedHeaderRejection
.- Parameters:
f
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-
optionalHeaderValueByName
public RouteAdapter optionalHeaderValueByName(String headerName, Function<Optional<String>, Route> inner) Extracts the value of the optional HTTP request header with the given name.- Parameters:
headerName
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-
optionalHeaderValueByType
public <T extends HttpHeader> RouteAdapter optionalHeaderValueByType(Class<T> t, Function<Optional<T>, Route> inner) FIXME: WARNING: Custom headers don't work yet with this directive!Extract the header value of the optional HTTP request header with the given type.
- Parameters:
t
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-
optionalHeaderValuePF
public <T> RouteAdapter optionalHeaderValuePF(scala.PartialFunction<HttpHeader, T> pf, Function<Optional<T>, Route> inner) Extracts an optional HTTP header value using the given partial function. If the given function throws an exception the request is rejected with aMalformedHeaderRejection
.- Parameters:
pf
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-