Class AppUtils

java.lang.Object
com.softslate.commerce.customer.core.AppUtils

public class AppUtils extends Object
Provides miscellaneous static methods used by various classes in the Struts layer.
Author:
David Tobey
  • Field Details

    • log

      static org.apache.commons.logging.Log log
    • systemLayoutDirectory

      public static final String systemLayoutDirectory
      The name of the directory under the "/WEB-INF/layouts" directory in the application where the system's default JSP templates reside. (See the "Creating a Custom Layout" chapter of the User Guide.)
      See Also:
    • APP_SESSION_LOCK_ATTRIBUTE_NAME

      public static final String APP_SESSION_LOCK_ATTRIBUTE_NAME
      See Also:
  • Constructor Details

    • AppUtils

      public AppUtils()
  • Method Details

    • loadProperties

      public static Properties loadProperties(String path, javax.servlet.ServletContext servletContext)
      Load properties from a path to a .properties file in the form of "some/package/settings.properties" represented by the argument, or "/full/server/path/settings.properties" for a path outside the web application starting with "/".
      Parameters:
      path - The path to a .properties file under the application's classpath, or a full path on the server starting with "/".
      servletContext - Used to locate the .properties file through its getRealPath method, if the path does not start with "/".
      Returns:
      A Properties object represented by the .properties file.
    • loadProperties

      public static Properties loadProperties(File file)
      Load properties from a given File object.
      Parameters:
      file - The File object.
      Returns:
      The properties in the given File.
    • loadProperties

      public static Properties loadProperties(String path, Properties defaults)
      Load properties from a given String represent the path to the properties file..
      Parameters:
      path - The path to the properties file.
      Returns:
      The properties in the file.
    • alterURI

      public static String alterURI(String uri, String layout, javax.servlet.ServletContext servletContext)
      Replaces strings matching the systemLayoutDirectory with the user's custom layout directory. If the resulting path doesn't map to an existing file, returns the original string. Used by BaseRequestProcessor and AppInsertTag to handle forwards coming from the Struts request. (See the "Creating a Custom Layout" chapter of the User Guide.)
      Parameters:
      uri - The original uri, containing the systemLayoutDirectory.
      layout - The user's custom layout directory.
      servletContext - Used to determine if the resulting path maps to an existing file, through the getRealPath method.
      Returns:
      A new uri mapping to the custom path to a file under the user's custom directory, or the original uri, if the new one does not exist.
    • findLayoutURIIfFileExists

      public static String findLayoutURIIfFileExists(String uri, String layout, javax.servlet.ServletContext servletContext)
    • replaceLayout

      public static String replaceLayout(String uri, String layout)
    • getSessionLock

      public static Object getSessionLock(javax.servlet.http.HttpSession session)