Class ConfigWebApp


  • @RequiredRole("admin")
    public class ConfigWebApp
    extends APIRequestHandler
    Server-side implementation of 'config' web-apps.

    This servlet manages post-installation configuration of annotators, by presenting the given annotator's 'config' web-app, if there is one, and accepting a setConfig request to finalize installation (whether there's a 'config' web-app or not).

    If there's a 'config' web-app, the first request should be to a path structured:
    /api/admin/annotator/config/annotatorId/

    The resulting HTML document will then implement the web-app by requesting resources as required.

    Once ready (or if the annotator implements no 'config' web-app) a request to
    /api/admin/annotator/config/annotatorId/setConfig
    ... with the body of the request representing the annotator configuration, if any.

    The response to the setConfig request will be an HTML document that renders a progress bar, and manages updating progress as the annotator completes its configuration.

    Author:
    Robert Fromont robert@fromont.net.nz
    • Constructor Detail

      • ConfigWebApp

        public ConfigWebApp​(HashMap<String,​nzilbb.ag.automation.util.AnnotatorDescriptor> activeAnnotators)
        Constructor.
    • Method Detail

      • get

        public void get​(String method,
                        String requestURI,
                        String pathInfo,
                        String queryString,
                        UnaryOperator<String> requestHeaders,
                        InputStream requestBody,
                        OutputStream out,
                        Consumer<String> contentTypeConsumer,
                        Consumer<String> contentEncoding,
                        Consumer<Integer> httpStatus)
        GET handler.
        Parameters:
        method - HTTP method of the request.
        requestURI - The URL of the request, excluding the query string.
        pathInfo - The URL path.
        queryString - The URL's query string.
        requestHeaders - Access to HTTP request headers.
        requestBody - Access to the body of the request.
        out - Response body output stream.
        contentTypeConsumer - Receives the content type for specification in the response headers.
        contentEncoding - Receives the character encoding of the recponse.
        httpStatus - Receives the response status code, in case or error.