Class TaskWebApp


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

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

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

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

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

    The response to the setTaskParameters request will be an HTML document for display to the user. However, no further interaction with the user is expected.

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

      • TaskWebApp

        public TaskWebApp​(HashMap<String,​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.