예제 #1
0
  /**
   * 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;
  }
예제 #2
0
 /**
  * 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();
 }
예제 #3
0
 /** @param ur */
 public void addUserRolesObject(UserRoles ur) {
   m_SessCtx.addUserRolesObject(ur);
 }
예제 #4
0
 /**
  * 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);
 }
예제 #5
0
 /**
  * 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);
 }
예제 #6
0
 /**
  * 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();
 }
예제 #7
0
 /**
  * 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);
 }
예제 #8
0
 /**
  * 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);
 }
예제 #9
0
 /**
  * Get the X500Name of this session
  *
  * @return the X500Name object
  */
 public X500Name getX500Name() {
   return m_SessCtx.getX500Name();
 }
예제 #10
0
 /**
  * Get the abbreviated X500Name of this session as a String
  *
  * @return the X500Name, eg "Brendon Upson/webWise"
  */
 public String getUserNameAbbreviated() {
   return m_SessCtx.getUserNameAbbreviated();
 }
예제 #11
0
 /**
  * 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();
 }
예제 #12
0
 /**
  * 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();
 }
예제 #13
0
 /**
  * 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();
 }
예제 #14
0
 /**
  * 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();
 }
예제 #15
0
 /**
  * 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();
 }
예제 #16
0
 /**
  * Set the lastname property of this session
  *
  * @param sLastName
  */
 public void setLastName(String sLastName) {
   m_SessCtx.setLastName(sLastName);
 }
예제 #17
0
 /**
  * Set the username property of this session
  *
  * @param sUserName in X500Format
  */
 public void setUserName(String sUserName) {
   m_SessCtx.setUserName(sUserName);
 }
예제 #18
0
 /** Reset all the session properties back to their initial (and non-logged in) state. */
 public void clearSession() {
   m_SessCtx.clearSession();
 }
예제 #19
0
 /**
  * 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();
 }
예제 #20
0
 /**
  * For network based sessions, return the address of the client
  *
  * @return the address of the connected client
  */
 public InetAddress getInternetAddress() {
   return m_SessCtx.getInternetAddress();
 }
예제 #21
0
 /**
  * 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();
 }
예제 #22
0
 /**
  * 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();
 }
예제 #23
0
 /**
  * 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);
 }
예제 #24
0
 /**
  * Get the internal session id that uniquely designates this session
  *
  * @return the session id
  */
 public String getSessionID() {
   return m_SessCtx.getSessionID();
 }
예제 #25
0
 /**
  * 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);
 }
예제 #26
0
 /**
  * Get the "Set-Cookie" String for use in a HTTP reply
  *
  * @return the Set-Cookie directive
  */
 public String getCookieString() {
   return m_SessCtx.getCookieString("/", null);
 }
예제 #27
0
 /**
  * @param sAppPath
  * @return true if the session has the object
  */
 public boolean hasUserRolesObject(String sAppPath) {
   return m_SessCtx.hasUserRolesObject(sAppPath);
 }
예제 #28
0
 /**
  * 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);
 }
예제 #29
0
 /**
  * @param sAppPath
  * @param sRoleName
  */
 public void addUserRole(String sAppPath, String sRoleName) {
   m_SessCtx.addUserRole(sAppPath, sRoleName);
 }
예제 #30
0
 /**
  * Set the firstname property of this session
  *
  * @param sFirstName
  */
 public void setFirstName(String sFirstName) {
   m_SessCtx.setFirstName(sFirstName);
 }