com.softslate.commerce.customer.core
Class AppUtils

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

public class AppUtils
extends java.lang.Object

Provides miscellaneous static methods used by various classes in the Struts layer.

Author:
David Tobey

Field Summary
(package private) static org.apache.commons.logging.Log log
           
static java.lang.String systemLayoutDirectory
          The name of the directory under the "/WEB-INF/layouts" directory in the application where the system's default JSP templates reside.
 
Constructor Summary
AppUtils()
           
 
Method Summary
static java.lang.String alterURI(java.lang.String uri, java.lang.String layout, javax.servlet.ServletContext servletContext)
          Replaces strings matching the systemLayoutDirectory with the user's custom layout directory.
static java.util.Properties loadProperties(java.io.File file)
          Load properties from a given File object.
static java.util.Properties loadProperties(java.lang.String path, java.util.Properties defaults)
          Load properties from a given String represent the path to the properties file..
static java.util.Properties loadProperties(java.lang.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.
static java.lang.String replaceLayout(java.lang.String uri, java.lang.String layout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

static org.apache.commons.logging.Log log

systemLayoutDirectory

public static final java.lang.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:
Constant Field Values
Constructor Detail

AppUtils

public AppUtils()
Method Detail

loadProperties

public static java.util.Properties loadProperties(java.lang.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.

Parameters:
path - The path to a .properties file under the application's classpath.
servletContext - Used to locate the .properties file through its getRealPath method.
Returns:
A Properties object represented by the .properties file.

loadProperties

public static java.util.Properties loadProperties(java.io.File file)
Load properties from a given File object.

Parameters:
file - The File object.
Returns:
The properties in the given File.

loadProperties

public static java.util.Properties loadProperties(java.lang.String path,
                                                  java.util.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 java.lang.String alterURI(java.lang.String uri,
                                        java.lang.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.

replaceLayout

public static java.lang.String replaceLayout(java.lang.String uri,
                                             java.lang.String layout)


Copyright © SoftSlate, LLC 2003–2005