Package nzilbb.labbcat.server.api
Interface APIRequestContext
-
public interface APIRequestContext
An object that can answer questions about the context of a request, for example the user, configuration parameters, etc.- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
cacheNotification(String name)
Generates an instance-wide notification that an underlying object has been updated, and cached versions of that object should be flushed.String
getBaseUrl()
Get the base URL for the server.nzilbb.sql.ConnectionFactory
getConnectionFactory()
Accesses a database connection factory.String
getInitParameter(String name)
Access the value of an instance-wide named parameter.ResourceBundle
getResourceBundle()
Access the localization resources for the correct locale.String
getServletPath()
Get the base parth for the servlet.String
getTitle()
Access the title of the request endpoint.String
getUser()
The ID of the logged-in user.String
getUserHost()
The IP/host name of the user's connection.String
getVersion()
Determine the version of the server software.boolean
isUserInRole(String role)
Determines whether the logged-in user is in the given role.void
servletLog(String message)
Log a message.
-
-
-
Method Detail
-
getTitle
String getTitle()
Access the title of the request endpoint.- Returns:
- The title of the endpoint.
-
getVersion
String getVersion()
Determine the version of the server software.- Returns:
- The server version.
-
getBaseUrl
String getBaseUrl()
Get the base URL for the server.- Returns:
- The base URL for the server, or null if it can't be determined.
-
getServletPath
String getServletPath()
Get the base parth for the servlet.- Returns:
- Get the base parth for the servlet, or null if it can't be determined.
-
getUser
String getUser()
The ID of the logged-in user.- Returns:
- The ID of the logged-in user, on null if no user is logged in.
-
getUserHost
String getUserHost()
The IP/host name of the user's connection.- Returns:
- The IP/host name of the user's connection, or null if not available.
-
isUserInRole
boolean isUserInRole(String role)
Determines whether the logged-in user is in the given role.- Parameters:
role
- The desired role.- Returns:
- true if the user is in the given role, false otherwise.
-
getInitParameter
String getInitParameter(String name)
Access the value of an instance-wide named parameter.- Parameters:
name
- The name of the parameter.- Returns:
- The value of the named parameter.
-
cacheNotification
void cacheNotification(String name)
Generates an instance-wide notification that an underlying object has been updated, and cached versions of that object should be flushed.- Parameters:
name
- Name of the object that has been updated.
-
getResourceBundle
ResourceBundle getResourceBundle()
Access the localization resources for the correct locale.- Returns:
- The localization resources for the correct local.
-
getConnectionFactory
nzilbb.sql.ConnectionFactory getConnectionFactory()
Accesses a database connection factory.- Returns:
- An object that can provide database connections.
-
servletLog
void servletLog(String message)
Log a message.- Parameters:
message
-
-
-