Package nzilbb.labbcat.server.api
Class APIRequestHandler
- java.lang.Object
-
- nzilbb.labbcat.server.api.APIRequestHandler
-
- Direct Known Subclasses:
Agreement
,Annotators
,Attributes
,ConfigWebApp
,Data
,Dictionary
,Doc
,ExtWebApp
,Files
,Fragments
,Graphs
,Password
,Praat
,Results
,Search
,Store
,SystemAttributes
,TableServletBase
,TaskWebApp
,Upload
,User
,Utterances
public class APIRequestHandler extends Object
Base class for request enpoints, which implents common functionality.- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Field Summary
Fields Modifier and Type Field Description static int
SC_BAD_REQUEST
static int
SC_CONFLICT
static int
SC_FORBIDDEN
static int
SC_INTERNAL_SERVER_ERROR
static int
SC_METHOD_NOT_ALLOWED
static int
SC_NOT_FOUND
static int
SC_OK
static int
SC_UNPROCESSABLE_CONTENT
static int
SC_UNSUPPORTED_MEDIA_TYPE
-
Constructor Summary
Constructors Constructor Description APIRequestHandler()
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
GetSystemAttribute(String name, Connection db)
Gets the value of the given system attribute.void
init(APIRequestContext context)
Initialise the endpoint data.void
writeResponse(OutputStream out, javax.json.JsonObject jsonOut)
Write a given JSON response to a given OutputStream.
-
-
-
Field Detail
-
SC_OK
public static final int SC_OK
- See Also:
- Constant Field Values
-
SC_BAD_REQUEST
public static final int SC_BAD_REQUEST
- See Also:
- Constant Field Values
-
SC_FORBIDDEN
public static final int SC_FORBIDDEN
- See Also:
- Constant Field Values
-
SC_NOT_FOUND
public static final int SC_NOT_FOUND
- See Also:
- Constant Field Values
-
SC_METHOD_NOT_ALLOWED
public static final int SC_METHOD_NOT_ALLOWED
- See Also:
- Constant Field Values
-
SC_CONFLICT
public static final int SC_CONFLICT
- See Also:
- Constant Field Values
-
SC_UNSUPPORTED_MEDIA_TYPE
public static final int SC_UNSUPPORTED_MEDIA_TYPE
- See Also:
- Constant Field Values
-
SC_UNPROCESSABLE_CONTENT
public static final int SC_UNPROCESSABLE_CONTENT
- See Also:
- Constant Field Values
-
SC_INTERNAL_SERVER_ERROR
public static final int SC_INTERNAL_SERVER_ERROR
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(APIRequestContext context)
Initialise the endpoint data.
-
GetSystemAttribute
public static String GetSystemAttribute(String name, Connection db) throws SQLException
Gets the value of the given system attribute.- Parameters:
name
-db
-- Returns:
- Value for the given system attribute, or null if it's not set.
- Throws:
SQLException
-
writeResponse
public void writeResponse(OutputStream out, javax.json.JsonObject jsonOut)
Write a given JSON response to a given OutputStream.- Parameters:
out
- Output stream to write to.jsonOut
- JSON object the write.
-
-