Class DocServiceBuilder

    • Constructor Detail

      • DocServiceBuilder

        public DocServiceBuilder()
    • Method Detail

      • exampleHttpHeaders

        public DocServiceBuilder exampleHttpHeaders​(Class<?> serviceType,
                                                    HttpHeaders... exampleHttpHeaders)
        Adds the example HttpHeaders 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 example HttpHeaders for the service with the specified type. This method is a shortcut to:
        
         exampleHttpHeaders(serviceType.getName(), exampleHttpHeaders);
         
      • exampleHttpHeaders

        public DocServiceBuilder exampleHttpHeaders​(Class<?> serviceType,
                                                    String methodName,
                                                    HttpHeaders... exampleHttpHeaders)
        Adds the example HttpHeaders 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 example HttpHeaders for the method with the specified type and method name. This method is a shortcut to:
        
         exampleHttpHeaders(serviceType.getName(), methodName, exampleHttpHeaders);
         
      • 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-created DocService based on the properties of this builder.