Class MiscDirectives
- 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
-
- Direct Known Subclasses:
ParameterDirectives
public abstract class MiscDirectives extends MethodDirectives
-
-
Constructor Summary
Constructors Constructor Description MiscDirectives()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Route
extractClientIP(java.util.function.Function<RemoteAddress,Route> inner)
Extracts the client's IP from either the X-Forwarded-For, Remote-Address, X-Real-IP header orakka.http.javadsl.model.AttributeKeys.remoteAddress
attribute (in that order of priority).Route
rejectEmptyResponse(java.util.function.Supplier<Route> inner)
Converts responses with an empty entity into (empty) rejections.Route
requestEntityEmpty(java.util.function.Supplier<Route> inner)
Rejects if the request entity is non-empty.Route
requestEntityPresent(java.util.function.Supplier<Route> inner)
Rejects with aRequestEntityExpectedRejection
if the request entity is empty.Route
selectPreferredLanguage(java.lang.Iterable<Language> languages, java.util.function.Function<Language,Route> inner)
Inspects the request'sAccept-Language
header and determines, which of the given language alternatives is preferred by the client.Route
validate(java.util.function.BooleanSupplier check, java.lang.String errorMsg, java.util.function.Supplier<Route> inner)
Checks the given condition before running its inner route.Route
withoutSizeLimit(java.util.function.Supplier<Route> inner)
Disables the size limit (configured byakka.http.parsing.max-content-length
by default) checking on the incomingHttpRequest
entity.Route
withSizeLimit(long maxBytes, java.util.function.Supplier<Route> inner)
Fails the stream withEntityStreamSizeException
if its request entity size exceeds given limit.-
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
-
extractClientIP
public Route extractClientIP(java.util.function.Function<RemoteAddress,Route> inner)
Extracts the client's IP from either the X-Forwarded-For, Remote-Address, X-Real-IP header orakka.http.javadsl.model.AttributeKeys.remoteAddress
attribute (in that order of priority).- Parameters:
inner
- (undocumented)- Returns:
- (undocumented)
-
rejectEmptyResponse
public Route rejectEmptyResponse(java.util.function.Supplier<Route> inner)
Converts responses with an empty entity into (empty) rejections. This way you can, for example, have the marshalling of a ''None'' option be treated as if the request could not be matched.- Parameters:
inner
- (undocumented)- Returns:
- (undocumented)
-
requestEntityEmpty
public Route requestEntityEmpty(java.util.function.Supplier<Route> inner)
Rejects if the request entity is non-empty.- Parameters:
inner
- (undocumented)- Returns:
- (undocumented)
-
requestEntityPresent
public Route requestEntityPresent(java.util.function.Supplier<Route> inner)
Rejects with aRequestEntityExpectedRejection
if the request entity is empty. Non-empty requests are passed on unchanged to the inner route.- Parameters:
inner
- (undocumented)- Returns:
- (undocumented)
-
selectPreferredLanguage
public Route selectPreferredLanguage(java.lang.Iterable<Language> languages, java.util.function.Function<Language,Route> inner)
Inspects the request'sAccept-Language
header and determines, which of the given language alternatives is preferred by the client. (See http://tools.ietf.org/html/rfc7231#section-5.3.5 for more details on the negotiation logic.) If there are several best language alternatives that the client has equal preference for (even if this preference is zero!) the order of the arguments is used as a tie breaker (First one wins).If [languages] is empty, the route is rejected.
- Parameters:
languages
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-
validate
public Route validate(java.util.function.BooleanSupplier check, java.lang.String errorMsg, java.util.function.Supplier<Route> inner)
Checks the given condition before running its inner route. If the condition fails the route is rejected with aValidationRejection
.- Parameters:
check
- (undocumented)errorMsg
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-
withSizeLimit
public Route withSizeLimit(long maxBytes, java.util.function.Supplier<Route> inner)
Fails the stream withEntityStreamSizeException
if its request entity size exceeds given limit. Limit given as parameter overrides limit configured withakka.http.parsing.max-content-length
.
Beware that request entity size check is executed when entity is consumed.
- Parameters:
maxBytes
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-
withoutSizeLimit
public Route withoutSizeLimit(java.util.function.Supplier<Route> inner)
Disables the size limit (configured byakka.http.parsing.max-content-length
by default) checking on the incomingHttpRequest
entity. Can be useful when handling arbitrarily large data uploads in specific parts of your routes.- Parameters:
inner
- (undocumented)- Returns:
- (undocumented)
-
-