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 SummaryConstructors
- 
Method SummaryModifier 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.MethodDirectivesdelete, extractMethod, get, head, method, options, overrideMethodWithParameter, patch, post, putMethods inherited from class org.apache.pekko.http.javadsl.server.directives.MarshallingDirectivescompleteWith, entity, handleWith, requestMethods inherited from class org.apache.pekko.http.javadsl.server.directives.HostDirectivesextractHost, host, host, host, hostMethods inherited from class org.apache.pekko.http.javadsl.server.directives.AttributeDirectivesattribute, optionalAttributeMethods inherited from class org.apache.pekko.http.javadsl.server.directives.HeaderDirectivescheckSameOrigin, headerValue, headerValueByName, headerValueByType, headerValuePF, optionalHeaderValue, optionalHeaderValueByName, optionalHeaderValueByType, optionalHeaderValuePFMethods 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- 
MiscDirectivespublic MiscDirectives()
 
- 
- 
Method Details- 
extractClientIPExtracts 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)
 
- 
rejectEmptyResponseConverts 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)
 
- 
requestEntityEmptyRejects if the request entity is non-empty.- Parameters:
- inner- (undocumented)
- Returns:
- (undocumented)
 
- 
requestEntityPresentRejects with aRequestEntityExpectedRejectionif the request entity is empty. Non-empty requests are passed on unchanged to the inner route.- Parameters:
- inner- (undocumented)
- Returns:
- (undocumented)
 
- 
selectPreferredLanguageInspects 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)
 
- 
validateChecks 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)
 
- 
withSizeLimitFails 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)
 
- 
withoutSizeLimitDisables 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)
 
 
-