|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.jsp.util.CmsJspElFunctions
public final class CmsJspElFunctions
Provides utility methods to be used as functions from a JSP with the EL.
CmsJspContentAccessBean
Method Summary | |
---|---|
static CmsObject |
convertCmsObject(Object input)
Returns an OpenCms user context created from an Object. |
static Date |
convertDate(Object input)
Returns a Date created from an Object. |
static List<Object> |
convertList(List<Object> input,
String attributeName)
Returns a list of attribute values specified by the attribute name of the items of the given list. |
static Locale |
convertLocale(Object input)
Returns a Locale created from an Object. |
static javax.servlet.ServletRequest |
convertRequest(Object input)
Tries to convert the given input object into a request. |
static CmsResource |
convertResource(CmsObject cms,
Object input)
Returns a resource created from an Object. |
static CmsUUID |
convertUUID(Object input)
Returns a CmsUUID created from an Object. |
static String |
escape(String source,
String encoding)
Encodes a String in a way that is compatible with the JavaScript escape function. |
static CmsObject |
getCmsObject(Object input)
Returns the current OpenCms user context from the given page context. |
static Integer |
getListSize(List<Object> input)
Returns the size of the given list. |
static String |
getNavigationUri(Object input)
Returns the current navigation URI. |
static String |
getRequestLink(String url)
Returns the link without parameters from a String that is formatted for a GET request. |
static String |
getRequestParam(String url,
String paramName)
Returns the value of a parameter from a String that is formatted for a GET request. |
static CmsJspVfsAccessBean |
getVfsAccessBean(Object input)
Returns a JSP / EL VFS access bean. |
static String |
stripHtml(Object input)
Strips all HTML markup from the given input. |
static String |
trimToSize(String input,
int length)
Returns a substring of the source, which is at most length characters long. |
static String |
unescape(String source,
String encoding)
Decodes a String in a way that is compatible with the JavaScript unescape function. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static CmsObject convertCmsObject(Object input)
CmsObject
, it is casted and returned unchanged.
ServletRequest
, the OpenCms user context is read from the request context.
PageContext
, the OpenCms user context is read from the request of the page context.
input
- the input to create an OpenCms user context from
public static Date convertDate(Object input)
Date
already, if so it is casted and returned unchanged.
Long
, and if so the Date is created from the Long value.
input
- the Object to create a Date from
public static List<Object> convertList(List<Object> input, String attributeName)
input
- the list of objects to obtain the attribute values fromattributeName
- the name of the attribute to obtain
public static Locale convertLocale(Object input)
Locale
already, if so it is casted and returned.
input
- the Object to create a Locale from
public static javax.servlet.ServletRequest convertRequest(Object input)
This is only possible if the input object is already a request or if it is a page context.
If everything else, this method returns null
.
input
- the input object to convert to a request
null
public static CmsResource convertResource(CmsObject cms, Object input) throws CmsException
CmsResource
, it is casted to the resource and returned unchanged.
CmsUUID
, the given OpenCms context is used to read a resource with
this UUID from the VFS.
cms
- the current OpenCms user contextinput
- the input to create a resource from
CmsException
- in case of errors accessing the OpenCms VFS for reading the resourcepublic static CmsUUID convertUUID(Object input)
CmsUUID
already, if so it is casted and returned.
CmsUUID
is created with this byte[].
CmsUUID
is created with this String.
input
- the Object to create a CmsUUID from
public static String escape(String source, String encoding)
source
- The text to be encodedencoding
- the encoding type
public static CmsObject getCmsObject(Object input)
input
- the input to create a CmsObject from
public static Integer getListSize(List<Object> input)
input
- the list of objects to obtain the size from
public static String getNavigationUri(Object input)
Which can be the request URI or the VFS resource URI.
In case a sitemap is used, the navigation URI will be the request URI, if not the VFS resource URI is returned.
input
- the request convertible object to get the navigation URI from
public static String getRequestLink(String url)
url
- the URL to remove the parameters from
public static String getRequestParam(String url, String paramName)
url
- the URL to get the parameter value fromparamName
- the request parameter name
public static CmsJspVfsAccessBean getVfsAccessBean(Object input)
input
- the Object to create a CmsObject from
public static String stripHtml(Object input)
CmsJspContentAccessValueWrapper
, an optimized
method is used for the HTML stripping.
input
- the input to Strip from HTML
public static String trimToSize(String input, int length)
If a char is cut, " ..."
is appended to the result.
input
- the string to trimlength
- the maximum length of the string to be returned
CmsStringUtil.trimToSize(String, int, String)
public static String unescape(String source, String encoding)
source
- The String to be decodedencoding
- the encoding type
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |