|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.meshcms.core.WebUtils
A collection of utilities related to a web application.
Field Summary | |
static java.util.regex.Pattern |
BODY_REGEX
|
static java.lang.String[] |
DEFAULT_WELCOME_FILES
The default array of welcome file names. |
static java.util.regex.Pattern |
EMAIL_REGEX
|
static java.util.Properties |
ENTITY_TO_NUMBER
|
static java.lang.String |
FN_CHARMAP
Mapping of the ISO-8859-1 characters to characters included in FN_CHARS. |
static java.lang.String |
FN_CHARS
Characters allowed in a file name. |
static java.lang.String |
FN_SPACERS
Characters that are considered spacers in a file name. |
static java.util.regex.Pattern |
HYPERLINK_REGEX
|
static java.util.Properties |
NUMBER_TO_ENTITY
|
static java.text.SimpleDateFormat |
numericDateFormatter
|
static java.util.regex.Pattern |
PRE_BR_REGEX
|
static java.util.regex.Pattern |
PRE_REGEX
|
Method Summary | |
static java.lang.String |
addToQueryString(java.lang.String url,
java.lang.String name,
java.lang.String value,
boolean encodeValue)
|
static java.lang.String |
convertToHTMLEntities(java.lang.String s,
boolean encodeTags)
|
static java.lang.String |
convertToHTMLEntities(java.lang.String s,
java.lang.String charset,
boolean encodeTags)
|
static java.lang.String |
createExcerpt(WebSite webSite,
java.lang.String body,
int length,
java.lang.String contextPath,
Path oldPage,
Path newPage)
|
static java.lang.String |
findEmails(java.lang.String text)
|
static java.lang.String |
findLinks(java.lang.String text,
boolean noFollow)
|
static java.lang.String |
fixFileName(java.lang.String name,
boolean useSpacers)
Returns a modified name that does not contain characters not recommended in a file name. |
static java.lang.String |
fixLinks(WebSite webSite,
java.lang.String body,
java.lang.String contextPath,
Path oldPage,
Path newPage)
|
static java.lang.String |
fixRelativeURLs(java.lang.String html,
Path root,
boolean relative)
|
static java.lang.String |
formatFileLength(long length,
java.util.Locale locale,
java.util.ResourceBundle bundle)
Returns a nicer representation of the number as a file length. |
static java.lang.String |
get2ndLevelDomain(javax.servlet.http.HttpServletRequest request)
Returns the 2nd level domain from which the request comes. |
static java.lang.String |
get2ndLevelDomain(java.lang.String urlString)
Returns the 2nd level domain from the URL. |
static java.lang.String[] |
getAcceptedLanguages(javax.servlet.http.HttpServletRequest request)
|
static java.lang.String |
getAuthCode(javax.servlet.http.HttpSession session,
java.lang.String page)
|
static java.io.File |
getCacheFile(WebSite webSite,
SiteMap siteMap,
Path pagePath)
|
static java.lang.String |
getCharsetCanonicalName(java.lang.String charsetName)
|
static java.lang.StringBuffer |
getContextHomeURL(javax.servlet.http.HttpServletRequest request)
Reconstructs the full URL of the context home. |
static Path |
getCorrespondingPath(WebSite webSite,
Path path,
java.lang.String otherRoot)
|
static java.lang.String |
getFullMeshCSS(WebSite webSite,
javax.servlet.http.HttpServletRequest request)
Returns the complete path of the meshcms.css file (context
path included). |
static java.lang.String |
getFullParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String name)
Returns a request parameter in the form &name=value . |
static java.lang.String |
getFullThemeCSS(javax.servlet.http.HttpServletRequest request)
Returns the complete path of the main.css file (context
path included). |
static java.lang.String |
getFullThemeFile(javax.servlet.http.HttpServletRequest request)
Returns the complete path of the main.jsp file (context
path included). |
static java.lang.String |
getFullThemeFolder(javax.servlet.http.HttpServletRequest request)
Returns the complete path of the folder of current theme (context path included). |
static java.util.regex.Pattern |
getJSPBlockPattern()
|
static long |
getLastModifiedTime(javax.servlet.http.HttpServletRequest request)
|
static javax.mail.Session |
getMailSession(WebSite webSite)
|
static int |
getMenuCode(java.lang.Object o)
Returns a numeric code for an object. |
static Path |
getMeshCSSPath(WebSite webSite,
javax.servlet.http.HttpServletRequest request,
Path pageDir)
Returns the path of the meshcms.css file, relative to page
path. |
static java.util.Locale |
getPageLocale(javax.servlet.jsp.PageContext pageContext)
Tries to locate a Locale stored in the Page scope or in the Request scope. |
static java.util.ResourceBundle |
getPageResourceBundle(javax.servlet.jsp.PageContext pageContext)
Tries to locate a ResourceBundle stored in the Page scope or in the Request scope using the JSTL. |
static java.lang.String |
getPathInContext(javax.servlet.http.HttpServletRequest request,
Path path)
Returns the full context path of the given path. |
static Path |
getThemeCSSPath(javax.servlet.http.HttpServletRequest request,
Path pageDir)
Returns the complete path of the main.css file, relative to
page path. |
static Path |
getThemeFilePath(javax.servlet.http.HttpServletRequest request,
Path pageDir)
Returns the path of the main.jsp file, relative to page path. |
static Path |
getThemeFolderPath(javax.servlet.http.HttpServletRequest request,
Path pageDir)
Returns the path of the folder of current theme, relative to page path. |
static java.lang.String[] |
getWelcomeFiles(javax.servlet.ServletContext sc)
Parses the web.xml configuration file and returns an array of welcome file names. |
static boolean |
isCacheBlocked(javax.servlet.http.HttpServletRequest request)
Checks the current Request scope to see if some class has called the setBlockCache(javax.servlet.http.HttpServletRequest) method. |
static boolean |
isCached(WebSite webSite,
SiteMap siteMap,
Path pagePath)
|
static java.lang.String |
parseCharset(java.lang.String fullValue)
|
static void |
removeFromCache(WebSite webSite,
SiteMap siteMap,
Path pagePath)
|
static java.lang.String |
replaceThumbnails(WebSite webSite,
java.lang.String body,
java.lang.String contextPath,
Path pagePath)
|
static java.lang.String |
setAuthCode(javax.servlet.http.HttpSession session,
java.lang.String page)
|
static void |
setBlockCache(javax.servlet.http.HttpServletRequest request)
This method must be called to avoid the current page to be cached. |
static java.lang.String |
tidyHTML(WebSite webSite,
java.lang.String html)
|
static void |
updateLastModifiedTime(javax.servlet.http.HttpServletRequest request,
java.io.File file)
|
static void |
updateLastModifiedTime(javax.servlet.http.HttpServletRequest request,
long time)
|
static boolean |
verifyJSP(WebSite webSite,
Path jspPath)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.text.SimpleDateFormat numericDateFormatter
public static final java.lang.String FN_CHARS
public static final java.lang.String FN_CHARMAP
public static final java.lang.String FN_SPACERS
public static final java.lang.String[] DEFAULT_WELCOME_FILES
public static java.util.Properties NUMBER_TO_ENTITY
public static java.util.Properties ENTITY_TO_NUMBER
public static final java.util.regex.Pattern BODY_REGEX
public static final java.util.regex.Pattern PRE_REGEX
public static final java.util.regex.Pattern PRE_BR_REGEX
public static final java.util.regex.Pattern HYPERLINK_REGEX
public static final java.util.regex.Pattern EMAIL_REGEX
Method Detail |
public static java.lang.String convertToHTMLEntities(java.lang.String s, boolean encodeTags)
public static java.lang.String convertToHTMLEntities(java.lang.String s, java.lang.String charset, boolean encodeTags)
public static java.lang.String[] getWelcomeFiles(javax.servlet.ServletContext sc)
DEFAULT_WELCOME_FILES
is
returned.
sc
- ServletContext required to access the web.xml
file
public static java.lang.String getFullParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name)
&name=value
. Returns
null if the value has not been found.
public static java.lang.String getPathInContext(javax.servlet.http.HttpServletRequest request, Path path)
public static java.lang.StringBuffer getContextHomeURL(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getFullThemeFolder(javax.servlet.http.HttpServletRequest request)
request
- used to get the theme namepublic static java.lang.String getFullThemeFile(javax.servlet.http.HttpServletRequest request)
main.jsp
file (context
path included).
request
- used to get the theme namepublic static java.lang.String getFullThemeCSS(javax.servlet.http.HttpServletRequest request)
main.css
file (context
path included).
request
- used to get the theme namepublic static java.lang.String getFullMeshCSS(WebSite webSite, javax.servlet.http.HttpServletRequest request)
meshcms.css
file (context
path included). If meshcms.css
is not found in the theme
folder, the default from the admin theme is returned.
request
- used to get the theme namepublic static Path getThemeFolderPath(javax.servlet.http.HttpServletRequest request, Path pageDir)
request
- used to get the theme namepageDir
- path of the requested page folderpublic static Path getThemeFilePath(javax.servlet.http.HttpServletRequest request, Path pageDir)
main.jsp
file, relative to page path.
request
- used to get the theme namepageDir
- path of the requested page folderpublic static Path getThemeCSSPath(javax.servlet.http.HttpServletRequest request, Path pageDir)
main.css
file, relative to
page path.
request
- used to get the theme namepageDir
- path of the requested page folderpublic static Path getMeshCSSPath(WebSite webSite, javax.servlet.http.HttpServletRequest request, Path pageDir)
meshcms.css
file, relative to page
path. If meshcms.css
is not found in the theme
folder, the default from the admin theme is returned.
request
- used to get the theme namepageDir
- path of the requested page folderpublic static int getMenuCode(java.lang.Object o)
public static java.lang.String get2ndLevelDomain(javax.servlet.http.HttpServletRequest request)
public static java.lang.String get2ndLevelDomain(java.lang.String urlString)
public static void setBlockCache(javax.servlet.http.HttpServletRequest request)
public static boolean isCacheBlocked(javax.servlet.http.HttpServletRequest request)
setBlockCache(javax.servlet.http.HttpServletRequest)
method.
public static java.util.Locale getPageLocale(javax.servlet.jsp.PageContext pageContext)
public static java.util.ResourceBundle getPageResourceBundle(javax.servlet.jsp.PageContext pageContext)
public static java.lang.String fixFileName(java.lang.String name, boolean useSpacers)
public static java.lang.String formatFileLength(long length, java.util.Locale locale, java.util.ResourceBundle bundle)
public static java.lang.String getCharsetCanonicalName(java.lang.String charsetName)
public static java.lang.String parseCharset(java.lang.String fullValue)
public static void updateLastModifiedTime(javax.servlet.http.HttpServletRequest request, java.io.File file)
public static void updateLastModifiedTime(javax.servlet.http.HttpServletRequest request, long time)
public static long getLastModifiedTime(javax.servlet.http.HttpServletRequest request)
public static javax.mail.Session getMailSession(WebSite webSite)
public static java.io.File getCacheFile(WebSite webSite, SiteMap siteMap, Path pagePath)
public static boolean isCached(WebSite webSite, SiteMap siteMap, Path pagePath)
public static void removeFromCache(WebSite webSite, SiteMap siteMap, Path pagePath)
public static Path getCorrespondingPath(WebSite webSite, Path path, java.lang.String otherRoot)
public static java.lang.String[] getAcceptedLanguages(javax.servlet.http.HttpServletRequest request)
public static java.lang.String fixRelativeURLs(java.lang.String html, Path root, boolean relative)
public static java.util.regex.Pattern getJSPBlockPattern()
public static boolean verifyJSP(WebSite webSite, Path jspPath)
public static java.lang.String tidyHTML(WebSite webSite, java.lang.String html)
public static java.lang.String createExcerpt(WebSite webSite, java.lang.String body, int length, java.lang.String contextPath, Path oldPage, Path newPage)
public static java.lang.String fixLinks(WebSite webSite, java.lang.String body, java.lang.String contextPath, Path oldPage, Path newPage)
public static java.lang.String replaceThumbnails(WebSite webSite, java.lang.String body, java.lang.String contextPath, Path pagePath)
public static java.lang.String addToQueryString(java.lang.String url, java.lang.String name, java.lang.String value, boolean encodeValue)
public static java.lang.String findLinks(java.lang.String text, boolean noFollow)
public static java.lang.String findEmails(java.lang.String text)
public static java.lang.String setAuthCode(javax.servlet.http.HttpSession session, java.lang.String page)
public static java.lang.String getAuthCode(javax.servlet.http.HttpSession session, java.lang.String page)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |