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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Replaces strings matching thesystemLayoutDirectory
with the user's custom layout directory.static String
findLayoutURIIfFileExists
(String uri, String layout, javax.servlet.ServletContext servletContext) static Object
getSessionLock
(javax.servlet.http.HttpSession session) static Properties
loadProperties
(File file) Load properties from a givenFile
object.static Properties
loadProperties
(String path, Properties defaults) Load properties from a givenString
represent the path to the properties file..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 "/".static String
replaceLayout
(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 itsgetRealPath
method, if the path does not start with "/".- Returns:
- A
Properties
object represented by the .properties file.
-
loadProperties
Load properties from a givenFile
object.- Parameters:
file
- TheFile
object.- Returns:
- The properties in the given
File
.
-
loadProperties
Load properties from a givenString
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 thesystemLayoutDirectory
with the user's custom layout directory. If the resulting path doesn't map to an existing file, returns the original string. Used byBaseRequestProcessor
andAppInsertTag
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 thesystemLayoutDirectory
.layout
- The user's custom layout directory.servletContext
- Used to determine if the resulting path maps to an existing file, through thegetRealPath
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
-
replaceLayout
-
getSessionLock
-