Class CommandContext

All Implemented Interfaces:
SecurityContext

public class CommandContext extends HTTPContext
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:
  • Field Details

  • Constructor Details

    • CommandContext

      public CommandContext(HttpServletRequest req, HttpServletResponse rsp)
      Creates a new Command context from an HTTP Servlet Request/Resposne pair.
      Parameters:
      req - the Servlet Request
      rsp - the Servlet Response
  • Method Details

    • release

      public long release()
      Description copied from class: ConnectionContext
      Returns a JDBC Connection to the connection pool.
      Overrides:
      release in class ConnectionContext
      Returns:
      the time the connection was in use, in milliseconds
    • getResult

      public CommandResult getResult()
      Returns the Command Result object.
      Returns:
      the results of the command invocation
    • setMessage

      public void setMessage(String msg)
      Passes a system message into the response.
      Parameters:
      msg - the System Message
    • getID

      public int getID() throws CommandException
      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