public final class AnnotatedServiceBindingBuilder extends Object
HttpService fluently. This class can be instantiated through
ServerBuilder.annotatedService().
Call build(Object) to build the HttpService and return to the ServerBuilder.
ServerBuilder sb = Server.builder();
sb.annotatedService() // Returns an instance of this class
.requestTimeoutMillis(5000)
.maxRequestLength(8192)
.exceptionHandler((ctx, request, cause) -> HttpResponse.of(400))
.pathPrefix("/foo")
.verboseResponses(true)
.build(new Service()) // Return to the ServerBuilder.
.build();
ServiceBindingBuilderpublic AnnotatedServiceBindingBuilder pathPrefix(String pathPrefix)
AnnotatedServiceBindingBuilder.pathPrefix - string representing the path prefix.@Deprecated public AnnotatedServiceBindingBuilder exceptionHandler(ExceptionHandlerFunction exceptionHandlerFunction)
exceptionHandlers(ExceptionHandlerFunction...).ExceptionHandlerFunction to this AnnotatedServiceBindingBuilder.public AnnotatedServiceBindingBuilder exceptionHandlers(ExceptionHandlerFunction... exceptionHandlerFunctions)
ExceptionHandlerFunctions to this AnnotatedServiceBindingBuilder.public AnnotatedServiceBindingBuilder exceptionHandlers(Iterable<? extends ExceptionHandlerFunction> exceptionHandlerFunctions)
ExceptionHandlerFunctions to this AnnotatedServiceBindingBuilder.@Deprecated public AnnotatedServiceBindingBuilder responseConverter(ResponseConverterFunction responseConverterFunction)
responseConverters(ResponseConverterFunction...).ResponseConverterFunction to this AnnotatedServiceBindingBuilder.public AnnotatedServiceBindingBuilder responseConverters(ResponseConverterFunction... responseConverterFunctions)
ResponseConverterFunctions to this AnnotatedServiceBindingBuilder.public AnnotatedServiceBindingBuilder responseConverters(Iterable<? extends ResponseConverterFunction> responseConverterFunctions)
ResponseConverterFunctions to this AnnotatedServiceBindingBuilder.@Deprecated public AnnotatedServiceBindingBuilder requestConverter(RequestConverterFunction requestConverterFunction)
requestConverters(RequestConverterFunction...).RequestConverterFunction to this AnnotatedServiceBindingBuilder.public AnnotatedServiceBindingBuilder requestConverters(RequestConverterFunction... requestConverterFunctions)
RequestConverterFunctions to this AnnotatedServiceBindingBuilder.public AnnotatedServiceBindingBuilder requestConverters(Iterable<? extends RequestConverterFunction> requestConverterFunctions)
RequestConverterFunctions to this AnnotatedServiceBindingBuilder.public AnnotatedServiceBindingBuilder decorator(Function<? super HttpService,? extends HttpService> decorator)
HttpService with the specified decorator.decorator - the Function that decorates the HttpServicepublic AnnotatedServiceBindingBuilder requestTimeout(Duration requestTimeout)
VirtualHost.requestTimeoutMillis() is used.requestTimeout - the timeout. 0 disables the timeout.public AnnotatedServiceBindingBuilder requestTimeoutMillis(long requestTimeoutMillis)
VirtualHost.requestTimeoutMillis() is used.requestTimeoutMillis - the timeout in milliseconds. 0 disables the timeout.public AnnotatedServiceBindingBuilder maxRequestLength(long maxRequestLength)
VirtualHost.maxRequestLength() is used.maxRequestLength - the maximum allowed length. 0 disables the length limit.public AnnotatedServiceBindingBuilder verboseResponses(boolean verboseResponses)
VirtualHostBuilder.verboseResponses(boolean) is used.public AnnotatedServiceBindingBuilder accessLogFormat(String accessLogFormat)
HttpService's access log. The specified accessLogFormat would be
parsed by AccessLogWriter.custom(String).public AnnotatedServiceBindingBuilder accessLogWriter(AccessLogWriter accessLogWriter, boolean shutdownOnStop)
HttpService. If not set, the AccessLogWriter set via
VirtualHost.accessLogWriter() is used.shutdownOnStop - whether to shut down the AccessLogWriter when the Server stopspublic ServerBuilder build(Object service)
service - annotated service object to handle incoming requests matching path prefix, which
can be configured through pathPrefix(String).
If path prefix is not set then this service is registered to handle requests matching
/ServerBuilder to continue building ServerCopyright © 2020 LeanCloud. All rights reserved.