Class CommandContext
java.lang.Object
org.deltava.jdbc.ConnectionContext
org.deltava.commands.HTTPContext
org.deltava.commands.CommandContext
- All Implemented Interfaces:
SecurityContext
A class for storing run-time data needed for Command invocations. This class handles reserving and releasing JDBC
Connections, since by doing so we can easily return connections back to the pool in a finally block without
nasty scope issues.
- Since:
- 1.0
- Version:
- 11.2
- Author:
- Luke
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.deltava.jdbc.ConnectionContext
ConnectionContext.ConnectionPoolException -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class org.deltava.commands.HTTPContext
_req, _rsp, ADDRINFO_ATTR_NAME, CAPTCHA_ATTR_NAME, CSP_ATTR_NAME, HTTPCTXT_ATTR_NAME, RTLIMIT_ATTR_NAME, SU_ATTR_NAME, USER_ATTR_NAME, USERAGENT_ATTR_NAME -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Command context from an HTTP Servlet Request/Resposne pair. -
Method Summary
Modifier and TypeMethodDescriptionintgetID()Returns a document ID as an integer.Returns the Command Result object.longrelease()Returns a JDBC Connection to the connection pool.voidsetMessage(String msg) Passes a system message into the response.Methods inherited from class org.deltava.commands.HTTPContext
addCookie, getCmdParameter, getCookie, getFile, getParameter, getParameters, getParameters, getRequest, getResponse, getRoles, getSession, getUser, isAuthenticated, isSuperUser, isUserInRole, passedCAPTCHA, setAttribute, setExpiry, setHeader, setHeader, setUserMethods inherited from class org.deltava.jdbc.ConnectionContext
commitTX, getConnection, getDB, hasConnection, rollbackTX, setDB, startTX
-
Field Details
-
AUTH_COOKIE_NAME
- See Also:
-
USRLISTENER_ATTR_NAME
- See Also:
-
INVALIDREQ_ATTR_NAME
- See Also:
-
SYSMSG_ATTR_NAME
- See Also:
-
-
Constructor Details
-
CommandContext
Creates a new Command context from an HTTP Servlet Request/Resposne pair.- Parameters:
req- the Servlet Requestrsp- the Servlet Response
-
-
Method Details
-
release
public long release()Description copied from class:ConnectionContextReturns a JDBC Connection to the connection pool.- Overrides:
releasein classConnectionContext- Returns:
- the time the connection was in use, in milliseconds
-
getResult
Returns the Command Result object.- Returns:
- the results of the command invocation
-
setMessage
Passes a system message into the response.- Parameters:
msg- the System Message
-
getID
Returns a document ID as an integer.- Returns:
- the datbase ID, or 0 if not found
- Throws:
CommandException- if the ID cannot be parsed into a number
-