com.jalios.jcms.context
Class JcmsJspContext

java.lang.Object
  extended by com.jalios.jcms.context.JcmsContext
      extended by com.jalios.jcms.context.JcmsJspContext
All Implemented Interfaces:
JcmsConstants, JaliosConstants
Direct Known Subclasses:
CaddyPopinHandler, JcmsFormHandler, MediaBrowserHandler

public class JcmsJspContext
extends JcmsContext

This class allows you to keep track of variables declare and initialiazed by JCMS.

You can either :

1. Use the one declared in request attributes with :
JcmsJspContext jspCtx = request.getAttribute("jcmsContext")

2. Instanciante a new one with :
JcmsJspContext jspCtx = new JcmsJspContext(pageContext)

3. create your own bean/handler classes by extending this class.

In your class:

 package custom;

 public class HelloUser extends com.jalios.jcms.JcmsPageContext {
   private static final Logger logger = Logger.getLogger(HelloUser.class);
   public doHelloUser() throws java.io.IOException {
     logger.debug("doHelloUser()");
     if (isLogged) {
       out.println(glp("myhello.welcome-msg", loggedMember.getFriendlyName()));
     } else {
       out.println(glp("myhello.welcome-guest-msg"));
     }
   }
 }
 

Declare your class as JavaBean in your JSP with the pageContext param set:
 <%@ include file="/doInitPage.jsp" %>
 
 <jsp:useBean id="welcomeUserBean" scope="page" class="custom.WelcomeUser">
   <jsp:setProperty name="welcomeUserBean" property="pageContext" value="<%= pageContext %>"/>
 </jsp:useBean>
 <% welcomeUserBean.doHelloUser(); %>
 

Since:
jcms-5.0.0
Version:
$Revision: 29979 $
Author:
Olivier Jaquemet

Field Summary
static String AJAX_REQUEST_ATTRIBUTES
           
static String BODY_HEADER
           
static String CSS_HEADER
           
static LinkedHashMap<String,String> cssboMap
           
static LinkedHashMap<String,String> cssfoMap
           
static String CUSTOM_HEADER
           
protected  boolean editIcon
           
static String HTTPEQUIV_HEADER
           
static LinkedHashMap<String,String> httpequivMap
           
static String HTTPNAME_HEADER
           
static LinkedHashMap<String,String> httpnameMap
           
protected  boolean initEditIcon
           
static String JAVASCRIPT_CODE_SET_ATTRIBUTE
          Request attribute name for the Set of JavaScript code used in current page.
static String JAVASCRIPT_SET_ATTRIBUTE
          Request attribute name for the Set of JavaScript path used in current page.
static String JS_HEADER
          Deprecated. use JAVASCRIPT_SET_ATTRIBUTE
static LinkedHashMap<String,String> jsboMap
          Deprecated.  
static LinkedHashSet<String> jsboSet
           
static LinkedHashMap<String,String> jsfoMap
          Deprecated.  
static LinkedHashSet<String> jsfoSet
           
protected  javax.servlet.jsp.JspWriter out
           
protected  javax.servlet.jsp.PageContext pageContext
           
static String REVISION
           
protected static String SHOW_EDIT_ICON
           
static String STYLE_HEADER
           
 
Fields inherited from class com.jalios.jcms.context.JcmsContext
browser, caddy, channel, inFO, initDone, initWorkspace, isAdmin, isAjaxRequest, isDBMember, isDebug, isLogged, loggedMember, request, response, userLang, userLocale, workspace
 
Fields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, CRYPT_MD5, CRYPT_UNDEFINED, CRYPT_UNIX, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, ICON_ARCHIVE, ICON_LOCK, ICON_LOCK_STRONG, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_DEEP_COPY, OP_DEEP_DELETE, OP_DELETE, OP_MERGE, OP_UPDATE, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SESSION_AUTHORIZED_FILENAMES_SET, STATS_REPORT_DIR, STATUS_PROP, STORE_XML, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, URL_REGEXP, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
 
