Package nzilbb.labbcat.server.api
Class Agreement
- java.lang.Object
-
- nzilbb.labbcat.server.api.APIRequestHandler
-
- nzilbb.labbcat.server.api.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
-
-
Field Summary
-
Fields inherited from class nzilbb.labbcat.server.api.APIRequestHandler
SC_BAD_REQUEST, SC_CONFLICT, SC_FORBIDDEN, SC_INTERNAL_SERVER_ERROR, SC_METHOD_NOT_ALLOWED, SC_NOT_FOUND, SC_OK, SC_UNPROCESSABLE_CONTENT, SC_UNSUPPORTED_MEDIA_TYPE
-
-
Constructor Summary
Constructors Constructor Description Agreement()Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete(String pathInfo, Function<String,File> realPath, OutputStream out, Consumer<String> contentType, Consumer<String> contentEncoding, Consumer<Integer> httpStatus)DELETE handler: Delete the HTML document.voidget(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.Stringoptions()OPTIONS handler: specifies what HTML methods are allowed, depending on the user access.voidpost(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.voidput(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-
Methods inherited from class nzilbb.labbcat.server.api.APIRequestHandler
GetSystemAttribute, init, writeResponse
-
-
-
-
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 of 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 of 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 thehttpStatus- Receives the response status code, in case of 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 of error.
-
options
public String options()
OPTIONS handler: specifies what HTML methods are allowed, depending on the user access.
-
-