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.remoteAddressattribute (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 aRequestEntityExpectedRejectionif the request entity is empty.Inspects the request'sAccept-Languageheader 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-lengthby default) checking on the incomingpekko.http.javadsl.model.HttpRequestentity.withSizeLimit(long maxBytes, Supplier<Route> inner) Fails the stream withpekko.http.scaladsl.model.EntityStreamSizeExceptionif 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, putMethods inherited from class org.apache.pekko.http.javadsl.server.directives.MarshallingDirectives
completeWith, entity, handleWith, requestMethods inherited from class org.apache.pekko.http.javadsl.server.directives.HostDirectives
extractHost, host, host, host, hostMethods inherited from class org.apache.pekko.http.javadsl.server.directives.AttributeDirectives
attribute, optionalAttributeMethods inherited from class org.apache.pekko.http.javadsl.server.directives.HeaderDirectives
checkSameOrigin, headerValue, headerValueByName, headerValueByType, headerValuePF, optionalHeaderValue, optionalHeaderValueByName, optionalHeaderValueByType, optionalHeaderValuePFMethods inherited from class org.apache.pekko.http.javadsl.server.directives.FutureDirectives
completeOrRecoverWith, onComplete, onComplete, onCompleteWithBreaker, onSuccess, onSuccessMethods inherited from class org.apache.pekko.http.javadsl.server.directives.FormFieldDirectives
formField, formField, formFieldList, formFieldList, formFieldList, formFieldMap, formFieldMultiMap, formFieldOptional, formFieldOptionalMethods inherited from class org.apache.pekko.http.javadsl.server.directives.FileUploadDirectives
fileUpload, fileUploadAll, storeUploadedFile, storeUploadedFilesMethods 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, listDirectoryContentsMethods inherited from class org.apache.pekko.http.javadsl.server.directives.ExecutionDirectives
handleExceptions, handleRejectionsMethods inherited from class org.apache.pekko.http.javadsl.server.directives.DebuggingDirectives
logRequest, logRequest, logRequest, logRequestResult, logRequestResultOptional, logResult, logResult, logResultMethods inherited from class org.apache.pekko.http.javadsl.server.directives.CookieDirectives
cookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, optionalCookie, setCookie, setCookieMethods inherited from class org.apache.pekko.http.javadsl.server.directives.CodingDirectives
decodeRequest, decodeRequestWith, decodeRequestWith, encodeResponse, encodeResponseWith, requestEncodedWith, responseEncodingAccepted, withPrecompressedMediaTypeSupportMethods inherited from class org.apache.pekko.http.javadsl.server.directives.CacheConditionDirectives
conditional, conditional, conditional, conditionalMethods 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.remoteAddressattribute (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 aRequestEntityExpectedRejectionif 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-Languageheader 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.EntityStreamSizeExceptionif 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-lengthby default) checking on the incomingpekko.http.javadsl.model.HttpRequestentity. Can be useful when handling arbitrarily large data uploads in specific parts of your routes.- Parameters:
inner- (undocumented)- Returns:
- (undocumented)
-