Package com.linecorp.armeria.server
Class AnnotatedServiceBindingBuilder
java.lang.Object
com.linecorp.armeria.server.AnnotatedServiceBindingBuilder
public final class AnnotatedServiceBindingBuilder extends Object
A builder class for binding an
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();
- See Also:
ServiceBindingBuilder
-
Method Summary
-
Method Details
-
pathPrefix
Sets the path prefix to be used for thisAnnotatedServiceBindingBuilder
.- Parameters:
pathPrefix
- string representing the path prefix.
-
exceptionHandlers
public AnnotatedServiceBindingBuilder exceptionHandlers(ExceptionHandlerFunction... exceptionHandlerFunctions)Adds the givenExceptionHandlerFunction
s to thisAnnotatedServiceBindingBuilder
. -
exceptionHandlers
public AnnotatedServiceBindingBuilder exceptionHandlers(Iterable<? extends ExceptionHandlerFunction> exceptionHandlerFunctions)Adds the givenExceptionHandlerFunction
s to thisAnnotatedServiceBindingBuilder
. -
responseConverters
public AnnotatedServiceBindingBuilder responseConverters(ResponseConverterFunction... responseConverterFunctions)Adds the givenResponseConverterFunction
s to thisAnnotatedServiceBindingBuilder
. -
responseConverters
public AnnotatedServiceBindingBuilder responseConverters(Iterable<? extends ResponseConverterFunction> responseConverterFunctions)Adds the givenResponseConverterFunction
s to thisAnnotatedServiceBindingBuilder
. -
requestConverters
public AnnotatedServiceBindingBuilder requestConverters(RequestConverterFunction... requestConverterFunctions)Adds the givenRequestConverterFunction
s to thisAnnotatedServiceBindingBuilder
. -
requestConverters
public AnnotatedServiceBindingBuilder requestConverters(Iterable<? extends RequestConverterFunction> requestConverterFunctions)Adds the givenRequestConverterFunction
s to thisAnnotatedServiceBindingBuilder
. -
decorator
public AnnotatedServiceBindingBuilder decorator(Function<? super HttpService,? extends HttpService> decorator) -
requestTimeout
-
requestTimeoutMillis
-
maxRequestLength
-
verboseResponses
-
accessLogFormat
-
accessLogWriter
public AnnotatedServiceBindingBuilder accessLogWriter(AccessLogWriter accessLogWriter, boolean shutdownOnStop) -
build
- Parameters:
service
- annotated service object to handle incoming requests matching path prefix, which can be configured throughpathPrefix(String)
. If path prefix is not set then this service is registered to handle requests matching/
- Returns:
ServerBuilder
to continue buildingServer
-