Fields inherited from interface com.jalios.util.JaliosConstants
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR
 
Constructor Summary
JcmsJspContext()
          If you use this constructor, pageContext or request must be initialized at a later time
JcmsJspContext(javax.servlet.jsp.PageContext pageContext)
           
 
Method Summary
 void addBodyAttributes(String name, String value)
          Adds body attributes.
 void addCSSHeader(Map<String,String> paths)
          Adds css headers.
 void addCSSHeader(String path)
          Adds a css header.
 void addCSSHeader(String[] paths)
          Adds css headers.
 void addCSSHeader(String path, String media)
          Adds a css header.
 void addCustomHeader(String content)
          Adds inline content header.
 void addHttpEquivHeader(String httpequiv, String content)
          Adds http-equiv header.
 void addHttpNameHeader(String name, String content)
          Adds http-name header.
 void addJavaScript(Collection<String> pathsColl)
          Adds several javascript files to the current page.
 void addJavaScript(String path)
          Adds a javascript file to the current page.
 void addJavaScript(String[] paths)
          Adds several javascript files to the current page.
 void addJavaScriptCode(String code)
          Adds some javascript CODE to be executed on page load (or an after an ajax update).
 void addJSHeader(Map<String,String> paths)
          Deprecated. use addJavaScript(String[])
 void addJSHeader(String path)
          Deprecated. use addJavaScript(String)
 void addJSHeader(String[] paths)
          Deprecated. use addJavaScript(String[])
 void addJSHeader(String path, String language)
          Deprecated. use addJavaScript(String)
 void addStyleHeader(String cssquery)
          Adds inline style header.
 void addStyleHeader(String cssquery, String media)
          Adds inline style header.
 boolean checkAccess(String resource)
          Check if the current member is authorized to access the specified resource.
 boolean checkAccess(String resource, Map<String,Object> ctxt)
          Check if the current member is authorized to access the specified resource.
 void debugDisplayContext()
           
 void forceEditIcon(boolean editIcon)
          Force the editIcon stat to the given value for the current request.
 void forceUpdate()
          Will force an update of all JcmsContext variables (retrieve it from the request) Update the protected variable initDone (to false at begining of method, and true on end).
 Object getAjaxRequestAttribute(String key)
          Returns the attribute value associated to given key if the attribute has been stored for the ajax scope
 String getAjaxRequestId()
          Retrieve the Ajax Request Id for the current request
 Map getAllHeadersDiffMap(Map oldMap)
          Returns a Map of "Header Name" / "Header Map" that contains added items since given map
 Map getAllHeadersMap()
          Returns a Map of "Header Name" / "Header Map" that contains all current headers.
static Map<String,String> getBackOfficeCSSHeader()
          Returns BackOffice CSS header.
static Set<String> getBackOfficeJavaScriptSet()
          Returns BackOffice JavaScript files.
