Package com.linecorp.armeria.server.docs
Class DocServiceBuilder
- java.lang.Object
-
- com.linecorp.armeria.server.docs.DocServiceBuilder
-
public final class DocServiceBuilder extends Object
Builds a newDocService
.
-
-
Constructor Summary
Constructors Constructor Description DocServiceBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DocService
build()
Returns a newly-createdDocService
based on the properties of this builder.DocServiceBuilder
exampleHttpHeaders(HttpHeaders... exampleHttpHeaders)
Adds the exampleHttpHeaders
which are applicable to any services.DocServiceBuilder
exampleHttpHeaders(Class<?> serviceType, HttpHeaders... exampleHttpHeaders)
Adds the exampleHttpHeaders
for the service with the specified type.DocServiceBuilder
exampleHttpHeaders(Class<?> serviceType, Iterable<? extends HttpHeaders> exampleHttpHeaders)
Adds the exampleHttpHeaders
for the service with the specified type.DocServiceBuilder
exampleHttpHeaders(Class<?> serviceType, String methodName, HttpHeaders... exampleHttpHeaders)
Adds the exampleHttpHeaders
for the method with the specified type and method name.DocServiceBuilder
exampleHttpHeaders(Class<?> serviceType, String methodName, Iterable<? extends HttpHeaders> exampleHttpHeaders)
Adds the exampleHttpHeaders
for the method with the specified type and method name.DocServiceBuilder
exampleHttpHeaders(Iterable<? extends HttpHeaders> exampleHttpHeaders)
Adds the exampleHttpHeaders
which are applicable to any services.DocServiceBuilder
exampleHttpHeaders(String serviceName, HttpHeaders... exampleHttpHeaders)
Adds the exampleHttpHeaders
for the service with the specified name.DocServiceBuilder
exampleHttpHeaders(String serviceName, Iterable<? extends HttpHeaders> exampleHttpHeaders)
Adds the exampleHttpHeaders
for the service with the specified name.DocServiceBuilder
exampleHttpHeaders(String serviceName, String methodName, HttpHeaders... exampleHttpHeaders)
Adds the exampleHttpHeaders
for the method with the specified service and method name.DocServiceBuilder
exampleHttpHeaders(String serviceName, String methodName, Iterable<? extends HttpHeaders> exampleHttpHeaders)
Adds the exampleHttpHeaders
for the method with the specified service and method name.DocServiceBuilder
exampleRequest(Iterable<?> exampleRequests)
Adds the example requests which are applicable to the method denoted by the specified example requests.DocServiceBuilder
exampleRequest(Object... exampleRequests)
Adds the example requests which are applicable to the method denoted by the specified example requests.DocServiceBuilder
exampleRequestForMethod(Class<?> serviceType, String methodName, Iterable<?> exampleRequests)
Adds the example requests for the method with the specified service type and method name.DocServiceBuilder
exampleRequestForMethod(Class<?> serviceType, String methodName, Object... exampleRequests)
Adds the example requests for the method with the specified service type and method name.DocServiceBuilder
exampleRequestForMethod(String serviceName, String methodName, Iterable<?> exampleRequests)
Adds the example requests for the method with the specified service and method name.DocServiceBuilder
exampleRequestForMethod(String serviceName, String methodName, Object... exampleRequests)
Adds the example requests for the method with the specified service and method name.DocServiceBuilder
injectedScript(Iterable<String> scripts)
Adds Javascript scripts to inject into the<head />
of the debug page HTML.DocServiceBuilder
injectedScript(String... scripts)
Adds Javascript scripts to inject into the<head />
of the debug page HTML.
-
-
-
Method Detail
-
exampleHttpHeaders
public DocServiceBuilder exampleHttpHeaders(HttpHeaders... exampleHttpHeaders)
Adds the exampleHttpHeaders
which are applicable to any services.
-
exampleHttpHeaders
public DocServiceBuilder exampleHttpHeaders(Iterable<? extends HttpHeaders> exampleHttpHeaders)
Adds the exampleHttpHeaders
which are applicable to any services.
-
exampleHttpHeaders
public DocServiceBuilder exampleHttpHeaders(Class<?> serviceType, HttpHeaders... exampleHttpHeaders)
Adds the exampleHttpHeaders
for the service with the specified type. This method is a shortcut to:exampleHttpHeaders(serviceType.getName(), exampleHttpHeaders);
-
exampleHttpHeaders
public DocServiceBuilder exampleHttpHeaders(Class<?> serviceType, Iterable<? extends HttpHeaders> exampleHttpHeaders)
Adds the exampleHttpHeaders
for the service with the specified type. This method is a shortcut to:exampleHttpHeaders(serviceType.getName(), exampleHttpHeaders);
-
exampleHttpHeaders
public DocServiceBuilder exampleHttpHeaders(String serviceName, HttpHeaders... exampleHttpHeaders)
Adds the exampleHttpHeaders
for the service with the specified name.
-
exampleHttpHeaders
public DocServiceBuilder exampleHttpHeaders(String serviceName, Iterable<? extends HttpHeaders> exampleHttpHeaders)
Adds the exampleHttpHeaders
for the service with the specified name.
-
exampleHttpHeaders
public DocServiceBuilder exampleHttpHeaders(Class<?> serviceType, String methodName, HttpHeaders... exampleHttpHeaders)
Adds the exampleHttpHeaders
for the method with the specified type and method name. This method is a shortcut to:exampleHttpHeaders(serviceType.getName(), methodName, exampleHttpHeaders);
-
exampleHttpHeaders
public DocServiceBuilder exampleHttpHeaders(Class<?> serviceType, String methodName, Iterable<? extends HttpHeaders> exampleHttpHeaders)
Adds the exampleHttpHeaders
for the method with the specified type and method name. This method is a shortcut to:exampleHttpHeaders(serviceType.getName(), methodName, exampleHttpHeaders);
-
exampleHttpHeaders
public DocServiceBuilder exampleHttpHeaders(String serviceName, String methodName, HttpHeaders... exampleHttpHeaders)
Adds the exampleHttpHeaders
for the method with the specified service and method name.
-
exampleHttpHeaders
public DocServiceBuilder exampleHttpHeaders(String serviceName, String methodName, Iterable<? extends HttpHeaders> exampleHttpHeaders)
Adds the exampleHttpHeaders
for the method with the specified service and method name.
-
exampleRequestForMethod
public DocServiceBuilder exampleRequestForMethod(Class<?> serviceType, String methodName, Object... exampleRequests)
Adds the example requests for the method with the specified service type and method name. This method is a shortcut to:exampleRequest(serviceType.getName(), exampleRequests);
-
exampleRequestForMethod
public DocServiceBuilder exampleRequestForMethod(Class<?> serviceType, String methodName, Iterable<?> exampleRequests)
Adds the example requests for the method with the specified service type and method name. This method is a shortcut to:exampleRequest(serviceType.getName(), exampleRequests);
-
exampleRequestForMethod
public DocServiceBuilder exampleRequestForMethod(String serviceName, String methodName, Object... exampleRequests)
Adds the example requests for the method with the specified service and method name.
-
exampleRequestForMethod
public DocServiceBuilder exampleRequestForMethod(String serviceName, String methodName, Iterable<?> exampleRequests)
Adds the example requests for the method with the specified service and method name.
-
exampleRequest
public DocServiceBuilder exampleRequest(Object... exampleRequests)
Adds the example requests which are applicable to the method denoted by the specified example requests. Please note that this method may fail if the specified requests object do not provide the information about their service and method names.- Throws:
IllegalArgumentException
- if failed to get the service and method name from an example request
-
exampleRequest
public DocServiceBuilder exampleRequest(Iterable<?> exampleRequests)
Adds the example requests which are applicable to the method denoted by the specified example requests. Please note that this method may fail if the specified requests object do not provide the information about their service and method names.- Throws:
IllegalArgumentException
- if failed to get the service and method name from an example request
-
injectedScript
public DocServiceBuilder injectedScript(String... scripts)
Adds Javascript scripts to inject into the<head />
of the debug page HTML. This can be used to customize the debug page (e.g., to provide a HeaderProvider for enabling authentication based on local storage). All scripts are concatenated into the content of a single script tag.A common use case is to provide authentication of debug requests using a local storage access token, e.g.,
armeria.registerHeaderProvider(function() { // Replace with fetching accesstoken using your favorite auth library. return Promise.resolve({ authorization: 'accesstoken' }); });
-
injectedScript
public DocServiceBuilder injectedScript(Iterable<String> scripts)
Adds Javascript scripts to inject into the<head />
of the debug page HTML. This can be used to customize the debug page (e.g., to provide a HeaderProvider for enabling authentication based on local storage). All scripts are concatenated into the content of a single script tag.A common use case is to provide authentication of debug requests using a local storage access token, e.g.,
armeria.registerHeaderProvider(function() { // Replace with fetching accesstoken using your favorite auth library. return Promise.resolve({ authorization: 'accesstoken' }); });
-
build
public DocService build()
Returns a newly-createdDocService
based on the properties of this builder.
-
-