public final class DocServiceBuilder extends Object
DocService.| Constructor and Description |
|---|
DocServiceBuilder()
Deprecated.
Use
DocService.builder(). |
| Modifier and Type | Method and Description |
|---|---|
DocService |
build()
Returns a newly-created
DocService based on the properties of this builder. |
DocServiceBuilder |
exampleHttpHeaders(Class<?> serviceType,
HttpHeaders... exampleHttpHeaders)
Adds the example
HttpHeaders for the service with the specified type. |
DocServiceBuilder |
exampleHttpHeaders(Class<?> serviceType,
Iterable<? extends HttpHeaders> exampleHttpHeaders)
Adds the example
HttpHeaders for the service with the specified type. |
DocServiceBuilder |
exampleHttpHeaders(Class<?> serviceType,
String methodName,
HttpHeaders... exampleHttpHeaders)
Adds the example
HttpHeaders for the method with the specified type and method name. |
DocServiceBuilder |
exampleHttpHeaders(Class<?> serviceType,
String methodName,
Iterable<? extends HttpHeaders> exampleHttpHeaders)
Adds the example
HttpHeaders for the method with the specified type and method name. |
DocServiceBuilder |
exampleHttpHeaders(HttpHeaders... exampleHttpHeaders)
Adds the example
HttpHeaders which are applicable to any services. |
DocServiceBuilder |
exampleHttpHeaders(Iterable<? extends HttpHeaders> exampleHttpHeaders)
Adds the example
HttpHeaders which are applicable to any services. |
DocServiceBuilder |
exampleHttpHeaders(String serviceName,
HttpHeaders... exampleHttpHeaders)
Adds the example
HttpHeaders for the service with the specified name. |
DocServiceBuilder |
exampleHttpHeaders(String serviceName,
Iterable<? extends HttpHeaders> exampleHttpHeaders)
Adds the example
HttpHeaders for the service with the specified name. |
DocServiceBuilder |
exampleHttpHeaders(String serviceName,
String methodName,
HttpHeaders... exampleHttpHeaders)
Adds the example
HttpHeaders for the method with the specified service and method name. |
DocServiceBuilder |
exampleHttpHeaders(String serviceName,
String methodName,
Iterable<? extends HttpHeaders> exampleHttpHeaders)
Adds the example
HttpHeaders 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 |
exclude(DocServiceFilter filter)
Adds the
DocServiceFilter that checks whether a method will be excluded while building
DocService. |
DocServiceBuilder |
include(DocServiceFilter filter)
Adds the
DocServiceFilter that checks whether a method will be included while building
DocService. |
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. |
DocServiceBuilder |
injectedScriptSupplier(BiFunction<ServiceRequestContext,HttpRequest,String> supplier)
Adds a supplier for Javascript scripts to inject into the
<head /> of the debug page HTML. |
@Deprecated public DocServiceBuilder()
DocService.builder().DocServiceBuilder.public DocServiceBuilder exampleHttpHeaders(HttpHeaders... exampleHttpHeaders)
HttpHeaders which are applicable to any services.public DocServiceBuilder exampleHttpHeaders(Iterable<? extends HttpHeaders> exampleHttpHeaders)
HttpHeaders which are applicable to any services.public DocServiceBuilder exampleHttpHeaders(Class<?> serviceType, HttpHeaders... exampleHttpHeaders)
HttpHeaders for the service with the specified type. This method is
a shortcut to:
exampleHttpHeaders(serviceType.getName(), exampleHttpHeaders);
public DocServiceBuilder exampleHttpHeaders(Class<?> serviceType, Iterable<? extends HttpHeaders> exampleHttpHeaders)
HttpHeaders for the service with the specified type. This method is
a shortcut to:
exampleHttpHeaders(serviceType.getName(), exampleHttpHeaders);
public DocServiceBuilder exampleHttpHeaders(String serviceName, HttpHeaders... exampleHttpHeaders)
HttpHeaders for the service with the specified name.public DocServiceBuilder exampleHttpHeaders(String serviceName, Iterable<? extends HttpHeaders> exampleHttpHeaders)
HttpHeaders for the service with the specified name.public DocServiceBuilder exampleHttpHeaders(Class<?> serviceType, String methodName, HttpHeaders... exampleHttpHeaders)
HttpHeaders for the method with the specified type and method name.
This method is a shortcut to:
exampleHttpHeaders(serviceType.getName(), methodName, exampleHttpHeaders);
public DocServiceBuilder exampleHttpHeaders(Class<?> serviceType, String methodName, Iterable<? extends HttpHeaders> exampleHttpHeaders)
HttpHeaders for the method with the specified type and method name.
This method is a shortcut to:
exampleHttpHeaders(serviceType.getName(), methodName, exampleHttpHeaders);
public DocServiceBuilder exampleHttpHeaders(String serviceName, String methodName, HttpHeaders... exampleHttpHeaders)
HttpHeaders for the method with the specified service and method name.public DocServiceBuilder exampleHttpHeaders(String serviceName, String methodName, Iterable<? extends HttpHeaders> exampleHttpHeaders)
HttpHeaders for the method with the specified service and method name.public DocServiceBuilder exampleRequestForMethod(Class<?> serviceType, String methodName, Object... exampleRequests)
exampleRequest(serviceType.getName(), exampleRequests);
public DocServiceBuilder exampleRequestForMethod(Class<?> serviceType, String methodName, Iterable<?> exampleRequests)
exampleRequest(serviceType.getName(), exampleRequests);
public DocServiceBuilder exampleRequestForMethod(String serviceName, String methodName, Object... exampleRequests)
public DocServiceBuilder exampleRequestForMethod(String serviceName, String methodName, Iterable<?> exampleRequests)
public DocServiceBuilder exampleRequest(Object... exampleRequests)
IllegalArgumentException - if failed to get the service and method name from an example requestpublic DocServiceBuilder exampleRequest(Iterable<?> exampleRequests)
IllegalArgumentException - if failed to get the service and method name from an example requestpublic DocServiceBuilder include(DocServiceFilter filter)
DocServiceFilter that checks whether a method will be included while building
DocService. The DocServiceFilter will be invoked with the plugin, service and
method name. The rule is as follows:
include(DocServiceFilter) and exclude(DocServiceFilter) is called -
include all methods.exclude(DocServiceFilter) is called -
include all methods except the methods which the exclusion filter returns true.include(DocServiceFilter) is called -
include the methods which the inclusion filter returns true.include(DocServiceFilter) and exclude(DocServiceFilter) is called -
include the methods which the inclusion filter returns true and the exclusion filter
returns false.Note that this can be called multiple times and the DocServiceFilters are composed using
DocServiceFilter.or(DocServiceFilter) and DocServiceFilter.and(DocServiceFilter).
public DocServiceBuilder exclude(DocServiceFilter filter)
DocServiceFilter that checks whether a method will be excluded while building
DocService. The DocServiceFilter will be invoked with the plugin, service and
method name. The rule is as follows:
include(DocServiceFilter) and exclude(DocServiceFilter) is called -
include all methods.exclude(DocServiceFilter) is called -
include all methods except the methods which the exclusion filter returns true.include(DocServiceFilter) is called -
include the methods which the inclusion filter returns true.include(DocServiceFilter) and exclude(DocServiceFilter) is called -
include the methods which the inclusion filter returns true and the exclusion filter
returns false.Note that this can be called multiple times and the DocServiceFilters are composed using
DocServiceFilter.or(DocServiceFilter) and DocServiceFilter.and(DocServiceFilter).
public DocServiceBuilder injectedScript(String... scripts)
<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' });
});
public DocServiceBuilder injectedScript(Iterable<String> scripts)
<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' });
});
public DocServiceBuilder injectedScriptSupplier(BiFunction<ServiceRequestContext,HttpRequest,String> supplier)
<head /> of the debug page HTML.
The supplier will be called every request for the initial DocService HTML. This can be used to
customize the debug page per-request (e.g., to provide a HeaderProvider for enabling authentication based
on an injected timestamped token). All scripts are concatenated into the content of a single script tag.public DocService build()
DocService based on the properties of this builder.Copyright © 2020 LeanCloud. All rights reserved.