Class RouteDirectives
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
org.apache.pekko.http.javadsl.server.directives.ParameterDirectives
org.apache.pekko.http.javadsl.server.directives.PathDirectives
org.apache.pekko.http.javadsl.server.directives.RangeDirectives
org.apache.pekko.http.javadsl.server.directives.RespondWithDirectives
org.apache.pekko.http.javadsl.server.directives.RouteDirectives
- Direct Known Subclasses:
- SchemeDirectives
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptioncomplete(Iterable<HttpHeader> headers, RequestEntity entity) Completes the request as HTTP 200 OK, adding the given headers and response entity.complete(Iterable<HttpHeader> headers, ResponseEntity entity) Completes the request as HTTP 200 OK, adding the given headers and response entity.<T> RouteAdaptercomplete(Iterable<HttpHeader> headers, T value, Marshaller<T, RequestEntity> marshaller) Completes the request as HTTP 200 OK, adding the given headers, and marshalling the given value as response entity.Completes the request using an HTTP 200 OK status code and the given body as UTF-8 entity.complete(HttpResponse response) Completes the request using the given http response.complete(RequestEntity entity) Completes the request as HTTP 200 OK with the given value as response entity.complete(ResponseEntity entity) Completes the request as HTTP 200 OK with the given value as response entity.complete(StatusCode status) Completes the request using the given status code.complete(StatusCode status, Iterable<HttpHeader> headers, RequestEntity entity) Completes the request using the given status code, headers, and response entity.complete(StatusCode status, Iterable<HttpHeader> headers, ResponseEntity entity) Completes the request using the given status code, headers, and response entity.<T> RouteAdaptercomplete(StatusCode status, Iterable<HttpHeader> headers, T value, Marshaller<T, RequestEntity> marshaller) Completes the request using the given status code and headers, marshalling the given value as response entity.complete(StatusCode status, String entity) Completes the request using the given status code and the given body as UTF-8.complete(StatusCode status, RequestEntity entity) Completes the request using the given status code and response entity.complete(StatusCode status, ResponseEntity entity) Completes the request using the given status code and response entity.<T> RouteAdaptercomplete(StatusCode status, T value, Marshaller<T, RequestEntity> marshaller) Completes the request using the given status code, marshalling the given value as response entity.<T> RouteAdaptercomplete(T value, Marshaller<T, HttpResponse> marshaller) Completes the request by marshalling the given value into an http response.<T> RouteAdaptercompleteOK(T value, Marshaller<T, RequestEntity> marshaller) Completes the request as HTTP 200 OK, marshalling the given value as response entity.Completes the request by marshalling the given future value into an http response.<T> RouteAdaptercompleteOKWithFuture(CompletionStage<T> value, Marshaller<T, RequestEntity> marshaller) Completes the request with anOKstatus code by marshalling the given value into an http response.<T> RouteAdaptercompleteOKWithFuture(scala.concurrent.Future<T> value, Marshaller<T, RequestEntity> marshaller) Completes the request by marshalling the given value into an http response.Completes the request by marshalling the given future value into an http response.completeOKWithFutureString(scala.concurrent.Future<String> value) Completes the request by marshalling the given future value into an http response.Completes the request by marshalling the given future value into an http response.<T> RouteAdaptercompleteWithFuture(CompletionStage<T> value, Marshaller<T, HttpResponse> marshaller) Completes the request by marshalling the given value into an http response.<T> RouteAdaptercompleteWithFuture(scala.concurrent.Future<T> value, Marshaller<T, HttpResponse> marshaller) Completes the request by marshalling the given value into an http response.completeWithFutureResponse(scala.concurrent.Future<HttpResponse> value) Completes the request by marshalling the given future value into an http response.Completes the request using the given future status code.completeWithFutureStatus(scala.concurrent.Future<StatusCode> status) Completes the request using the given future status code.Used to chain multiple alternate routes using comma, rather than having to explicitly call route1.orElse(route2).orElse(route3).Used to chain multiple alternate routes using comma, rather than having to explicitly call route1.orElse(route2).orElse(route3).Bubbles the given error up the response chain, where it is dealt with by the closesthandleExceptionsdirective and its ExceptionHandler.handle(org.apache.pekko.japi.function.Function<HttpRequest, CompletionStage<HttpResponse>> handler) Handle the request using a function.handleSync(org.apache.pekko.japi.function.Function<HttpRequest, HttpResponse> handler) Handle the request using a function.redirect(Uri uri, StatusCode redirectionType) Completes the request with redirection response of the given type to the given URI.reject()Rejects the request with an empty rejection (usually used for "no directive matched").Rejects the request with the given rejections, or with an empty set of rejections if no rejections are given.Rejects the request with the given rejections, or with an empty set of rejections if no rejections are given.Deprecated.Deprecated.Use theRouteDirectives.concatmethod instead.Methods inherited from class org.apache.pekko.http.javadsl.server.directives.RespondWithDirectivesrespondWithDefaultHeader, respondWithDefaultHeaders, respondWithHeader, respondWithHeadersMethods inherited from class org.apache.pekko.http.javadsl.server.directives.RangeDirectiveswithRangeSupportMethods inherited from class org.apache.pekko.http.javadsl.server.directives.PathDirectivesignoreTrailingSlash, path, path, path, path, path, path, pathEnd, pathEndOrSingleSlash, pathPrefix, pathPrefix, pathPrefix, pathPrefix, pathPrefix, pathPrefix, pathPrefixTest, pathPrefixTest, pathPrefixTest, pathPrefixTest, pathSingleSlash, pathSuffix, pathSuffix, pathSuffix, pathSuffix, pathSuffixTest, pathSuffixTest, pathSuffixTest, pathSuffixTest, rawPathPrefix, rawPathPrefix, rawPathPrefix, rawPathPrefix, rawPathPrefixTest, rawPathPrefixTest, rawPathPrefixTest, rawPathPrefixTest, redirectToNoTrailingSlashIfPresent, redirectToTrailingSlashIfMissingMethods inherited from class org.apache.pekko.http.javadsl.server.directives.ParameterDirectivesparameter, parameter, parameterList, parameterList, parameterList, parameterMap, parameterMultiMap, parameterOptional, parameterOptional, parameterOrDefault, parameterRequiredValueMethods inherited from class org.apache.pekko.http.javadsl.server.directives.MiscDirectivesextractClientIP, rejectEmptyResponse, requestEntityEmpty, requestEntityPresent, selectPreferredLanguage, validate, withoutSizeLimit, withSizeLimitMethods 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- 
RouteDirectivespublic RouteDirectives()
 
