Package com.linecorp.armeria.server
Class VirtualHostContextPathServiceBindingBuilder
java.lang.Object
com.linecorp.armeria.server.VirtualHostContextPathServiceBindingBuilder
A builder class for binding an
HttpService
fluently. This class can be instantiated through
VirtualHostBuilder.contextPath(String...)
.
Call build(HttpService)
to build the HttpService
and return
to the VirtualHostBuilder
.
Server.builder()
.virtualHost("foo.com")
.contextPath("/v3")
.route()
.get("/service2")
.build(service2); // served under "/v3/service2"
-
Method Summary
Modifier and TypeMethodDescriptionaccessLogFormat
(String accessLogFormat) accessLogWriter
(AccessLogWriter accessLogWriter, boolean shutdownOnStop) addHeader
(CharSequence name, Object value) addHeaders
(Iterable<? extends Map.Entry<? extends CharSequence, ?>> defaultHeaders) Specifies an additionalRoute
that should be matched.blockingTaskExecutor
(int numThreads) blockingTaskExecutor
(BlockingTaskExecutor blockingTaskExecutor, boolean shutdownOnStop) blockingTaskExecutor
(ScheduledExecutorService blockingTaskExecutor, boolean shutdownOnStop) build
(HttpService service) Sets theHttpService
and returns the object that thisVirtualHostContextPathServicesBuilder
was created from.Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.CONNECT
requests.SetsMediaType
s that anHttpService
will consume.SetsMediaType
s that anHttpService
will consume.contextHook
(Supplier<? extends AutoCloseable> contextHook) decorator
(DecoratingHttpServiceFunction decoratingHttpServiceFunction) decorator
(Function<? super HttpService, ? extends HttpService> decorator) decorators
(Iterable<? extends Function<? super HttpService, ? extends HttpService>> decorators) decorators
(Function<? super HttpService, ? extends HttpService>... decorators) defaultLogName
(String defaultLogName) defaultServiceName
(String defaultServiceName) defaultServiceNaming
(ServiceNaming defaultServiceNaming) Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.DELETE
requests.errorHandler
(ServiceErrorHandler serviceErrorHandler) Adds apathPattern
that is supposed to be excluded from theRoute
s built by thisAbstractBindingBuilder
.Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.GET
requests.Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.HEAD
requests.matchesHeaders
(CharSequence headerName, Predicate<? super String> valuePredicate) Sets theRoute
to accept a request when the specifiedvaluePredicate
evaluatestrue
with the value of the specifiedheaderName
header.matchesHeaders
(Iterable<String> headerPredicates) Sets theRoute
to accept a request if it matches all the specified predicates forHttpHeaders
.matchesHeaders
(String... headerPredicates) Sets theRoute
to accept a request if it matches all the specified predicates forHttpHeaders
.matchesParams
(Iterable<String> paramPredicates) Sets theRoute
to accept a request if it matches all the specified predicates for HTTP parameters.matchesParams
(String... paramPredicates) Sets theRoute
to accept a request if it matches all the specified predicates for HTTP parameters.matchesParams
(String paramName, Predicate<? super String> valuePredicate) Sets theRoute
to accept a request when the specifiedvaluePredicate
evaluatestrue
with the value of the specifiedparamName
parameter.maxRequestLength
(long maxRequestLength) methods
(HttpMethod... methods) Sets theHttpMethod
s that anHttpService
will support.methods
(Iterable<HttpMethod> methods) Sets theHttpMethod
s that anHttpService
will support.multipartUploadsLocation
(Path multipartUploadsLocation) Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.OPTIONS
requests.Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.PATCH
requests.Sets the path pattern that anHttpService
will be bound to.pathPrefix
(String prefix) Sets the specified prefix which is a directory that anHttpService
will be bound under.Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.POST
requests.SetsMediaType
s that anHttpService
will produce to be used in content negotiation.SetsMediaType
s that anHttpService
will produce to be used in content negotiation.Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.PUT
requests.requestAutoAbortDelay
(Duration delay) requestAutoAbortDelayMillis
(long delayMillis) requestIdGenerator
(Function<? super RoutingContext, ? extends RequestId> requestIdGenerator) requestTimeout
(Duration requestTimeout) requestTimeoutMillis
(long requestTimeoutMillis) serviceWorkerGroup
(int numThreads) serviceWorkerGroup
(EventLoopGroup serviceWorkerGroup, boolean shutdownOnStop) setHeader
(CharSequence name, Object value) setHeaders
(Iterable<? extends Map.Entry<? extends CharSequence, ?>> defaultHeaders) successFunction
(SuccessFunction successFunction) Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.TRACE
requests.verboseResponses
(boolean verboseResponses)
-
Method Details
-
requestTimeout
-
requestTimeoutMillis
-
maxRequestLength
-
verboseResponses
-
accessLogFormat
-
accessLogWriter
public VirtualHostContextPathServiceBindingBuilder accessLogWriter(AccessLogWriter accessLogWriter, boolean shutdownOnStop) -
decorator
public VirtualHostContextPathServiceBindingBuilder decorator(DecoratingHttpServiceFunction decoratingHttpServiceFunction) -
decorator
public VirtualHostContextPathServiceBindingBuilder decorator(Function<? super HttpService, ? extends HttpService> decorator) -
decorators
public VirtualHostContextPathServiceBindingBuilder decorators(Function<? super HttpService, ? extends HttpService>... decorators) -
decorators
public VirtualHostContextPathServiceBindingBuilder decorators(Iterable<? extends Function<? super HttpService, ? extends HttpService>> decorators) -
defaultServiceName
-
defaultServiceNaming
public VirtualHostContextPathServiceBindingBuilder defaultServiceNaming(ServiceNaming defaultServiceNaming) -
defaultLogName
-
blockingTaskExecutor
public VirtualHostContextPathServiceBindingBuilder blockingTaskExecutor(ScheduledExecutorService blockingTaskExecutor, boolean shutdownOnStop) -
blockingTaskExecutor
public VirtualHostContextPathServiceBindingBuilder blockingTaskExecutor(BlockingTaskExecutor blockingTaskExecutor, boolean shutdownOnStop) -
blockingTaskExecutor
-
successFunction
-
requestAutoAbortDelay
-
requestAutoAbortDelayMillis
-
multipartUploadsLocation
public VirtualHostContextPathServiceBindingBuilder multipartUploadsLocation(Path multipartUploadsLocation) -
serviceWorkerGroup
public VirtualHostContextPathServiceBindingBuilder serviceWorkerGroup(EventLoopGroup serviceWorkerGroup, boolean shutdownOnStop) -
serviceWorkerGroup
-
requestIdGenerator
public VirtualHostContextPathServiceBindingBuilder requestIdGenerator(Function<? super RoutingContext, ? extends RequestId> requestIdGenerator) -
addHeader
-
addHeaders
public VirtualHostContextPathServiceBindingBuilder addHeaders(Iterable<? extends Map.Entry<? extends CharSequence, ?>> defaultHeaders) -
setHeader
-
setHeaders
public VirtualHostContextPathServiceBindingBuilder setHeaders(Iterable<? extends Map.Entry<? extends CharSequence, ?>> defaultHeaders) -
errorHandler
public VirtualHostContextPathServiceBindingBuilder errorHandler(ServiceErrorHandler serviceErrorHandler) -
contextHook
public VirtualHostContextPathServiceBindingBuilder contextHook(Supplier<? extends AutoCloseable> contextHook) -
path
Sets the path pattern that anHttpService
will be bound to. Please refer to the Path patterns in order to learn how to specify a path pattern. -
pathPrefix
Sets the specified prefix which is a directory that anHttpService
will be bound under.pathPrefix("/my/path")
is identical topath("prefix:/my/path")
. -
get
Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.GET
requests. Please refer to the Path patterns in order to learn how to specify a path pattern. -
post
Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.POST
requests. Please refer to the Path patterns in order to learn how to specify a path pattern. -
put
Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.PUT
requests. Please refer to the Path patterns in order to learn how to specify a path pattern. -
patch
Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.PATCH
requests. Please refer to the Path patterns in order to learn how to specify a path pattern. -
delete
Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.DELETE
requests. Please refer to the Path patterns in order to learn how to specify a path pattern. -
options
Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.OPTIONS
requests. Please refer to the Path patterns in order to learn how to specify a path pattern. -
head
Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.HEAD
requests. Please refer to the Path patterns in order to learn how to specify a path pattern. -
trace
Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.TRACE
requests. Please refer to the Path patterns in order to learn how to specify a path pattern. -
connect
Sets the path pattern that anHttpService
will be bound to, only supportingHttpMethod.CONNECT
requests. Please refer to the Path patterns in order to learn how to specify a path pattern. -
methods
Sets theHttpMethod
s that anHttpService
will support. If not set,HttpMethod.knownMethods()
s are set.- See Also:
-
methods
Sets theHttpMethod
s that anHttpService
will support. If not set,HttpMethod.knownMethods()
s are set.- See Also:
-
consumes
SetsMediaType
s that anHttpService
will consume. If not set, theHttpService
will accept all media types. -
consumes
SetsMediaType
s that anHttpService
will consume. If not set, theHttpService
will accept all media types. -
produces
SetsMediaType
s that anHttpService
will produce to be used in content negotiation. See Accept header for more information. -
produces
SetsMediaType
s that anHttpService
will produce to be used in content negotiation. See Accept header for more information. -
matchesParams
Sets theRoute
to accept a request if it matches all the specified predicates for HTTP parameters. The predicate can be one of the following forms:some-param=some-value
which means that the request must have asome-param=some-value
parametersome-param!=some-value
which means that the request must not have asome-param=some-value
parametersome-param
which means that the request must contain asome-param
parameter!some-param
which means that the request must not contain asome-param
parameter
Note that these predicates can be evaluated only with the query string of the request URI. Also note that each predicate will be evaluated with the decoded value of HTTP parameters, so do not use percent-encoded value in the predicate.
- See Also:
-
matchesParams
Sets theRoute
to accept a request if it matches all the specified predicates for HTTP parameters. The predicate can be one of the following forms:some-param=some-value
which means that the request must have asome-param=some-value
parametersome-param!=some-value
which means that the request must not have asome-param=some-value
parametersome-param
which means that the request must contain asome-param
parameter!some-param
which means that the request must not contain asome-param
parameter
Note that these predicates can be evaluated only with the query string of the request URI. Also note that each predicate will be evaluated with the decoded value of HTTP parameters, so do not use percent-encoded value in the predicate.
- See Also:
-
matchesParams
public VirtualHostContextPathServiceBindingBuilder matchesParams(String paramName, Predicate<? super String> valuePredicate) Sets theRoute
to accept a request when the specifiedvaluePredicate
evaluatestrue
with the value of the specifiedparamName
parameter. -
matchesHeaders
Sets theRoute
to accept a request if it matches all the specified predicates forHttpHeaders
. The predicate can be one of the following forms:some-header=some-value
which means that the request must have asome-header: some-value
headersome-header!=some-value
which means that the request must not have asome-header: some-value
headersome-header
which means that the request must contain asome-header
header!some-header
which means that the request must not contain asome-header
header
- See Also:
-
matchesHeaders
public VirtualHostContextPathServiceBindingBuilder matchesHeaders(Iterable<String> headerPredicates) Sets theRoute
to accept a request if it matches all the specified predicates forHttpHeaders
. The predicate can be one of the following forms:some-header=some-value
which means that the request must have asome-header: some-value
headersome-header!=some-value
which means that the request must not have asome-header: some-value
an headersome-header
which means that the request must contain asome-header
header!some-header
which means that the request must not contain asome-header
header
- See Also:
-
matchesHeaders
public VirtualHostContextPathServiceBindingBuilder matchesHeaders(CharSequence headerName, Predicate<? super String> valuePredicate) Sets theRoute
to accept a request when the specifiedvaluePredicate
evaluatestrue
with the value of the specifiedheaderName
header. -
addRoute
Specifies an additionalRoute
that should be matched. -
exclude
Adds apathPattern
that is supposed to be excluded from theRoute
s built by thisAbstractBindingBuilder
. Please refer to Path patterns to learn more about path pattern syntax. -
exclude
-
build
Sets theHttpService
and returns the object that thisVirtualHostContextPathServicesBuilder
was created from.
-