public class ServletFns extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
ServletFns() |
| Modifier and Type | Method and Description |
|---|---|
static String |
encodeThemeURL(String s)
Encodes a URL with theme key injected.
|
static String |
encodeURL(String uri)
Encodes a URL.
|
static RequestContext |
getCurrentContext()
Returns the current EL context.
|
static Writer |
getCurrentOut()
Returns the current output.
|
static javax.servlet.ServletRequest |
getCurrentRequest()
Returns the current servlet request, or null if not available.
|
static javax.servlet.ServletResponse |
getCurrentResponse()
Returns the current servlet response, or null if not available.
|
static javax.servlet.ServletContext |
getCurrentServletContext()
Returns the current servlet context, or null if not available.
|
static boolean |
isBrowser(String type)
Deprecated.
As of release 6.0.0, replaced with
Servlets.getBrowser(javax.servlet.ServletRequest, java.lang.String). |
static boolean |
isExplorer()
Deprecated.
As of release 6.0.0, replaced with
Servlets.getBrowser(javax.servlet.ServletRequest, java.lang.String). |
static boolean |
isExplorer7()
Deprecated.
As of release 6.0.0, replaced with
Servlets.getBrowser(javax.servlet.ServletRequest, java.lang.String). |
static boolean |
isGecko()
Deprecated.
As of release 6.0.0, replaced with
Servlets.getBrowser(javax.servlet.ServletRequest, java.lang.String). |
static boolean |
isGecko3()
Deprecated.
As of release 6.0.0, replaced with
Servlets.getBrowser(javax.servlet.ServletRequest, java.lang.String). |
static boolean |
isOpera()
Deprecated.
As of release 6.0.0, replaced with
Servlets.getBrowser(javax.servlet.ServletRequest, java.lang.String). |
static boolean |
isSafari()
Deprecated.
As of release 6.0.0, replaced with
Servlets.getBrowser(javax.servlet.ServletRequest, java.lang.String). |
static void |
render(ActionContext ac)
Renders the DSP fragment from EL.
|
static String |
resolveThemeURL(String url)
Resolves a URL to point to resource served by the current theme.
|
public static String encodeURL(String uri) throws javax.servlet.ServletException
If an URI contains "*", it will be replaced with a proper Locale. For example, if the current Locale is zh_TW and the resource is named "ab*.cd", then it searches "ab_zh_TW.cd", "ab_zh.cd" and then "ab.cd", until any of them is found.
Note: "*" must be right before ".", or the last character. For example, "ab*.cd" and "ab*" are both correct, while "ab*cd" and "ab*\/cd" are ignored.
If an URI contains two "*", the first "*" will be replaced with a browser code and the second with a proper locale. The browser code depends on what browser the user are used to visit the web site. Currently, the code for Internet Explorer is "ie", Safari is "saf", Opera is "opr" and all others are "moz". Thus, in the above example, if the resource is named "ab**.cd" and Firefox is used, then it searches "abmoz_zh_TW.cd", "abmoz_zh.cd" and then "abmoz.cd", until any of them is found.
javax.servlet.ServletExceptionpublic static final String encodeThemeURL(String s) throws javax.servlet.ServletException
s - the string to encodeUnsupportedEncodingExceptionjavax.servlet.ServletExceptionpublic static final String resolveThemeURL(String url)
url - the default theme url to resolvepublic static boolean isBrowser(String type)
Servlets.getBrowser(javax.servlet.ServletRequest, java.lang.String).type - the type of the browser.
The syntax: <browser-name>[<version-number>];[-].ie9 means Internet Explorer 9 and later, while
ie6- means Internet Explorer 6 (not prior, nor later).public static boolean isExplorer()
Servlets.getBrowser(javax.servlet.ServletRequest, java.lang.String).public static boolean isExplorer7()
Servlets.getBrowser(javax.servlet.ServletRequest, java.lang.String).public static boolean isGecko()
Servlets.getBrowser(javax.servlet.ServletRequest, java.lang.String).public static boolean isGecko3()
Servlets.getBrowser(javax.servlet.ServletRequest, java.lang.String).public static boolean isSafari()
Servlets.getBrowser(javax.servlet.ServletRequest, java.lang.String).public static boolean isOpera()
Servlets.getBrowser(javax.servlet.ServletRequest, java.lang.String).public static RequestContext getCurrentContext()
public static Writer getCurrentOut() throws IOException
IOExceptionpublic static javax.servlet.ServletContext getCurrentServletContext()
public static javax.servlet.ServletRequest getCurrentRequest()
public static javax.servlet.ServletResponse getCurrentResponse()
public static void render(ActionContext ac) throws DspException, IOException
ac - the action context; never null.DspExceptionIOExceptionCopyright © 2022. All rights reserved.