- 
- 
Method Details- 
completeCompletes the request using an HTTP 200 OK status code and the given body as UTF-8 entity.- Parameters:
- body- (undocumented)
- Returns:
- (undocumented)
 
- 
completeCompletes the request using the given http response.- Parameters:
- response- (undocumented)
- Returns:
- (undocumented)
 
- 
completeCompletes the request using the given status code.- Parameters:
- status- (undocumented)
- Returns:
- (undocumented)
 
- 
completeCompletes the request by marshalling the given value into an http response.- Parameters:
- value- (undocumented)
- marshaller- (undocumented)
- Returns:
- (undocumented)
 
- 
completepublic <T> RouteAdapter complete(StatusCode status, Iterable<HttpHeader> headers, T value, Marshaller<T, RequestEntity> marshaller) Completes the request using the given status code and headers, marshalling the given value as response entity.- Parameters:
- status- (undocumented)
- headers- (undocumented)
- value- (undocumented)
- marshaller- (undocumented)
- Returns:
- (undocumented)
 
- 
completepublic RouteAdapter complete(StatusCode status, Iterable<HttpHeader> headers, ResponseEntity entity) Completes the request using the given status code, headers, and response entity.- Parameters:
- status- (undocumented)
- headers- (undocumented)
- entity- (undocumented)
- Returns:
- (undocumented)
 
- 
completeCompletes the request using the given status code, headers, and response entity.- Parameters:
- status- (undocumented)
- headers- (undocumented)
- entity- (undocumented)
- Returns:
- (undocumented)
 
- 
completepublic <T> RouteAdapter complete(StatusCode status, T value, Marshaller<T, RequestEntity> marshaller) Completes the request using the given status code, marshalling the given value as response entity.- Parameters:
- status- (undocumented)
- value- (undocumented)
- marshaller- (undocumented)
- Returns:
- (undocumented)
 
- 
completeCompletes the request using the given status code and response entity.- Parameters:
- status- (undocumented)
- entity- (undocumented)
- Returns:
- (undocumented)
 
- 
completeCompletes the request using the given status code and response entity.- Parameters:
- status- (undocumented)
- entity- (undocumented)
- Returns:
- (undocumented)
 
- 
completeCompletes the request using the given status code and the given body as UTF-8.- Parameters:
- status- (undocumented)
- entity- (undocumented)
- Returns:
- (undocumented)
 
- 
completepublic <T> RouteAdapter complete(Iterable<HttpHeader> headers, T value, Marshaller<T, RequestEntity> marshaller) Completes the request as HTTP 200 OK, adding the given headers, and marshalling the given value as response entity.- Parameters:
- headers- (undocumented)
- value- (undocumented)
- marshaller- (undocumented)
- Returns:
- (undocumented)
 
- 
completeCompletes the request as HTTP 200 OK, adding the given headers and response entity.- Parameters:
- headers- (undocumented)
- entity- (undocumented)
- Returns:
- (undocumented)
 
- 
completeCompletes the request as HTTP 200 OK, adding the given headers and response entity.- Parameters:
- headers- (undocumented)
- entity- (undocumented)
- Returns:
- (undocumented)
 
- 
completeCompletes the request as HTTP 200 OK with the given value as response entity.- Parameters:
- entity- (undocumented)
- Returns:
- (undocumented)
 
- 
completeCompletes the request as HTTP 200 OK with the given value as response entity.- Parameters:
- entity- (undocumented)
- Returns:
- (undocumented)
 
