Class ServletFns
- Author:
- tomyeh
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final StringEncodes a URL with theme key injected.static StringEncodes a URL.static RequestContextReturns the current EL context.static WriterReturns the current output.static jakarta.servlet.ServletRequestReturns the current servlet request, or null if not available.static jakarta.servlet.ServletResponseReturns the current servlet response, or null if not available.static jakarta.servlet.ServletContextReturns the current servlet context, or null if not available.static voidrender(ActionContext ac) Renders the DSP fragment from EL.static final StringresolveThemeURL(String url) Resolves a URL to point to resource served by the current theme.
-
Constructor Details
-
ServletFns
protected ServletFns()
-
-
Method Details
-
encodeURL
Encodes a URL.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.
- Throws:
jakarta.servlet.ServletException
-
encodeThemeURL
Encodes a URL with theme key injected.- Parameters:
s- the string to encode- Returns:
- the encoded string or null if s is null
- Throws:
UnsupportedEncodingExceptionjakarta.servlet.ServletException- Since:
- 6.0.0
-
resolveThemeURL
Resolves a URL to point to resource served by the current theme.- Parameters:
url- the default theme url to resolve- Returns:
- the resolved url or null if url is null
- Since:
- 6.5.2
-
getCurrentContext
Returns the current EL context. -
getCurrentOut
Returns the current output.- Throws:
IOException
-
getCurrentServletContext
public static jakarta.servlet.ServletContext getCurrentServletContext()Returns the current servlet context, or null if not available. -
getCurrentRequest
public static jakarta.servlet.ServletRequest getCurrentRequest()Returns the current servlet request, or null if not available. -
getCurrentResponse
public static jakarta.servlet.ServletResponse getCurrentResponse()Returns the current servlet response, or null if not available. -
render
Renders the DSP fragment from EL.- Parameters:
ac- the action context; never null.- Throws:
DspExceptionIOException
-