Class HeaderDirectives
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
- Direct Known Subclasses:
- AttributeDirectives
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptioncheckSameOrigin(HttpOriginRange allowed, Supplier<Route> inner) Checks that request comes from the same origin.<T> RouteAdapterheaderValue(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> RouteAdapterheaderValuePF(scala.PartialFunction<HttpHeader, T> pf, Function<T, Route> inner) Extracts an HTTP header value using the given partial function.<T> RouteAdapteroptionalHeaderValue(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> RouteAdapteroptionalHeaderValuePF(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 org.apache.pekko.http.javadsl.server.directives.FutureDirectivescompleteOrRecoverWith, onComplete, onComplete, onCompleteWithBreaker, onSuccess, onSuccessMethods inherited from class org.apache.pekko.http.javadsl.server.directives.FormFieldDirectivesformField, formField, formFieldList, formFieldList, formFieldList, formFieldMap, formFieldMultiMap, formFieldOptional, formFieldOptionalMethods inherited from class org.apache.pekko.http.javadsl.server.directives.FileUploadDirectivesfileUpload, fileUploadAll, storeUploadedFile, storeUploadedFilesMethods inherited from class org.apache.pekko.http.javadsl.server.directives.FileAndResourceDirectivesdefaultContentTypeResolver, 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.ExecutionDirectiveshandleExceptions, handleRejectionsMethods inherited from class org.apache.pekko.http.javadsl.server.directives.DebuggingDirectiveslogRequest, logRequest, logRequest, logRequestResult, logRequestResultOptional, logResult, logResult, logResultMethods inherited from class org.apache.pekko.http.javadsl.server.directives.CookieDirectivescookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, optionalCookie, setCookie, setCookieMethods inherited from class org.apache.pekko.http.javadsl.server.directives.CodingDirectivesdecodeRequest, decodeRequestWith, decodeRequestWith, encodeResponse, encodeResponseWith, requestEncodedWith, responseEncodingAccepted, withPrecompressedMediaTypeSupportMethods inherited from class org.apache.pekko.http.javadsl.server.directives.CacheConditionDirectivesconditional, conditional, conditional, conditionalMethods inherited from class org.apache.pekko.http.javadsl.server.directives.BasicDirectivescancelRejection, 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- 
HeaderDirectivespublic HeaderDirectives()
 
- 
- 
Method Details- 
checkSameOriginChecks that request comes from the same origin. Extracts theOriginheader value and verifies that allowed range contains the obtained value. In the case of absent of theOriginheader rejects withMissingHeaderRejection. If the origin value is not in the allowed range rejects with anInvalidOriginRejectionandStatusCodes.FORBIDDENstatus.- Parameters:
- allowed- (undocumented)
- inner- (undocumented)
- Returns:
- (undocumented)
 
- 
headerValueExtracts 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 apekko.http.javadsl.server.MalformedHeaderRejection.- Parameters:
- f- (undocumented)
- inner- (undocumented)
- Returns:
- (undocumented)
 
- 
headerValueByNameExtracts 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 apekko.http.javadsl.server.MissingHeaderRejection.- Parameters:
- headerName- (undocumented)
- inner- (undocumented)
- Returns:
- (undocumented)
 
- 
headerValueByTypeExtracts the first HTTP request header of the given type. If no header with a matching type is found the request is rejected with apekko.http.javadsl.server.MissingHeaderRejection.- Parameters:
- t- (undocumented)
- inner- (undocumented)
- Returns:
- (undocumented)
 
- 
headerValuePFpublic <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)
 
- 
optionalHeaderValuepublic <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 apekko.http.javadsl.server.MalformedHeaderRejection.- Parameters:
- f- (undocumented)
- inner- (undocumented)
- Returns:
- (undocumented)
 
- 
optionalHeaderValueByNamepublic 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)
 
- 
optionalHeaderValueByTypepublic <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)
 
- 
optionalHeaderValuePFpublic <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 apekko.http.javadsl.server.MalformedHeaderRejection.- Parameters:
- pf- (undocumented)
- inner- (undocumented)
- Returns:
- (undocumented)
 
 
-