- 
completeOKCompletes the request as HTTP 200 OK, marshalling the given value as response entity.- Parameters:
- value- (undocumented)
- marshaller- (undocumented)
- Returns:
- (undocumented)
 
- 
completeOKWithFuturepublic <T> RouteAdapter completeOKWithFuture(scala.concurrent.Future<T> value, Marshaller<T, RequestEntity> marshaller) Completes the request by marshalling the given value into an http response.- Parameters:
- value- (undocumented)
- marshaller- (undocumented)
- Returns:
- (undocumented)
 
- 
completeOKWithFutureCompletes the request by marshalling the given future value into an http response.- Parameters:
- value- (undocumented)
- Returns:
- (undocumented)
 
- 
completeOKWithFuturepublic <T> RouteAdapter completeOKWithFuture(CompletionStage<T> value, Marshaller<T, RequestEntity> marshaller) Completes the request with anOKstatus code by marshalling the given value into an http response.- Parameters:
- value- (undocumented)
- marshaller- (undocumented)
- Returns:
- (undocumented)
 
- 
completeOKWithFutureStringCompletes the request by marshalling the given future value into an http response.- Parameters:
- value- (undocumented)
- Returns:
- (undocumented)
 
- 
completeOKWithFutureStringCompletes the request by marshalling the given future value into an http response.- Parameters:
- value- (undocumented)
- Returns:
- (undocumented)
 
- 
completeWithFuturepublic <T> RouteAdapter completeWithFuture(scala.concurrent.Future<T> value, Marshaller<T, HttpResponse> marshaller) Completes the request by marshalling the given value into an http response.- Parameters:
- value- (undocumented)
- marshaller- (undocumented)
- Returns:
- (undocumented)
 
- 
completeWithFutureCompletes the request by marshalling the given future value into an http response.- Parameters:
- value- (undocumented)
- Returns:
- (undocumented)
 
- 
completeWithFuturepublic <T> RouteAdapter completeWithFuture(CompletionStage<T> value, Marshaller<T, HttpResponse> marshaller) Completes the request by marshalling the given value into an http response.- Parameters:
- value- (undocumented)
- marshaller- (undocumented)
- Returns:
- (undocumented)
 
- 
completeWithFutureResponseCompletes the request by marshalling the given future value into an http response.- Parameters:
- value- (undocumented)
- Returns:
- (undocumented)
 
- 
completeWithFutureStatusCompletes the request using the given future status code.- Parameters:
- status- (undocumented)
- Returns:
- (undocumented)
 
- 
completeWithFutureStatusCompletes the request using the given future status code.- Parameters:
- status- (undocumented)
- Returns:
- (undocumented)
 
- 
concatUsed to chain multiple alternate routes using comma, rather than having to explicitly call route1.orElse(route2).orElse(route3).- Parameters:
- first- (undocumented)
- alternatives- (undocumented)
- Returns:
- (undocumented)
 
- 
concatUsed to chain multiple alternate routes using comma, rather than having to explicitly call route1.orElse(route2).orElse(route3).- Parameters:
- first- (undocumented)
- alternatives- (undocumented)
- Returns:
- (undocumented)
 
- 
failWithBubbles the given error up the response chain, where it is dealt with by the closesthandleExceptionsdirective and its ExceptionHandler.- Parameters:
- error- (undocumented)
- Returns:
- (undocumented)
 
- 
handlepublic Route handle(org.apache.pekko.japi.function.Function<HttpRequest, CompletionStage<HttpResponse>> handler) Handle the request using a function.- Parameters:
- handler- (undocumented)
- Returns:
- (undocumented)
 
- 
handleSyncHandle the request using a function.- Parameters:
- handler- (undocumented)
- Returns:
- (undocumented)
 
- 
redirectCompletes the request with redirection response of the given type to the given URI.- Parameters:
- redirectionType- A status code from StatusCodes, which must be a redirection type.
- uri- (undocumented)
- Returns:
- (undocumented)
 
- 
rejectRejects the request with the given rejections, or with an empty set of rejections if no rejections are given.- Parameters:
- rejection- (undocumented)
- rejections- (undocumented)
- Returns:
- (undocumented)
 
- 
rejectRejects the request with the given rejections, or with an empty set of rejections if no rejections are given.- Parameters:
- rejection- (undocumented)
- rejections- (undocumented)
- Returns:
- (undocumented)
 
- 
rejectRejects the request with an empty rejection (usually used for "no directive matched").- Returns:
- (undocumented)
 
- 
routeDeprecated.Use theRouteDirectives.concatmethod instead.Java-specific call added so you can chain together multiple alternate routes using comma, rather than having to explicitly call route1.orElse(route2).orElse(route3).- Parameters:
- alternatives- (undocumented)
- Returns:
- (undocumented)
 
- 
routeDeprecated.Use theRouteDirectives.concatmethod instead.Java-specific call added so you can chain together multiple alternate routes using comma, rather than having to explicitly call route1.orElse(route2).orElse(route3).- Parameters:
- alternatives- (undocumented)
- Returns:
- (undocumented)
 
 
- 
RouteDirectives.concatmethod instead.