Class RouteDirectives
- java.lang.Object
-
- akka.http.javadsl.server.directives.BasicDirectives
-
- akka.http.javadsl.server.directives.CacheConditionDirectives
-
- akka.http.javadsl.server.directives.CodingDirectives
-
- akka.http.javadsl.server.directives.CookieDirectives
-
- akka.http.javadsl.server.directives.DebuggingDirectives
-
- akka.http.javadsl.server.directives.ExecutionDirectives
-
- akka.http.javadsl.server.directives.FileAndResourceDirectives
-
- akka.http.javadsl.server.directives.FileUploadDirectives
-
- akka.http.javadsl.server.directives.FormFieldDirectives
-
- akka.http.javadsl.server.directives.FutureDirectives
-
- akka.http.javadsl.server.directives.HeaderDirectives
-
- akka.http.javadsl.server.directives.AttributeDirectives
-
- akka.http.javadsl.server.directives.HostDirectives
-
- akka.http.javadsl.server.directives.MarshallingDirectives
-
- akka.http.javadsl.server.directives.MethodDirectives
-
- akka.http.javadsl.server.directives.MiscDirectives
-
- akka.http.javadsl.server.directives.ParameterDirectives
-
- akka.http.javadsl.server.directives.PathDirectives
-
- akka.http.javadsl.server.directives.RangeDirectives
-
- akka.http.javadsl.server.directives.RespondWithDirectives
-
- akka.http.javadsl.server.directives.RouteDirectives
-
- Direct Known Subclasses:
SchemeDirectives
public abstract class RouteDirectives extends RespondWithDirectives
-
-
Constructor Summary
Constructors Constructor Description RouteDirectives()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Route
complete(HttpResponse response)
Completes the request using the given http response.RouteAdapter
complete(RequestEntity entity)
Completes the request as HTTP 200 OK with the given value as response entity.RouteAdapter
complete(ResponseEntity entity)
Completes the request as HTTP 200 OK with the given value as response entity.Route
complete(StatusCode status)
Completes the request using the given status code.RouteAdapter
complete(StatusCode status, RequestEntity entity)
Completes the request using the given status code and response entity.RouteAdapter
complete(StatusCode status, ResponseEntity entity)
Completes the request using the given status code and response entity.RouteAdapter
complete(StatusCode status, java.lang.Iterable<HttpHeader> headers, RequestEntity entity)
Completes the request using the given status code, headers, and response entity.RouteAdapter
complete(StatusCode status, java.lang.Iterable<HttpHeader> headers, ResponseEntity entity)
Completes the request using the given status code, headers, and response entity.<T> RouteAdapter
complete(StatusCode status, java.lang.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.RouteAdapter
complete(StatusCode status, java.lang.String entity)
Completes the request using the given status code and the given body as UTF-8.<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.RouteAdapter
complete(java.lang.Iterable<HttpHeader> headers, RequestEntity entity)
Completes the request as HTTP 200 OK, adding the given headers and response entity.RouteAdapter
complete(java.lang.Iterable<HttpHeader> headers, ResponseEntity entity)
Completes the request as HTTP 200 OK, adding the given headers and response entity.<T> RouteAdapter
complete(java.lang.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.Route
complete(java.lang.String body)
Completes the request using an HTTP 200 OK status code and the given body as UTF-8 entity.<T> RouteAdapter
complete(T value, Marshaller<T,HttpResponse> marshaller)
Completes the request by marshalling the given value into an http response.<T> RouteAdapter
completeOK(T value, Marshaller<T,RequestEntity> marshaller)
Completes the request as HTTP 200 OK, marshalling the given value as response entity.RouteAdapter
completeOKWithFuture(java.util.concurrent.CompletionStage<RequestEntity> value)
Completes the request by marshalling the given future value into an http response.<T> RouteAdapter
completeOKWithFuture(java.util.concurrent.CompletionStage<T> value, Marshaller<T,RequestEntity> marshaller)
Completes the request with anOK
status code by marshalling the given value into an http response.<T> RouteAdapter
completeOKWithFuture(scala.concurrent.Future<T> value, Marshaller<T,RequestEntity> marshaller)
Completes the request by marshalling the given value into an http response.RouteAdapter
completeOKWithFutureString(java.util.concurrent.CompletionStage<java.lang.String> value)
Completes the request by marshalling the given future value into an http response.RouteAdapter
completeOKWithFutureString(scala.concurrent.Future<java.lang.String> value)
Completes the request by marshalling the given future value into an http response.RouteAdapter
completeWithFuture(java.util.concurrent.CompletionStage<HttpResponse> value)
Completes the request by marshalling the given future value into an http response.<T> RouteAdapter
completeWithFuture(java.util.concurrent.CompletionStage<T> value, Marshaller<T,HttpResponse> marshaller)
Completes the request by marshalling the given value into an http response.<T> RouteAdapter
completeWithFuture(scala.concurrent.Future<T> value, Marshaller<T,HttpResponse> marshaller)
Completes the request by marshalling the given value into an http response.RouteAdapter
completeWithFutureResponse(scala.concurrent.Future<HttpResponse> value)
Completes the request by marshalling the given future value into an http response.Route
completeWithFutureStatus(java.util.concurrent.CompletionStage<StatusCode> status)
Completes the request using the given future status code.Route
completeWithFutureStatus(scala.concurrent.Future<StatusCode> status)
Completes the request using the given future status code.Route
concat(Route first, Route... alternatives)
Used to chain multiple alternate routes using comma, rather than having to explicitly call route1.orElse(route2).orElse(route3).Route
concat(Route first, scala.collection.immutable.Seq<Route> alternatives)
Used to chain multiple alternate routes using comma, rather than having to explicitly call route1.orElse(route2).orElse(route3).Route
failWith(java.lang.Throwable error)
Bubbles the given error up the response chain, where it is dealt with by the closesthandleExceptions
directive and its ExceptionHandler.Route
handle(akka.japi.function.Function<HttpRequest,java.util.concurrent.CompletionStage<HttpResponse>> handler)
Handle the request using a function.Route
handleSync(akka.japi.function.Function<HttpRequest,HttpResponse> handler)
Handle the request using a function.Route
redirect(Uri uri, StatusCode redirectionType)
Completes the request with redirection response of the given type to the given URI.Route
reject()
Rejects the request with an empty rejection (usually used for "no directive matched").Route
reject(Rejection rejection, Rejection... rejections)
Rejects the request with the given rejections, or with an empty set of rejections if no rejections are given.Route
reject(Rejection rejection, scala.collection.immutable.Seq<Rejection> rejections)
Rejects the request with the given rejections, or with an empty set of rejections if no rejections are given.Route
route(Route... alternatives)
Deprecated.Use theRouteDirectives.concat
method instead.Route
route(scala.collection.immutable.Seq<Route> alternatives)
Deprecated.Use theRouteDirectives.concat
method instead.-
Methods inherited from class akka.http.javadsl.server.directives.RespondWithDirectives
respondWithDefaultHeader, respondWithDefaultHeaders, respondWithHeader, respondWithHeaders
-
Methods inherited from class akka.http.javadsl.server.directives.RangeDirectives
withRangeSupport
-
Methods inherited from class akka.http.javadsl.server.directives.PathDirectives
ignoreTrailingSlash, 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, redirectToTrailingSlashIfMissing
-
Methods inherited from class akka.http.javadsl.server.directives.ParameterDirectives
parameter, parameter, parameterList, parameterList, parameterList, parameterMap, parameterMultiMap, parameterOptional, parameterOptional, parameterOrDefault, parameterRequiredValue
-
Methods inherited from class akka.http.javadsl.server.directives.MiscDirectives
extractClientIP, rejectEmptyResponse, requestEntityEmpty, requestEntityPresent, selectPreferredLanguage, validate, withoutSizeLimit, withSizeLimit
-
Methods inherited from class akka.http.javadsl.server.directives.MethodDirectives
delete, extractMethod, get, head, method, options, overrideMethodWithParameter, patch, post, put
-
Methods inherited from class akka.http.javadsl.server.directives.MarshallingDirectives
completeWith, entity, handleWith, request
-
Methods inherited from class akka.http.javadsl.server.directives.HostDirectives
extractHost, host, host, host, host
-
Methods inherited from class akka.http.javadsl.server.directives.AttributeDirectives
attribute, optionalAttribute
-
Methods inherited from class akka.http.javadsl.server.directives.HeaderDirectives
checkSameOrigin, headerValue, headerValueByName, headerValueByType, headerValuePF, optionalHeaderValue, optionalHeaderValueByName, optionalHeaderValueByType, optionalHeaderValuePF
-
Methods inherited from class akka.http.javadsl.server.directives.FutureDirectives
completeOrRecoverWith, onComplete, onComplete, onCompleteWithBreaker, onSuccess, onSuccess
-
Methods inherited from class akka.http.javadsl.server.directives.FormFieldDirectives
formField, formField, formFieldList, formFieldList, formFieldList, formFieldMap, formFieldMultiMap, formFieldOptional, formFieldOptional
-
Methods inherited from class akka.http.javadsl.server.directives.FileUploadDirectives
fileUpload, fileUploadAll, storeUploadedFile, storeUploadedFiles
-
Methods inherited from class akka.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 akka.http.javadsl.server.directives.ExecutionDirectives
handleExceptions, handleRejections
-
Methods inherited from class akka.http.javadsl.server.directives.DebuggingDirectives
logRequest, logRequest, logRequest, logRequestResult, logRequestResultOptional, logResult, logResult, logResult
-
Methods inherited from class akka.http.javadsl.server.directives.CookieDirectives
cookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, optionalCookie, setCookie, setCookie
-
Methods inherited from class akka.http.javadsl.server.directives.CodingDirectives
decodeRequest, decodeRequestWith, decodeRequestWith, encodeResponse, encodeResponseWith, requestEncodedWith, responseEncodingAccepted, withPrecompressedMediaTypeSupport
-
Methods inherited from class akka.http.javadsl.server.directives.CacheConditionDirectives
conditional, conditional, conditional, conditional
-
Methods inherited from class akka.http.javadsl.server.directives.BasicDirectives
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
-
-
-
-
Method Detail
-
complete
public Route complete(java.lang.String body)
Completes the request using an HTTP 200 OK status code and the given body as UTF-8 entity.- Parameters:
body
- (undocumented)- Returns:
- (undocumented)
-
complete
public Route complete(HttpResponse response)
Completes the request using the given http response.- Parameters:
response
- (undocumented)- Returns:
- (undocumented)
-
complete
public Route complete(StatusCode status)
Completes the request using the given status code.- Parameters:
status
- (undocumented)- Returns:
- (undocumented)
-
complete
public <T> RouteAdapter complete(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)
-
complete
public <T> RouteAdapter complete(StatusCode status, java.lang.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)
-
complete
public RouteAdapter complete(StatusCode status, java.lang.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)
-
complete
public RouteAdapter complete(StatusCode status, java.lang.Iterable<HttpHeader> headers, RequestEntity entity)
Completes the request using the given status code, headers, and response entity.- Parameters:
status
- (undocumented)headers
- (undocumented)entity
- (undocumented)- Returns:
- (undocumented)
-
complete
public <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)
-
complete
public RouteAdapter complete(StatusCode status, ResponseEntity entity)
Completes the request using the given status code and response entity.- Parameters:
status
- (undocumented)entity
- (undocumented)- Returns:
- (undocumented)
-
complete
public RouteAdapter complete(StatusCode status, RequestEntity entity)
Completes the request using the given status code and response entity.- Parameters:
status
- (undocumented)entity
- (undocumented)- Returns:
- (undocumented)
-
complete
public RouteAdapter complete(StatusCode status, java.lang.String entity)
Completes the request using the given status code and the given body as UTF-8.- Parameters:
status
- (undocumented)entity
- (undocumented)- Returns:
- (undocumented)
-
complete
public <T> RouteAdapter complete(java.lang.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)
-
complete
public RouteAdapter complete(java.lang.Iterable<HttpHeader> headers, ResponseEntity entity)
Completes the request as HTTP 200 OK, adding the given headers and response entity.- Parameters:
headers
- (undocumented)entity
- (undocumented)- Returns:
- (undocumented)
-
complete
public RouteAdapter complete(java.lang.Iterable<HttpHeader> headers, RequestEntity entity)
Completes the request as HTTP 200 OK, adding the given headers and response entity.- Parameters:
headers
- (undocumented)entity
- (undocumented)- Returns:
- (undocumented)
-
complete
public RouteAdapter complete(ResponseEntity entity)
Completes the request as HTTP 200 OK with the given value as response entity.- Parameters:
entity
- (undocumented)- Returns:
- (undocumented)
-
complete
public RouteAdapter complete(RequestEntity entity)
Completes the request as HTTP 200 OK with the given value as response entity.- Parameters:
entity
- (undocumented)- Returns:
- (undocumented)
-
completeOK
public <T> RouteAdapter completeOK(T value, Marshaller<T,RequestEntity> marshaller)
Completes the request as HTTP 200 OK, marshalling the given value as response entity.- Parameters:
value
- (undocumented)marshaller
- (undocumented)- Returns:
- (undocumented)
-
completeOKWithFuture
public <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)
-
completeOKWithFuture
public RouteAdapter completeOKWithFuture(java.util.concurrent.CompletionStage<RequestEntity> value)
Completes the request by marshalling the given future value into an http response.- Parameters:
value
- (undocumented)- Returns:
- (undocumented)
-
completeOKWithFuture
public <T> RouteAdapter completeOKWithFuture(java.util.concurrent.CompletionStage<T> value, Marshaller<T,RequestEntity> marshaller)
Completes the request with anOK
status code by marshalling the given value into an http response.- Parameters:
value
- (undocumented)marshaller
- (undocumented)- Returns:
- (undocumented)
-
completeOKWithFutureString
public RouteAdapter completeOKWithFutureString(scala.concurrent.Future<java.lang.String> value)
Completes the request by marshalling the given future value into an http response.- Parameters:
value
- (undocumented)- Returns:
- (undocumented)
-
completeOKWithFutureString
public RouteAdapter completeOKWithFutureString(java.util.concurrent.CompletionStage<java.lang.String> value)
Completes the request by marshalling the given future value into an http response.- Parameters:
value
- (undocumented)- Returns:
- (undocumented)
-
completeWithFuture
public <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)
-
completeWithFuture
public RouteAdapter completeWithFuture(java.util.concurrent.CompletionStage<HttpResponse> value)
Completes the request by marshalling the given future value into an http response.- Parameters:
value
- (undocumented)- Returns:
- (undocumented)
-
completeWithFuture
public <T> RouteAdapter completeWithFuture(java.util.concurrent.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)
-
completeWithFutureResponse
public RouteAdapter completeWithFutureResponse(scala.concurrent.Future<HttpResponse> value)
Completes the request by marshalling the given future value into an http response.- Parameters:
value
- (undocumented)- Returns:
- (undocumented)
-
completeWithFutureStatus
public Route completeWithFutureStatus(scala.concurrent.Future<StatusCode> status)
Completes the request using the given future status code.- Parameters:
status
- (undocumented)- Returns:
- (undocumented)
-
completeWithFutureStatus
public Route completeWithFutureStatus(java.util.concurrent.CompletionStage<StatusCode> status)
Completes the request using the given future status code.- Parameters:
status
- (undocumented)- Returns:
- (undocumented)
-
concat
public Route concat(Route first, Route... alternatives)
Used 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)
-
concat
public Route concat(Route first, scala.collection.immutable.Seq<Route> alternatives)
Used 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)
-
failWith
public Route failWith(java.lang.Throwable error)
Bubbles the given error up the response chain, where it is dealt with by the closesthandleExceptions
directive and its ExceptionHandler.- Parameters:
error
- (undocumented)- Returns:
- (undocumented)
-
handle
public Route handle(akka.japi.function.Function<HttpRequest,java.util.concurrent.CompletionStage<HttpResponse>> handler)
Handle the request using a function.- Parameters:
handler
- (undocumented)- Returns:
- (undocumented)
-
handleSync
public Route handleSync(akka.japi.function.Function<HttpRequest,HttpResponse> handler)
Handle the request using a function.- Parameters:
handler
- (undocumented)- Returns:
- (undocumented)
-
redirect
public Route redirect(Uri uri, StatusCode redirectionType)
Completes 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)
-
reject
public Route reject(Rejection rejection, Rejection... rejections)
Rejects 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)
-
reject
public Route reject(Rejection rejection, scala.collection.immutable.Seq<Rejection> rejections)
Rejects 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)
-
reject
public Route reject()
Rejects the request with an empty rejection (usually used for "no directive matched").- Returns:
- (undocumented)
-
route
public Route route(Route... alternatives)
Deprecated.Use theRouteDirectives.concat
method 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)
-
route
public Route route(scala.collection.immutable.Seq<Route> alternatives)
Deprecated.Use theRouteDirectives.concat
method 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)
-
-