/**
   * Runs the named action against the passed document.
   *
   * @param doc
   * @param sActionClass
   * @param iDesignElementType can be either DesignElement.DESIGN_TYPE_ACTION or
   *     DesignElement.DESIGN_TYPE_SCHEDULEDACTION
   * @return an ActionReturn object that the programmer may check to see what the action has done
   */
  public ActionReturn runActionOnDocument(
      HTMLDocument doc, String sActionClass, int iDesignElementType) {
    ActionReturn act_return = null;
    SystemContext SysCtx = null;

    if (sActionClass == null || sActionClass.length() == 0 || doc == null) return null;

    try {
      // ActionClassLoader aLoader= new ActionClassLoader(m_HTTPRM, m_SysCtx, m_SessCtx,
      // doc.rPath.Group, doc.rPath.Application, szActionClass);
      act_return = new ActionReturn();
      SysCtx = (SystemContext) m_SysCtx.clone();
      SessionContext SessCtx = (SessionContext) m_SessCtx.clone(); // ditto with the session
      RequestPath rp = new RequestPath(m_rPath.getFullPath());
      if (doc.rPath != null) rp = doc.rPath;
      HTTPSessionContext HTTPSessCtx = new HTTPSessionContext(m_HTTPRM, SysCtx, SessCtx, rp);
      SharedActionClassLoader aLoader = m_SysCtx.getActionClassLoader(rp); // , iDesignElementType);
      // Class runclass = aLoader.getActionClass();
      Class runclass = aLoader.getActionClass(sActionClass, DesignElement.DESIGN_TYPE_ACTION);
      if (runclass == null) return act_return;
      Object object = runclass.newInstance();
      ActionRunnerInterface act = (ActionRunnerInterface) object;
      act.init(HTTPSessCtx, doc, rp.Group, rp.Application);
      act_return.RedirectTo = act.execute();
      act_return.HasStreamed = act.hasStreamed();
      act_return.bBuffer = act.getByteBuffer();
      act_return.ContentType = act.getContentType();
    } catch (Throwable e) {
      String sPath = sActionClass;
      if (doc != null) sPath = doc.rPath.getFullPath() + " - " + sActionClass;
      m_SysCtx.doError(
          "HTTPRequest.ActionExecuteError", new String[] {sPath, e.toString()}, m_SessCtx);
      Util.logStackTrace(e, m_SysCtx, 99);
    }

    return act_return;
  }
 /**
  * Get the time this session logged in
  *
  * @return the date/time this session logged in to the server
  */
 public java.util.Date getLoginTime() {
   return m_SessCtx.getLoginTime();
 }
 /** @param ur */
 public void addUserRolesObject(UserRoles ur) {
   m_SessCtx.addUserRolesObject(ur);
 }
 /**
  * Determines if this session has the named role in this application!
  *
  * @param sRoleName
  * @return true if the session has the role
  */
 public boolean hasUserRole(String sRoleName) {
   return m_SessCtx.hasUserRole(m_rPath.getPathToApplication(), sRoleName);
 }
 /**
  * Get the UserRoles object for this session for the name application
  *
  * @param sAppPath eg "/group/app.pma"
  * @return the UserRoles object
  */
 public UserRoles getUserRolesObject(String sAppPath) {
   return m_SessCtx.getUserRolesObject(sAppPath);
 }
 /**
  * Clear all the cached roles from this session. This has almost the same effect as logging a user
  * out. The next time an application is accessed the roles for that application will be reapplied
  * to this session
  */
 public void removeAllUserRolesObjects() {
   m_SessCtx.removeAllUserRolesObjects();
 }
 /**
  * Sets the Locale of the current session. If this method is never called or called with a null,
  * the server's default locale will be used
  *
  * @param tz
  */
 public void setLocale(Locale locale) {
   m_SessCtx.setLocale(locale);
 }
 /**
  * Sets the TimeZone of the current session. If this method is never called or called with a null,
  * the server's default zone will be used
  *
  * @param tz
  */
 public void setTimeZone(TimeZone tz) {
   m_SessCtx.setTimeZone(tz);
 }
 /**
  * Get the X500Name of this session
  *
  * @return the X500Name object
  */
 public X500Name getX500Name() {
   return m_SessCtx.getX500Name();
 }
 /**
  * Get the abbreviated X500Name of this session as a String
  *
  * @return the X500Name, eg "Brendon Upson/webWise"
  */
 public String getUserNameAbbreviated() {
   return m_SessCtx.getUserNameAbbreviated();
 }
 /**
  * Get the canonical X500Name of this session as a String
  *
  * @return the X500Name, eg "CN=Brendon Upson/O=webWise"
  */
 public String getUserName() {
   return m_SessCtx.getUserName();
 }
 /**
  * For web clients, this denotes the "User-Agent" http header
  *
  * @return the String value of the type of client being used to access the server
  */
 public String getUserAgent() {
   return m_SessCtx.getUserAgent();
 }
 /**
  * Gets the last date/time of a server request. Can be used to determine the idle state of a
  * session.
  *
  * @return the Date of the last request
  */
 public java.util.Date getLastTransactionTime() {
   return m_SessCtx.getLastTransactionTime();
 }
 /**
  * Determines if this session is logged in. This is determined by the username not being
  * "Anonymous"
  *
  * @return true if the user is not anonymous
  */
 public boolean isLoggedIn() {
   return m_SessCtx.isLoggedIn();
 }
 /**
  * Get the login name used to successfully log in. This is not the X500Name, but the short name
  * the user entered, eg "jsmith"
  *
  * @return the login name eg "jsmith"
  */
 public String getLoginName() {
   return m_SessCtx.getLoginName();
 }
 /**
  * Set the lastname property of this session
  *
  * @param sLastName
  */
 public void setLastName(String sLastName) {
   m_SessCtx.setLastName(sLastName);
 }
 /**
  * Set the username property of this session
  *
  * @param sUserName in X500Format
  */
 public void setUserName(String sUserName) {
   m_SessCtx.setUserName(sUserName);
 }
 /** Reset all the session properties back to their initial (and non-logged in) state. */
 public void clearSession() {
   m_SessCtx.clearSession();
 }
 /**
  * Gets the current sessions timezone setting. A null value denotes the server's default time zone
  * will be used
  *
  * @return
  */
 public TimeZone getTimeZone() {
   return m_SessCtx.getTimeZone();
 }
 /**
  * For network based sessions, return the address of the client
  *
  * @return the address of the connected client
  */
 public InetAddress getInternetAddress() {
   return m_SessCtx.getInternetAddress();
 }
 /**
  * Gets the current sessions Locale setting. A null value denotes the server's default locale will
  * be used
  *
  * @return
  */
 public Locale getLocale() {
   return m_SessCtx.getLocale();
 }
 /**
  * Returns the client's address as a String
  *
  * @return the String value of the connected client's address eg "203.12.33.4"
  */
 public String getHostAddress() {
   return m_SessCtx.getHostAddress();
 }
 /**
  * Remove a specific role for a specific application
  *
  * @param sAppPath eg "/group/app.pma"
  * @param sRoleName eg "Manager"
  */
 public void removeUserRole(String sAppPath, String sRoleName) {
   m_SessCtx.removeUserRole(sAppPath, sRoleName);
 }
 /**
  * Get the internal session id that uniquely designates this session
  *
  * @return the session id
  */
 public String getSessionID() {
   return m_SessCtx.getSessionID();
 }
 /**
  * Determines if this session has the named role in the named application
  *
  * @param sAppPath eg "/group/app.pma"
  * @param sRoleName eg "Manager"
  * @return true if the session has the role
  */
 public boolean hasUserRole(String sAppPath, String sRoleName) {
   return m_SessCtx.hasUserRole(sAppPath, sRoleName);
 }
 /**
  * Get the "Set-Cookie" String for use in a HTTP reply
  *
  * @return the Set-Cookie directive
  */
 public String getCookieString() {
   return m_SessCtx.getCookieString("/", null);
 }
 /**
  * @param sAppPath
  * @return true if the session has the object
  */
 public boolean hasUserRolesObject(String sAppPath) {
   return m_SessCtx.hasUserRolesObject(sAppPath);
 }
 /**
  * Get the "Set-Cookie" String for use in a HTTP reply
  *
  * @param sPath eg "/"
  * @param sDomain eg ".wnc.net.au"
  * @return the Set-Cookie directive
  */
 public String getCookieString(String sPath, String sDomain) {
   return m_SessCtx.getCookieString(sPath, sDomain);
 }
 /**
  * @param sAppPath
  * @param sRoleName
  */
 public void addUserRole(String sAppPath, String sRoleName) {
   m_SessCtx.addUserRole(sAppPath, sRoleName);
 }
 /**
  * Set the firstname property of this session
  *
  * @param sFirstName
  */
 public void setFirstName(String sFirstName) {
   m_SessCtx.setFirstName(sFirstName);
 }