Class MiscDirectives
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
- Direct Known Subclasses:
ParameterDirectives
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextractClientIP
(Function<RemoteAddress, Route> inner) Extracts the client's IP from either the X-Forwarded-For, Remote-Address, X-Real-IP header orpekko.http.javadsl.model.AttributeKeys.remoteAddress
attribute (in that order of priority).rejectEmptyResponse
(Supplier<Route> inner) Converts responses with an empty entity into (empty) rejections.requestEntityEmpty
(Supplier<Route> inner) Rejects if the request entity is non-empty.requestEntityPresent
(Supplier<Route> inner) Rejects with aRequestEntityExpectedRejection
if the request entity is empty.Inspects the request'sAccept-Language
header and determines, which of the given language alternatives is preferred by the client.validate
(BooleanSupplier check, String errorMsg, Supplier<Route> inner) Checks the given condition before running its inner route.withoutSizeLimit
(Supplier<Route> inner) Disables the size limit (configured bypekko.http.parsing.max-content-length
by default) checking on the incomingpekko.http.javadsl.model.HttpRequest
entity.withSizeLimit
(long maxBytes, Supplier<Route> inner) Fails the stream withpekko.http.scaladsl.model.EntityStreamSizeException
if its request entity size exceeds given limit.Methods inherited from class org.apache.pekko.http.javadsl.server.directives.MethodDirectives
delete, extractMethod, get, head, method, options, overrideMethodWithParameter, patch, post, put
Methods inherited from class org.apache.pekko.http.javadsl.server.directives.MarshallingDirectives
completeWith, entity, handleWith, request
Methods inherited from class org.apache.pekko.http.javadsl.server.directives.HostDirectives
extractHost, host, host, host, host
Methods inherited from class org.apache.pekko.http.javadsl.server.directives.AttributeDirectives
attribute, optionalAttribute
Methods inherited from class org.apache.pekko.http.javadsl.server.directives.HeaderDirectives
checkSameOrigin, headerValue, headerValueByName, headerValueByType, headerValuePF, optionalHeaderValue, optionalHeaderValueByName, optionalHeaderValueByType, optionalHeaderValuePF
Methods inherited from class org.apache.pekko.http.javadsl.server.directives.FutureDirectives
completeOrRecoverWith, onComplete, onComplete, onCompleteWithBreaker, onSuccess, onSuccess
Methods inherited from class org.apache.pekko.http.javadsl.server.directives.FormFieldDirectives
formField, formField, formFieldList, formFieldList, formFieldList, formFieldMap, formFieldMultiMap, formFieldOptional, formFieldOptional
Methods inherited from class org.apache.pekko.http.javadsl.server.directives.FileUploadDirectives
fileUpload, fileUploadAll, storeUploadedFile, storeUploadedFiles
Methods 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, listDirectoryContents
Methods inherited from class org.apache.pekko.http.javadsl.server.directives.ExecutionDirectives
handleExceptions, handleRejections
Methods inherited from class org.apache.pekko.http.javadsl.server.directives.DebuggingDirectives
logRequest, logRequest, logRequest, logRequestResult, logRequestResultOptional, logResult, logResult, logResult
Methods inherited from class org.apache.pekko.http.javadsl.server.directives.CookieDirectives
cookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, optionalCookie, setCookie, setCookie
Methods inherited from class org.apache.pekko.http.javadsl.server.directives.CodingDirectives
decodeRequest, decodeRequestWith, decodeRequestWith, encodeResponse, encodeResponseWith, requestEncodedWith, responseEncodingAccepted, withPrecompressedMediaTypeSupport
Methods inherited from class org.apache.pekko.http.javadsl.server.directives.CacheConditionDirectives
conditional, conditional, conditional, conditional
Methods 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
-
MiscDirectives
public MiscDirectives()
-
-
Method Details
-
extractClientIP
Extracts the client's IP from either the X-Forwarded-For, Remote-Address, X-Real-IP header orpekko.http.javadsl.model.AttributeKeys.remoteAddress
attribute (in that order of priority).- Parameters:
inner
- (undocumented)- Returns:
- (undocumented)
-
rejectEmptyResponse
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
Rejects if the request entity is non-empty.- Parameters:
inner
- (undocumented)- Returns:
- (undocumented)
-
requestEntityPresent
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
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
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
Fails the stream withpekko.http.scaladsl.model.EntityStreamSizeException
if its request entity size exceeds given limit. Limit given as parameter overrides limit configured withpekko.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
Disables the size limit (configured bypekko.http.parsing.max-content-length
by default) checking on the incomingpekko.http.javadsl.model.HttpRequest
entity. Can be useful when handling arbitrarily large data uploads in specific parts of your routes.- Parameters:
inner
- (undocumented)- Returns:
- (undocumented)
-