Class AppUtils
java.lang.Object
com.softslate.commerce.customer.core.AppUtils
Provides miscellaneous static methods used by various classes in the Struts
layer.
- Author:
- David Tobey
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringReplaces strings matching thesystemLayoutDirectorywith the user's custom layout directory.static StringfindLayoutURIIfFileExists(String uri, String layout, javax.servlet.ServletContext servletContext) static ObjectgetSessionLock(javax.servlet.http.HttpSession session) static PropertiesloadProperties(File file) Load properties from a givenFileobject.static PropertiesloadProperties(String path, Properties defaults) Load properties from a givenStringrepresent the path to the properties file..static PropertiesloadProperties(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 "/".static StringreplaceLayout(String uri, String layout)
-
Field Details
-
log
static org.apache.commons.logging.Log log -
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
- See Also:
-
-
Constructor Details
-
AppUtils
public AppUtils()
-
-
Method Details
-
loadProperties
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 itsgetRealPathmethod, if the path does not start with "/".- Returns:
- A
Propertiesobject represented by the .properties file.
-
loadProperties
Load properties from a givenFileobject.- Parameters:
file- TheFileobject.- Returns:
- The properties in the given
File.
-
loadProperties
Load properties from a givenStringrepresent 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 thesystemLayoutDirectorywith the user's custom layout directory. If the resulting path doesn't map to an existing file, returns the original string. Used byBaseRequestProcessorandAppInsertTagto handle forwards coming from the Struts request. (See the "Creating a Custom Layout" chapter of the User Guide.)- Parameters:
uri- The original uri, containing thesystemLayoutDirectory.layout- The user's custom layout directory.servletContext- Used to determine if the resulting path maps to an existing file, through thegetRealPathmethod.- 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
-
replaceLayout
-
getSessionLock
-