Class Agreement


  • public class Agreement
    extends APIRequestHandler
    Provides CRUD operations for the agreement.html file, which is the license agreement that users agree to the first time they log in.
    Author:
    Robert Fromont robert@fromont.net.nz
    • Constructor Detail

      • Agreement

        public Agreement()
        Constructor
    • Method Detail

      • get

        public void get​(String pathInfo,
                        Function<String,​File> realPath,
                        OutputStream out,
                        Consumer<Long> expiresHeader,
                        Consumer<String> contentType,
                        Consumer<String> contentEncoding,
                        Consumer<Integer> httpStatus)
        GET handler: Return the given HTML document, or a blank template if it doesn't exist yet.

        If the Accept request header includes "application/json", then the response is a JSON-encoded representation of the existing file/directory structure for this document, including peers, ancestors, and ancestor peers. This allows the wysiwiki page to present a navigation tree to the user.

        Parameters:
        pathInfo - The URL path.
        realPath - Function for translating an absolute URL path into a File.
        out - Response body output stream.
        contentType - Receives the content type for specification in the response headers.
        contentEncoding - Receives content character encoding for specification in the response headers.
        httpStatus - Receives the response status code, in case or error.
      • put

        public void put​(String pathInfo,
                        Function<String,​File> realPath,
                        InputStream requestBody,
                        OutputStream out,
                        Consumer<String> contentType,
                        Consumer<String> contentEncoding,
                        Consumer<Integer> httpStatus)
        PUT handler: Adds or updates the HTML document
        Parameters:
        pathInfo - The URL path.
        realPath - Function for translating an absolute URL path into a File.
        requestBody - Stream supplying the body of the request.
        out - Stream for writing the response.
        contentType - Consumer for receiving the output content type..
        contentEncoding - Receives content character encoding for specification in the response headers.
        httpStatus - Receives the response status code, in case or error.
      • delete

        public void delete​(String pathInfo,
                           Function<String,​File> realPath,
                           OutputStream out,
                           Consumer<String> contentType,
                           Consumer<String> contentEncoding,
                           Consumer<Integer> httpStatus)
        DELETE handler: Delete the HTML document.
        Parameters:
        pathInfo - The URL path.
        realPath - Function for translating an absolute URL path into a File.
        out - Response body output stream.
        contentType - Receives the content type for specification in the response headers.
        contentEncoding - Receives content character encoding for specification in the
        httpStatus - Receives the response status code, in case or error.
      • post

        public void post​(String pathInfo,
                         Function<String,​File> realPath,
                         RequestParameters parameters,
                         OutputStream out,
                         Consumer<String> contentType,
                         Consumer<String> contentEncoding,
                         Consumer<Integer> httpStatus)
        POST handler: for saving images and other assets.
        Parameters:
        pathInfo - The URL path.
        realPath - Function for translating an absolute URL path into a File.
        parameters - Request parameter map.
        out - Stream for writing the response.
        contentType - Consumer for receiving the output content type..
        contentEncoding - Receives content character encoding for specification in the response headers.
        httpStatus - Receives the response status code, in case or error.
      • options

        public String options()
        OPTIONS handler: specifies what HTML methods are allowed, depending on the user access.