public abstract class MiscDirectives extends MethodDirectives
Constructor and Description |
---|
MiscDirectives() |
Modifier and Type | Method and 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
or
pekko.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 a
RequestEntityExpectedRejection if the request entity is empty. |
Route |
selectPreferredLanguage(java.lang.Iterable<Language> languages,
java.util.function.Function<Language,Route> inner)
Inspects the request's
Accept-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 by
pekko.http.parsing.max-content-length by default) checking on the incoming
pekko.http.javadsl.model.HttpRequest entity. |
Route |
withSizeLimit(long maxBytes,
java.util.function.Supplier<Route> inner)
Fails the stream with
pekko.http.scaladsl.model.EntityStreamSizeException if its request entity size exceeds
given limit. |
delete, extractMethod, get, head, method, options, overrideMethodWithParameter, patch, post, put
completeWith, entity, handleWith, request
extractHost, host, host, host, host
attribute, optionalAttribute
checkSameOrigin, headerValue, headerValueByName, headerValueByType, headerValuePF, optionalHeaderValue, optionalHeaderValueByName, optionalHeaderValueByType, optionalHeaderValuePF
completeOrRecoverWith, onComplete, onComplete, onCompleteWithBreaker, onSuccess, onSuccess
formField, formField, formFieldList, formFieldList, formFieldList, formFieldMap, formFieldMultiMap, formFieldOptional, formFieldOptional
fileUpload, fileUploadAll, storeUploadedFile, storeUploadedFiles
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
handleExceptions, handleRejections
logRequest, logRequest, logRequest, logRequestResult, logRequestResultOptional, logResult, logResult, logResult
cookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, optionalCookie, setCookie, setCookie
decodeRequest, decodeRequestWith, decodeRequestWith, encodeResponse, encodeResponseWith, requestEncodedWith, responseEncodingAccepted, withPrecompressedMediaTypeSupport
conditional, conditional, conditional, conditional
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
public Route extractClientIP(java.util.function.Function<RemoteAddress,Route> inner)
pekko.http.javadsl.model.AttributeKeys.remoteAddress
attribute
(in that order of priority).inner
- (undocumented)public Route rejectEmptyResponse(java.util.function.Supplier<Route> inner)
inner
- (undocumented)public Route requestEntityEmpty(java.util.function.Supplier<Route> inner)
inner
- (undocumented)public Route requestEntityPresent(java.util.function.Supplier<Route> inner)
RequestEntityExpectedRejection
if the request entity is empty.
Non-empty requests are passed on unchanged to the inner route.inner
- (undocumented)public Route selectPreferredLanguage(java.lang.Iterable<Language> languages, java.util.function.Function<Language,Route> inner)
Accept-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.
languages
- (undocumented)inner
- (undocumented)public Route validate(java.util.function.BooleanSupplier check, java.lang.String errorMsg, java.util.function.Supplier<Route> inner)
ValidationRejection
.check
- (undocumented)errorMsg
- (undocumented)inner
- (undocumented)public Route withSizeLimit(long maxBytes, java.util.function.Supplier<Route> inner)
pekko.http.scaladsl.model.EntityStreamSizeException
if its request entity size exceeds
given limit. Limit given as parameter overrides limit configured with
pekko.http.parsing.max-content-length
.
Beware that request entity size check is executed when entity is consumed.
maxBytes
- (undocumented)inner
- (undocumented)public Route withoutSizeLimit(java.util.function.Supplier<Route> inner)
pekko.http.parsing.max-content-length
by default) checking on the incoming
pekko.http.javadsl.model.HttpRequest
entity.
Can be useful when handling arbitrarily large data uploads in specific parts of your routes.
inner
- (undocumented)