org.opencms.jsp.util
Class CmsJspElFunctions

java.lang.Object
  extended by org.opencms.jsp.util.CmsJspElFunctions

public final class CmsJspElFunctions
extends java.lang.Object

Provides utility methods to be used as functions from a JSP with the EL.

Since:
7.0.2
Version:
$Revision: 1.9 $
Author:
Alexander Kandzior
See Also:
CmsJspContentAccessBean

Method Summary
static CmsObject convertCmsObject(java.lang.Object input)
          Returns an OpenCms user context created from an Object.
static java.util.Date convertDate(java.lang.Object input)
          Returns a Date created from an Object.
static java.util.Locale convertLocale(java.lang.Object input)
          Returns a Locale created from an Object.
static CmsResource convertResource(CmsObject cms, java.lang.Object input)
          Returns a resource created from an Object.
static CmsUUID convertUUID(java.lang.Object input)
          Returns a CmsUUID created from an Object.
static java.lang.String escape(java.lang.String source, java.lang.String encoding)
          Encodes a String in a way that is compatible with the JavaScript escape function.
static CmsObject getCmsObject(java.lang.Object input)
          Returns the current OpenCms user context from the given page context.
static java.lang.String getRequestLink(java.lang.String url)
          Returns the link without parameters from a String that is formatted for a GET request.
static java.lang.String getRequestParam(java.lang.String url, java.lang.String paramName)
          Returns the value of a parameter from a String that is formatted for a GET request.
static CmsJspVfsAccessBean getVfsAccessBean(java.lang.Object input)
          Returns a JSP / EL VFS access bean.
static java.lang.String stripHtml(java.lang.Object input)
          Strips all HTML markup from the given input.
static java.lang.String trimToSize(java.lang.String input, int length)
          Returns a substring of the source, which is at most length characters long.
static java.lang.String unescape(java.lang.String source, java.lang.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

convertCmsObject

public static CmsObject convertCmsObject(java.lang.Object input)
Returns an OpenCms user context created from an Object.

Parameters:
input - the input to create an OpenCms user context from
Returns:
an OpenCms user context created from an Object

convertDate

public static java.util.Date convertDate(java.lang.Object input)
Returns a Date created from an Object.

Parameters:
input - the Object to create a Date from
Returns:
a Date created from the given Object

convertLocale

public static java.util.Locale convertLocale(java.lang.Object input)
Returns a Locale created from an Object.

Parameters:
input - the Object to create a Locale from
Returns:
a Locale created from the given Object

convertResource

public static CmsResource convertResource(CmsObject cms,
                                          java.lang.Object input)
                                   throws CmsException
Returns a resource created from an Object.

Parameters:
cms - the current OpenCms user context
input - the input to create a resource from
Returns:
a resource created from the given Object
Throws:
CmsException - in case of errors accessing the OpenCms VFS for reading the resource

convertUUID

public static CmsUUID convertUUID(java.lang.Object input)
Returns a CmsUUID created from an Object.

Parameters:
input - the Object to create a CmsUUID from
Returns:
a CmsUUID created from the given Object

escape

public static java.lang.String escape(java.lang.String source,
                                      java.lang.String encoding)
Encodes a String in a way that is compatible with the JavaScript escape function.

Parameters:
source - The text to be encoded
encoding - the encoding type
Returns:
The JavaScript escaped string

getCmsObject

public static CmsObject getCmsObject(java.lang.Object input)
Returns the current OpenCms user context from the given page context.

Parameters:
input - the input to create a CmsObject from
Returns:
the current OpenCms user context from the given page context

getRequestLink

public static java.lang.String getRequestLink(java.lang.String url)
Returns the link without parameters from a String that is formatted for a GET request.

Parameters:
url - the URL to remove the parameters from
Returns:
the link without parameters

getRequestParam

public static java.lang.String getRequestParam(java.lang.String url,
                                               java.lang.String paramName)
Returns the value of a parameter from a String that is formatted for a GET request.

Parameters:
url - the URL to get the parameter value from
paramName - the request parameter name
Returns:
the value of the parameter

getVfsAccessBean

public static CmsJspVfsAccessBean getVfsAccessBean(java.lang.Object input)
Returns a JSP / EL VFS access bean.

Parameters:
input - the Object to create a CmsObject from
Returns:
a JSP / EL VFS access bean

stripHtml

public static java.lang.String stripHtml(java.lang.Object input)
Strips all HTML markup from the given input.

Parameters:
input - the input to Strip from HTML
Returns:
the given input with all HTML stripped.

trimToSize

public static java.lang.String trimToSize(java.lang.String input,
                                          int length)
Returns a substring of the source, which is at most length characters long.

If a char is cut, " ..." is appended to the result.

Parameters:
input - the string to trim
length - the maximum length of the string to be returned
Returns:
a substring of the source, which is at most length characters long
See Also:
CmsStringUtil.trimToSize(String, int, String)

unescape

public static java.lang.String unescape(java.lang.String source,
                                        java.lang.String encoding)
Decodes a String in a way that is compatible with the JavaScript unescape function.

Parameters:
source - The String to be decoded
encoding - the encoding type
Returns:
The JavaScript unescaped String