static Map<String,String> getBackOfficeJSHeader()
          Deprecated. use getBackOfficeJavaScriptSet()
 Map<String,String> getBodyAttributes()
          Returns a map of body attributes
 Publication getContentForm()
           
 Map<String,String> getCSSHeaders()
          Returns a map of CSS headers.
 Category[] getCtxCategories()
           
 Category getCurrentCategory()
           
 Collection getCustomHeaders()
          Returns a Map of Custom headers.
 String getDocType(String defaultValue)
          This method return the doc type set in request attribute "docType" Otherwise use the default value.
 LinkedHashMap<String,String> getFinalCSSMap()
          Retrieve the final (ultimate) map of CSS files (and media to be used in the page.
 LinkedHashSet<String> getFinalJavaScriptSet()
          Retrieve the final (ultimate) set of JavaScript file to be used in the page.
 int getFormElementCount()
           
static Map<String,String> getFrontOfficeCSSHeader()
          Returns FronOffice CSS header.
static Set<String> getFrontOfficeJavaScriptSet()
          Returns FronOffice JavaScript files.
static Map<String,String> getFrontOfficeJSHeader()
          Deprecated. use getFrontOfficeJavaScriptSet()
 Map<String,String> getHttpEquivHeaders()
          Returns a map of Meta httpequiv headers.
 Map<String,String> getHttpNameHeaders()
          Returns a map of Meta name headers.
 LinkedHashSet<String> getJavaScriptCodeSet()
          Retrieves the javascript CODE that have been setup to be called on current page load.
 LinkedHashSet<String> getJavaScriptSet()
          Retrieves the javascript files that have been setup for current page.
 Map<String,String> getJSHeaders()
          Deprecated. use getJavaScriptSet()
 org.jabsorb.JSONRPCBridge getJSONBridge()
          Returns the JSON-RPC Bridge declared by the InitFilter
static String getPackVersion()
          Retrieve JS and CSS pack version used in packer URL for improved caching management.
 javax.servlet.jsp.PageContext getPageContext()
           
 String getPageTitle(String defaultValue)
          This method return the title of the page
 String getPageZone(String defaultValue)
          This method return the zone of the page.
 PortalInterface getPortal()
           
 Category getPortalCategory()
           
 PortalElement getPortlet()
           
 Publication getPublication()
           
 Map<String,String> getStyleHeaders()
          Returns a Map of Style headers.
 String getTemplateUsage()
           
 void internalSetupEmptyHeader()
          Convenient method to setup all headers.
 boolean isEditIcon()
          Returns true if edit area must be displayed.
 boolean isPrintView()
           
 void registerDisplayContext(DisplayContext ctxt)
          Register the given DisplayContext into the JcmsContext
 Object removeAjaxRequestAttribute(String key)
          Remove a request attribute persistent in the AJAX request Scope.
 void setAjaxRequestAttribute(String key, Object value)
          Set a request attribute persistent in the AJAX request Scope
 void setAjaxRequestId(String ajaxReqId)
          Set the Ajax Request Id for the current JcmsContext
 void setAllHeadersDiffMap(Map oldMap)
          Adds header diff map to current context
 void setDocType(String docType)
          This method set the doctype of the page.
 void setEditIcon(boolean editIcon, boolean request, boolean session)
          Force the editIcon stat to the given value for the current request or session.
 void setFormElementCount(int count)
           
 void setPageContext(javax.servlet.jsp.PageContext pageContext)
          Page context setter, will initialize the following members : - page context - out - request - response then force an update of all variables
 void setPageTitle(String title)
          This method set custom page title to append to header tag.
 void setPageZone(String zone)
          This method set page zone then store it in the request attribute "zone" The zone is used to define groups of pages.
 void setShowEditIcon(boolean show)
          Set the editIcon state to define if the EditArea must be hidden
 void setTemplateUsage(String usage)
          Set the current template usage.
 boolean showEditIcon()
          Returns editIcon state.
 String workaroundBrowserBaseHrefBug(String path)
          If needed, apply workaround for specified path.
 
Methods inherited from class com.jalios.jcms.context.JcmsContext
addCookie, addMsg, addMsg, addMsgSession, applySelector, forceWorkspaceUpdate, getBaseUrl, getBrowser, getCaddy, getContextPath, getErrorMsg, getErrorMsgList, getErrorMsgSession, getErrorMsgSessionList, getInfoMsg, getInfoMsgList, getInfoMsgSession, getInfoMsgSessionList, getLoggedMember, getMsgList, getMsgSessionList, getRequest, getResponse, getSession, getUploadedFile, getUploadedFileList, getUrlWithCommonUpdatedParams, getUserLang, getUserLocale, getWarningMsg, getWarningMsgList, getWarningMsgSession, getWarningMsgSessionList, getWorkspace, glp, isAdmin, isAjaxRequest, isDBMember, isDebug, isInFrontOffice, isLogged, isWebdavAccess, removeMessage, removeMessage, retrieveUploadedFile, select, sendForbidden, sendForbidden, sendRedirect, sendRedirect, sendRedirect, setErrorMsg, setErrorMsg, setErrorMsgSession, setErrorMsgSession, setInfoMsg, setInfoMsg, setInfoMsgSession, setInfoMsgSession, setLoggedMember, setRequest, setResponse, setWarningMsg, setWarningMsg, setWarningMsgSession, setWarningMsgSession, validateRegexp, validateSchedule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

pageContext

protected javax.servlet.jsp.PageContext pageContext

out

protected javax.servlet.jsp.JspWriter out

initEditIcon

protected boolean initEditIcon

editIcon

protected boolean editIcon

SHOW_EDIT_ICON

protected static final String SHOW_EDIT_ICON
See Also:
Constant Field Values

AJAX_REQUEST_ATTRIBUTES

public static final String AJAX_REQUEST_ATTRIBUTES
See Also:
Constant Field Values

JAVASCRIPT_SET_ATTRIBUTE

public static final String JAVASCRIPT_SET_ATTRIBUTE
Request attribute name for the Set of JavaScript path used in current page.

Since:
jcms-6.0
See Also:
addJavaScript(String), addJavaScript(String[]), getJavaScriptSet(), Constant Field Values

JAVASCRIPT_CODE_SET_ATTRIBUTE

public static final String JAVASCRIPT_CODE_SET_ATTRIBUTE
Request attribute name for the Set of JavaScript code used in current page.

Since:
jcms-6.0
See Also:
addJavaScriptCode(String), getJavaScriptCodeSet(), Constant Field Values

JS_HEADER

@Deprecated
public static final String JS_HEADER
Deprecated. use JAVASCRIPT_SET_ATTRIBUTE
See Also:
Constant Field Values

CSS_HEADER

public static final String CSS_HEADER
See Also:
Constant Field Values

STYLE_HEADER

public static final String STYLE_HEADER
See Also:
Constant Field Values

CUSTOM_HEADER

public static final String CUSTOM_HEADER
See Also:
Constant Field Values

BODY_HEADER

public static final String BODY_HEADER
See Also:
Constant Field Values

HTTPEQUIV_HEADER

public static final String HTTPEQUIV_HEADER
See Also:
Constant Field Values

HTTPNAME_HEADER

public static final String HTTPNAME_HEADER
See Also:
Constant Field Values

httpequivMap

public static final LinkedHashMap<String,String> httpequivMap

httpnameMap

public static final LinkedHashMap<String,String> httpnameMap

cssfoMap

public static final LinkedHashMap<String,String> cssfoMap

cssboMap

public static final LinkedHashMap<String,String> cssboMap

jsfoMap

@Deprecated
public static final LinkedHashMap<String,String> jsfoMap
Deprecated. 

jsboMap

@Deprecated
public static final LinkedHashMap<String,String> jsboMap
Deprecated. 

jsfoSet

public static final LinkedHashSet<String> jsfoSet

jsboSet

public static final LinkedHashSet<String> jsboSet
Constructor Detail

JcmsJspContext

public JcmsJspContext()
If you use this constructor, pageContext or request must be initialized at a later time


JcmsJspContext

public JcmsJspContext(javax.servlet.jsp.PageContext pageContext)
Method Detail

forceUpdate

public void forceUpdate()
Will force an update of all JcmsContext variables (retrieve it from the request) Update the protected variable initDone (to false at begining of method, and true on end).

Overrides:
forceUpdate in class JcmsContext

setPageContext

public void setPageContext(javax.servlet.jsp.PageContext pageContext)
Page context setter, will initialize the following members : - page context - out - request - response then force an update of all variables

Parameters:
pageContext - the jsp PageContext to be used for initialization of this JcmsJspContext

getPageContext

public javax.servlet.jsp.PageContext getPageContext()

getPublication

public Publication getPublication()
Returns:
the current Content or Form if not null, or the Portlet (or null). Slow: we DO NOT cache this value (so do not use this getter every 2millisecs).

getContentForm

public Publication getContentForm()
Returns:
the current Content or Form (if set in publication) or null. Slow: we DO NOT cache this value (so do not use this getter every 2millisecs).

getPortlet

public PortalElement getPortlet()
Returns:
the current portlet (if set) or null. Slow: portlet can change during the request, we DO NOT cache this value (so do not use this getter every 2millisecs)

getPortal

public PortalInterface getPortal()
Returns:
the current portal (if set) or null. Fast: portal do not change during all the request, first time we have it, we cache it.

getCurrentCategory

public Category getCurrentCategory()
Returns:
the current category (if set) or null. Fast: current category do not change during all the request, first time we have it, we cache it.

getPortalCategory

public Category getPortalCategory()
Returns:
the current portal category (if set) or null. Fast: current portal category do not change during all the request, first time we have it, we cache it.

getCtxCategories

public Category[] getCtxCategories()
Returns:
the current portal category (if set) or null. current portal category do not change during all the request, first time we have it, we cache it.

getTemplateUsage

public String getTemplateUsage()
Returns:
the current template usage use to find which tempalte to include. Slow: templalte usage can change during the request, we DO NOT cache this value (so do not use this getter every 2millisecs)

isPrintView

public boolean isPrintView()
Returns:
true if the current page is displayed with printView.
Since:
jcms-6.0.0

setTemplateUsage

public void setTemplateUsage(String usage)
Set the current template usage. If kin is empty then remove usage value (this will default to default value).

Parameters:
usage - the current template usage

registerDisplayContext

public void registerDisplayContext(DisplayContext ctxt)
Register the given DisplayContext into the JcmsContext

Parameters:
ctxt - the DisplayContext

debugDisplayContext

public void debugDisplayContext()

isEditIcon

public boolean isEditIcon()
Returns true if edit area must be displayed.

Returns:
boolean true if the edit area must be displayed

showEditIcon

public boolean showEditIcon()
Returns editIcon state. If false EditArea should be hidden.

Returns:
boolean true to display EditArea

setShowEditIcon

public void setShowEditIcon(boolean show)
Set the editIcon state to define if the EditArea must be hidden

Parameters:
show - boolean true to display EditArea

setEditIcon

public void setEditIcon(boolean editIcon,
                        boolean request,
                        boolean session)
Force the editIcon stat to the given value for the current request or session.

Parameters:
editIcon - the new edit Icon state
request - store in request
session - store in session

forceEditIcon

public void forceEditIcon(boolean editIcon)
Force the editIcon stat to the given value for the current request.

Parameters:
editIcon - the new edit Icon state

setAjaxRequestId

public void setAjaxRequestId(String ajaxReqId)
Set the Ajax Request Id for the current JcmsContext

Parameters:
ajaxReqId - the Ajax Request Id

getAjaxRequestId

public String getAjaxRequestId()
Retrieve the Ajax Request Id for the current request

Returns:
ajaxReqId the Ajax Request Id

setAjaxRequestAttribute

public void setAjaxRequestAttribute(String key,
                                    Object value)
Set a request attribute persistent in the AJAX request Scope

Parameters:
key - the key
value - the value

getAjaxRequestAttribute

public Object getAjaxRequestAttribute(String key)
Returns the attribute value associated to given key if the attribute has been stored for the ajax scope

Parameters:
key - the key
Returns:
value the value

removeAjaxRequestAttribute

public Object removeAjaxRequestAttribute(String key)
Remove a request attribute persistent in the AJAX request Scope. Also removed if present in standard request.

Parameters:
key - the key
Returns:
value the value

getJSONBridge

public org.jabsorb.JSONRPCBridge getJSONBridge()
Returns the JSON-RPC Bridge declared by the InitFilter

Returns:
JSONRPCBridge the JSON-RPC Bridge

getFormElementCount

public int getFormElementCount()

setFormElementCount

public void setFormElementCount(int count)

setPageTitle

public void setPageTitle(String title)
This method set custom page title to append to header tag. Store it in the request attribute "title"

Parameters:
title - the custom title header
Since:
jcms-5.6.0

getPageTitle

public String getPageTitle(String defaultValue)
This method return the title of the page

Parameters:
defaultValue - the default value to return
Returns:
String pageTitle
Since:
jcms-5.6.0

setPageZone

public void setPageZone(String zone)
This method set page zone then store it in the request attribute "zone" The zone is used to define groups of pages. It may be used in stats to filter on a given zone.

Parameters:
zone - the custom zone
Since:
jcms-5.6.0

getPageZone

public String getPageZone(String defaultValue)
This method return the zone of the page. It can be Public, WorkArea, AdminArea, ...

Parameters:
defaultValue - the default zone
Returns:
String zone
Since:
jcms-5.6.0

setDocType

public void setDocType(String docType)
This method set the doctype of the page. Store it in the request attribute "docType"

Parameters:
docType - the doc type
Since:
jcms-5.6.0

getDocType

public String getDocType(String defaultValue)
This method return the doc type set in request attribute "docType" Otherwise use the default value. doEmptyHeader call it with :

Parameters:
defaultValue - the default value if there is no doctype
Returns:
String the doctype to use
Since:
jcms-5.6.0

addHttpEquivHeader

public void addHttpEquivHeader(String httpequiv,
                               String content)
Adds http-equiv header.

Parameters:
httpequiv - the header key
content - the header value
Since:
jcms-5.6.0

getHttpEquivHeaders

public Map<String,String> getHttpEquivHeaders()
Returns a map of Meta httpequiv headers.

Returns:
Map a map of Http-equiv Headers
Since:
jcms-5.6.0

addHttpNameHeader

public void addHttpNameHeader(String name,
                              String content)
Adds http-name header.

Parameters:
name - the header key
content - the header value
Since:
jcms-5.6.0

getHttpNameHeaders

public Map<String,String> getHttpNameHeaders()
Returns a map of Meta name headers.

Returns:
Map a map of Http-name Headers
Since:
jcms-5.6.0

addBodyAttributes

public void addBodyAttributes(String name,
                              String value)
Adds body attributes.

Parameters:
name - the attribute name
value - the attribute value
Since:
jcms-5.7.0

getBodyAttributes

public Map<String,String> getBodyAttributes()
Returns a map of body attributes

Returns:
Map a map of Http-name Headers
Since:
jcms-5.7.0

addCustomHeader

public void addCustomHeader(String content)
Adds inline content header.

Parameters:
content - the inline content to add
Since:
jcms-5.7.0

getCustomHeaders

public Collection getCustomHeaders()
Returns a Map of Custom headers.

Returns:
Set a set of Custom Headers
Since:
jcms-5.7.0

addStyleHeader

public void addStyleHeader(String cssquery)
Adds inline style header. All styles will be written between <style type="text/css" media="screen"><!-- --></style>

Parameters:
cssquery - the inline style to add

addStyleHeader

public void addStyleHeader(String cssquery,
                           String media)
Adds inline style header. All styles will be written between <style type="text/css" media="screen"><!-- --></style>

Parameters:
cssquery - the inline style to add
media - the css media

getStyleHeaders

public Map<String,String> getStyleHeaders()
Returns a Map of Style headers. All styles will be written between <style type="text/css" media="screen"><!-- --></style>

Returns:
Map a map of Style Headers

addJSHeader

@Deprecated
public void addJSHeader(String path)
Deprecated. use addJavaScript(String)

Adds a javascript header.

Parameters:
path - the JS path

addJSHeader

@Deprecated
public void addJSHeader(String path,
                                   String language)
Deprecated. use addJavaScript(String)

Adds a javascript header.

Parameters:
path - the JS path
language - the language script (default: text/javascript)

addJSHeader

@Deprecated
public void addJSHeader(String[] paths)
Deprecated. use addJavaScript(String[])

Adds javascript headers.

Parameters:
paths - the JS path

addJSHeader

@Deprecated
public void addJSHeader(Map<String,String> paths)
Deprecated. use addJavaScript(String[])

Adds javascript headers.

Parameters:
paths - the JS path

getJSHeaders

@Deprecated
public Map<String,String> getJSHeaders()
Deprecated. use getJavaScriptSet()

Returns a map of JavaScript headers. Key: the Javascript file Value: the language type

Returns:
Map a map of JavaScript Headers

addCSSHeader

public void addCSSHeader(String path)
Adds a css header.

Parameters:
path - the CSS path

addCSSHeader

public void addCSSHeader(String path,
                         String media)
Adds a css header.

Parameters:
path - the CSS path
media - the Media path
Since:
jcms-5.6.0

addCSSHeader

public void addCSSHeader(String[] paths)
Adds css headers.

Parameters:
paths - the CSS path

addCSSHeader

public void addCSSHeader(Map<String,String> paths)
Adds css headers.

Parameters:
paths - the CSS path

getCSSHeaders

public Map<String,String> getCSSHeaders()
Returns a map of CSS headers. Key: the css file Value: the media type

Returns:
Map a map of CSS Headers

getFrontOfficeCSSHeader

public static Map<String,String> getFrontOfficeCSSHeader()
Returns FronOffice CSS header. Usefull for JSP in BackOffice displaying Front Office stuff.

Returns:
Map the FrontOffice CSS Headers
Since:
jcms-5.6.0

getBackOfficeCSSHeader

public static Map<String,String> getBackOfficeCSSHeader()
Returns BackOffice CSS header. Usefull for JSP in FrontOffice displaying Back Office stuff.

Returns:
Map the BackOffice CSS Headers
Since:
jcms-5.6.0

getFrontOfficeJSHeader

@Deprecated
public static Map<String,String> getFrontOfficeJSHeader()
Deprecated. use getFrontOfficeJavaScriptSet()

Returns FronOffice JS header. Usefull for JSP in BackOffice displaying Front Office stuff.

Returns:
Map the FrontOffice JS Headers
Since:
jcms-5.6.0

getBackOfficeJSHeader

@Deprecated
public static Map<String,String> getBackOfficeJSHeader()
Deprecated. use getBackOfficeJavaScriptSet()

Returns BackOffice JS header. Usefull for JSP in FrontOffice displaying Back Office stuff.

Returns:
String[] the BackOffice JS Headers
Since:
jcms-5.6.0

getFrontOfficeJavaScriptSet

public static Set<String> getFrontOfficeJavaScriptSet()
Returns FronOffice JavaScript files. Useful for JSP in BackOffice displaying Front Office stuff.

Returns:
Set the BackOffice JavaScript
Since:
jcms-6.0

getBackOfficeJavaScriptSet

public static Set<String> getBackOfficeJavaScriptSet()
Returns BackOffice JavaScript files. Useful for JSP in FrontOffice displaying Back Office stuff.

Returns:
Set the BackOffice JavaScript
Since:
jcms-6.0

internalSetupEmptyHeader

public void internalSetupEmptyHeader()
Convenient method to setup all headers. This method must be called before printing headers

Since:
jcms-5.7.0

getFinalCSSMap

public LinkedHashMap<String,String> getFinalCSSMap()
Retrieve the final (ultimate) map of CSS files (and media to be used in the page.

If csspacker is enabled (property "channel.css-packer.enabled"), the existing css map is converted into a new map of packed resources.

Returns:
a LinkedHashMap of path, either css path or csspacker path and relative media.

getAllHeadersMap

public Map getAllHeadersMap()
Returns a Map of "Header Name" / "Header Map" that contains all current headers.

Returns:
Map the map of headers
Since:
jcms 5.7.0

getAllHeadersDiffMap

public Map getAllHeadersDiffMap(Map oldMap)
Returns a Map of "Header Name" / "Header Map" that contains added items since given map

Parameters:
oldMap - the map to diff with
Returns:
Map the map of headers
Since:
jcms 5.7.0

setAllHeadersDiffMap

public void setAllHeadersDiffMap(Map oldMap)
Adds header diff map to current context

Parameters:
oldMap - the Map to work with

addJavaScript

public void addJavaScript(String path)
Adds a javascript file to the current page.

Parameters:
path - a relative JavaScript path (e.g "plugins/MyPlugin/js/plugin.js")
Since:
jcms-6.0

addJavaScript

public void addJavaScript(String[] paths)
Adds several javascript files to the current page.

Parameters:
paths - an array of relative JavaScript path (e.g { "plugins/MyPlugin/js/myscript1.js", "plugins/MyPlugin/js/myscript2.js" })
Since:
jcms-6.0

addJavaScript

public void addJavaScript(Collection<String> pathsColl)
Adds several javascript files to the current page.

Parameters:
pathsColl - a collection of relative JavaScript path (e.g { "plugins/MyPlugin/js/myscript1.js", "plugins/MyPlugin/js/myscript2.js" })
Since:
jcms-6.0

getJavaScriptSet

public LinkedHashSet<String> getJavaScriptSet()
Retrieves the javascript files that have been setup for current page.

The returned set will only contains file that have been added prior to invocation of this method. Some files may be added after.

Returns:
the LinkedHashSet of relative JavaScript path in use for the current request. Return null if the request of this JcmsJspContext has not been set.
Since:
jcms-6.0

getFinalJavaScriptSet

public LinkedHashSet<String> getFinalJavaScriptSet()
Retrieve the final (ultimate) set of JavaScript file to be used in the page.

If jspacker is enabled, the existing javascript set is converted into a new set of packed resources (unless resource contain a 'nopack' querystring argument).

Returns:
a LinkedHashSet of path, either javascript path or jspacker path.

getPackVersion

public static String getPackVersion()
Retrieve JS and CSS pack version used in packer URL for improved caching management.

Returns:
a version string to be used in JS and CSS packer URL parameter or null if none was specified.
Since:
jcms-6.1.2, jcms-6.2

workaroundBrowserBaseHrefBug

public String workaroundBrowserBaseHrefBug(String path)
If needed, apply workaround for specified path. Convert a relative URL into a full URL if needed to workaround IE 8 bug.

Parameters:
path - the path to convert to absolute URL, if needed
Returns:
the path/URL to use: absolute URL if workaround must be applied, unmodified otherwise.

addJavaScriptCode

public void addJavaScriptCode(String code)
Adds some javascript CODE to be executed on page load (or an after an ajax update).
   jcmsContext.addJavaScriptCodeOnLoad("someMethod(); alert('Page has been loaded by browser'); ");
 

Parameters:
code - some javascript code

getJavaScriptCodeSet

public LinkedHashSet<String> getJavaScriptCodeSet()
Retrieves the javascript CODE that have been setup to be called on current page load.

The returned set will only contains code that have been added prior to invocation of this method. Some code may be added after.

Returns:
the LinkedHashSet being used for the current request to store JavaScript code. Return null if the request of this JcmsJspContext has not been set.
Since:
jcms-6.0

checkAccess

public boolean checkAccess(String resource)
Check if the current member is authorized to access the specified resource.
  boolean isAuthorized = checkAccess(loggedMember, "admin/dev/store-cleaner");
 

Parameters:
resource - a resource URI using a path representation, eg "admin/dev/store-cleaner"
Returns:
true if the access is authorized, false otherwise
Since:
jcms-7.0

checkAccess

public boolean checkAccess(String resource,
                           Map<String,Object> ctxt)
Check if the current member is authorized to access the specified resource.
  boolean isAuthorized = checkAccess(loggedMember, "admin-ws/types/content", ctxtMap);
 

Parameters:
resource - a resource URI using a path representation, eg "admin/dev/store-cleaner"
ctxt - an optionnal context map
Returns:
true if the access is authorized, false otherwise
Since:
jcms-7.0


Copyright © 2001-2010 Jalios SA. All Rights Reserved.