Package nzilbb.labbcat.server.api
Interface APIRequestContext
-
public interface APIRequestContextAn 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 Default Methods Modifier and Type Method Description voidcacheNotification(String name)Generates an instance-wide notification that an underlying object has been updated, and cached versions of that object should be flushed.StringgetBaseUrl()Get the base URL for the server.nzilbb.sql.ConnectionFactorygetConnectionFactory()Accesses a database connection factory.StringgetInitParameter(String name)Access the value of an instance-wide named parameter.ResourceBundlegetResourceBundle()Access the localization resources for the correct locale.StringgetServletPath()Get the base parth for the servlet.StringgetTitle()Access the title of the request endpoint.StringgetUser()The ID of the logged-in user.StringgetUserHost()The IP/host name of the user's connection.StringgetVersion()Determine the version of the server software.booleanisUserInRole(String role)Determines whether the logged-in user is in the given role.voidservletLog(String message)Log a message.default voidservletLog(Throwable exception)Log an exception.
-
-
-
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- The message to add to the log.
-
servletLog
default void servletLog(Throwable exception)
Log an exception.- Parameters:
exception- The exception to add a stack-trace of to the log.
-
-