Class JcmsJspContext
- All Implemented Interfaces:
JcmsConstants,JaliosConstants
- Direct Known Subclasses:
CaddyPopinHandler,JcmsFormHandler,MediaBrowserHandler
You can either :
- Use the one declared in request attributes with :
JcmsJspContext jspCtx = request.getAttribute(Channel.JCMS_CONTEXT_REQUEST_ATTRIBUTE) -
Instantiate a new one with :
JcmsJspContext jspCtx = new JcmsJspContext(pageContext) -
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.jspf" %> <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
- Author:
- Olivier Jaquemet
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final LinkedHashMap<String, String> static final LinkedHashMap<String, String> static final Stringprotected booleanstatic final Stringstatic final LinkedHashMap<String, String> static final Stringstatic final LinkedHashMap<String, String> protected booleanstatic final StringRequest attribute name for theSetof JavaScript code used in current page.static final StringRequest attribute name for theSetof JavaScript module path used in current page.static final StringRequest attribute name for theSetof JavaScript path used in current page.static final LinkedHashSet<String> static final LinkedHashSet<String> protected javax.servlet.jsp.JspWriterprotected javax.servlet.jsp.PageContextprotected static final Stringstatic final StringFields inherited from class com.jalios.jcms.context.JcmsContext
browser, caddy, channel, inFO, initDone, initWorkspace, isAdmin, isAjaxRequest, isDBMember, isDebug, isDebugTemplatePath, isLogged, loggedMember, request, response, userCountry, userLang, userLocale, userZoneId, workspaceFields 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_YEARFields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADVANCED_TAB, AJAX_MODE_ATTR, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, CLASS_PROPERTY, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, COUNTRY_SPRITE, CS_TYPOLOGY_ROOT_CAT_VID, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DATA_DIRECTORY, DEFAULT_PHOTO_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, GENERATIONAL_STORE_DIRECTORY, GLYPH_ICON_PREFIX, ICON_ARCHIVE, ICON_ICON_PREFIX, ICON_LOCK, ICON_LOCK_STRONG, ICON_PREFIX_PROP, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, IS_IN_FRONT_OFFICE, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JCMS_TOASTR_COLLECTION, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LANG_SPRITE, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_CREATE_STR, OP_DEEP_COPY, OP_DEEP_COPY_STR, OP_DEEP_DELETE, OP_DEEP_DELETE_STR, OP_DELETE, OP_DELETE_STR, OP_MERGE, OP_MERGE_STR, OP_UPDATE, OP_UPDATE_STR, ORGANIZATION_ROOT_GROUP_PROP, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_PROP_PREFIX, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_PROP_PREFIX, PHOTO_LARGE_WIDTH, PHOTO_MINI, PHOTO_MINI_HEIGHT, PHOTO_MINI_PROP_PREFIX, PHOTO_MINI_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_PROP_PREFIX, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_PROP_PREFIX, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_PROP_PREFIX, PHOTO_TINY_WIDTH, PHOTO_XLARGE, PHOTO_XLARGE_HEIGHT, PHOTO_XLARGE_PROP_PREFIX, PHOTO_XLARGE_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, RAW_CONTENT_ICON_PREFIX, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SECURITY_LOG_FILE, SESSION_AUTHORIZED_FILENAMES_SET, SPRITE_ICON_PREFIX, STATS_REPORT_DIR, STATUS_PROP, STORE_XML, SUCCESS_MSG, SVG_ICON_PREFIX, SVGINLINE_ICON_PREFIX, SVGSPRITE_ICON_PREFIX, TEMPLATE_TAB, THEME_DIR, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, TTCARD_MEDIA_HEIGHT, TTCARD_MEDIA_WIDTH, TYPES_ICON_ALT_PROP, TYPES_ICON_SUFFIX_PROP, TYPES_ICON_TITLE_PROP, TYPES_PREFIX_PROP, TYPES_THUMB_SUFFIX_PROP, TYPES_UNKNOWN_CLASS_PROP, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, UPLOAD_PERMISSION_COUNT_PROP_PREFIX, UPLOAD_PERMISSION_SIZE_PROP_PREFIX, URL_REGEXP, VID_LOGGED_MEMBER, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML -
Constructor Summary
ConstructorsConstructorDescriptionIf you use this constructor, pageContext or request must be initialized at a later timeJcmsJspContext(javax.servlet.jsp.PageContext pageContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAvoidanceLink(String target, String label) Adds an avoidance link on the pagevoidaddBodyAttributes(String name, String value) Adds body attributes.voidaddCSSHeader(String path) Adds a css header.voidaddCSSHeader(String[] paths) Adds css headers.voidaddCSSHeader(String path, String media) Adds a css header.voidaddCSSHeader(Map<String, String> paths) Adds css headers.voidaddCustomHeader(String content) Adds inline content header.addHandlebarTemplate(String name, String template) Adds an handlebar template to the current page In case of an ajax request, if the template is not already in the map of existing template, add it directly in the ajax footer.voidaddHttpEquivHeader(String httpequiv, String content) Adds http-equiv header.voidaddHttpNameHeader(String name, String content) Adds http-name header.voidaddJavaScript(String path) Adds a javascript file to the current page.voidaddJavaScript(String[] paths) Adds several javascript files to the current page.voidaddJavaScript(Collection<String> pathsColl) Adds several javascript files to the current page.voidaddJavaScriptCode(String code) Adds some javascript CODE to be executed on page load (or an after an ajax update).voidaddJavaScriptModule(String path) Add a javacript module to the current pagevoidaddPrefetchHeader(String path) Adds a prefetch header.voidaddStyleHeader(String cssquery) Adds inline style header.voidaddStyleHeader(String cssquery, String media) Adds inline style header.voidaddSvgSpriteIcon(String spriteFolderName, String iconId) voidaddWebAssets(String feature) Adds web assets (JS/CSS resources) for given feature.booleanbooleancheckAccess(String resource) Check if the current member is authorized to access the specified resource.booleancheckAccess(String resource, Map<String, Object> ctxt) Check if the current member is authorized to access the specified resource.booleanCheck that the current request validates CSRF prevention requirements.voidvoidForce disable CSS & JS packer for all CSS & JS of the current request only.voidforceEditIcon(boolean editIcon) Force the editIcon stat to the given value for the current request.voidWill 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).Returns the attribute value associated to given key if the attribute has been stored for the ajax scopeRetrieve the Ajax Request Id for the current requestgetAllHeadersDiffMap(Map oldMap) Returns a Map of "Header Name" / "Header Map" that contains added items since given mapReturns a Map of "Header Name" / "Header Map" that contains all current headers.Returns BackOffice CSS header.Returns BackOffice JavaScript files.Returns a map of body attributesReturns a map of CSS headers.Category[]Returns a Map of Custom headers.getDocType(String defaultValue) This method return the doc type set in request attribute "docType" Otherwise use the default value.Retrieve the final (ultimate) map of CSS files to be added in footer if addCSSheader was invoked after doEmptyHeader.jspf executionRetrieve the final (ultimate) map of CSS files (and media to be used in the page).Retrieve the final (ultimate) set of JavaScript file to be used in the page.Returns FronOffice CSS header.Returns FronOffice JavaScript files.Returns a map of Meta httpequiv headers.Returns a map of Meta name headers.Retrieves the javascript CODE that have been setup to be called on current page load.Retrieves the javascript module files that have been setup for current pageRetrieves the javascript files that have been setup for current page.javax.servlet.jsp.PageContextgetPageTitle(String defaultValue) This method return the title of the pagegetPageZone(String defaultValue) This method return the zone of the page.Returns a Map of Style headers.Retrieve the map of SVG included in THIS request.voidConvenient method to setup all headers and delegate to policy filters This method must be called before printing headersbooleanDeprecated.Use new method isEditIcon with workspace and data as parametersbooleanisEditIcon(Workspace ws, Publication pub) booleanisEditIconForPublish(Workspace ws, Class clazz) booleanisEditIconForPublish(Workspace ws, Set<Class<?>> classSet) booleanvoidRegister the given DisplayContext into the JcmsContextRemove a request attribute persistent in the AJAX request Scope.voidsetAjaxRequestAttribute(String key, Object value) Set a request attribute persistent in the AJAX request ScopevoidsetAjaxRequestId(String ajaxReqId) Set the Ajax Request Id for the current JcmsContextvoidsetAllHeadersDiffMap(Map oldMap) Adds header diff map to current contextvoidsetDocType(String docType) This method set the doctype of the page.voidsetEditIcon(boolean editIcon, boolean request, boolean session) Force the editIcon stat to the given value for the current request or session.voidsetPageContext(javax.servlet.jsp.PageContext pageContext) Page context setter, will initialize the following members : - page context - out - request - response then force an update of all variablesvoidsetPageTitle(String title) This method set custom page title to append to header tag.voidsetPageZone(String zone) This method set page zone then store it in the request attribute "zone" The zone is used to define groups of pages.voidsetShowEditIcon(boolean show) Set the editIcon state to define if the EditArea must be hiddenvoidsetTemplateUsage(String usage) Set the current template usage.booleanReturns editIcon state.booleanshowEditIcon(Workspace ws, Data pub) booleanshowEditIcon(Workspace ws, Data pub, Class clazz) Methods inherited from class com.jalios.jcms.context.JcmsContext
addMsg, addMsg, addMsgSession, addMsgSession, addToastr, addToastr, addToastrSession, addToastrSession, applySelector, canAccessAdminArea, copyMsgListToMsgSessionList, forceWorkspaceUpdate, getBaseUrl, getBrowser, getCaddy, getContextPath, getErrorMsg, getErrorMsgList, getErrorMsgSession, getErrorMsgSessionList, getInfoMsg, getInfoMsgList, getInfoMsgSession, getInfoMsgSessionList, getLoggedMember, getMsgList, getMsgSessionList, getRequest, getResponse, getSession, getSuccessMsg, getSuccessMsgList, getSuccessMsgSession, getSuccessMsgSessionList, getToastrCollection, getToastrSessionCollection, getUploadedFiles, getUploadedFiles, getUrlWithCommonUpdatedParams, getUserCountry, getUserLang, getUserLocale, getUserZoneId, getWarningMsg, getWarningMsgList, getWarningMsgSession, getWarningMsgSessionList, getWorkspace, glp, isAdmin, isAdminZone, isAjaxRequest, isDBMember, isDebug, isDebugTemplate, isInFrontOffice, isLogged, isWorkZone, removeMessage, removeMessage, removeMsg, select, sendError, sendError, sendForbidden, sendForbidden, sendRedirect, sendRedirect, sendRedirect, sendRedirect, setErrorMsg, setErrorMsg, setErrorMsgSession, setErrorMsgSession, setInfoMsg, setInfoMsg, setInfoMsgSession, setInfoMsgSession, setLoggedMember, setRequest, setResponse, setSuccessMsg, setSuccessMsg, setSuccessMsgSession, setSuccessMsgSession, setWarningMsg, setWarningMsg, setWarningMsgSession, setWarningMsgSession, updateWorkspace, validateRegexp, validateSchedule
-
Field Details
-
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
- See Also:
-
AJAX_REQUEST_ATTRIBUTES
- See Also:
-
JAVASCRIPT_SET_ATTRIBUTE
Request attribute name for theSetof JavaScript path used in current page.- Since:
- jcms-6.0
- See Also:
-
JAVASCRIPT_MODULE_SET_ATTRIBUTE
Request attribute name for theSetof JavaScript module path used in current page.- Since:
- jcms-11.0.0
- See Also:
-
JAVASCRIPT_CODE_SET_ATTRIBUTE
Request attribute name for theSetof JavaScript code used in current page.- Since:
- jcms-6.0
- See Also:
-
CSS_HEADER
- See Also:
-
CSS_FOOTER
- See Also:
-
STYLE_HEADER
- See Also:
-
CUSTOM_HEADER
- See Also:
-
BODY_HEADER
- See Also:
-
HTTPEQUIV_HEADER
- See Also:
-
HTTPNAME_HEADER
- See Also:
-
httpequivMap
-
httpnameMap
-
cssfoMap
-
cssboMap
-
jsfoSet
-
jsboSet
-
-
Constructor Details
-
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 Details
-
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:
forceUpdatein classJcmsContext
-
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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- Returns:
- the current template usage use to find which template to include. Slow: template 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
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
Register the given DisplayContext into the JcmsContext- Parameters:
ctxt- the DisplayContext
-
debugDisplayContext
public void debugDisplayContext() -
isEditIcon
Deprecated.Use new method isEditIcon with workspace and data as parametersReturns true if edit area must be displayed.- Check property channel.default-show-adminicon
- Check logged member and if it is worker
- Check if it is a print view
- Check if sothing has been forced in request or session
- Returns:
- boolean true if the edit area must be displayed
-
isEditIconForPublish
- Parameters:
ws- theWorkspaceused to check rightsclassSet- the Set ofPublicationclass to edit used to check publish rights Returns true if edit area must be displayed.- Check property channel.default-show-adminicon
- Check logged member and if it is worker of the workspace or if it can publish a instance of the specified classes
- Check if it is a print view
- Check if sothing has been forced in request or session
- Returns:
- boolean true if the edit area must be displayed
-
isEditIconForPublish
- Parameters:
ws- theWorkspaceused to check rightsclazz- thePublicationclass to edit used to check publish rights Returns true if edit area must be displayed.- Check property channel.default-show-adminicon
- Check logged member and if it is worker of the workspace or if it can publish an instance of the class
- Check if it is a print view
- Check if sothing has been forced in request or session
- Returns:
- boolean true if the edit area must be displayed
-
isEditIcon
- Parameters:
ws- theWorkspaceused to check rightspub- thePublicationto edit used to check rights Returns true if edit area must be displayed.- Check property channel.default-show-adminicon
- Check logged member and if it is worker of the workspace
- Check if it is a print view
- Check if sothing has been forced in request or session
- Returns:
- boolean true if the edit area must be displayed
-
showEditIcon
- Parameters:
ws- theWorkspaceused to check rightspub- theDatato edit used to check rights Returns true if edit area must be displayed.- Check property channel.default-show-adminicon
- Check logged member and if it is worker of the workspace
- Check if it is a print view
- Check if sothing has been forced in request or session
- Returns:
- boolean true if the edit area must be displayed
-
showEditIcon
- Parameters:
ws- theWorkspaceused to check rightspub- theDatato edit used to check rightsclazz- the class ofDatato edit used to check rights Returns true if edit area must be displayed.- Check property channel.default-show-adminicon
- Check logged member and if it is worker of the workspace
- Check if it is a print view
- Check if sothing has been forced in request or session
- 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 staterequest- store in requestsession- 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
Set the Ajax Request Id for the current JcmsContext- Parameters:
ajaxReqId- the Ajax Request Id
-
getAjaxRequestId
Retrieve the Ajax Request Id for the current request- Returns:
- ajaxReqId the Ajax Request Id
-
setAjaxRequestAttribute
Set a request attribute persistent in the AJAX request Scope- Parameters:
key- the keyvalue- the value
-
getAjaxRequestAttribute
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
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
-
setPageTitle
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
This method return the title of the page- Parameters:
defaultValue- the default value to return- Returns:
- String pageTitle
- Since:
- jcms-5.6.0
-
setPageZone
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
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
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
This method return the doc type set in request attribute "docType" Otherwise use the default value. doEmptyHeader call it with : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">- Parameters:
defaultValue- the default value if there is no doctype- Returns:
- String the doctype to use
- Since:
- jcms-5.6.0
-
addHttpEquivHeader
Adds http-equiv header.- Parameters:
httpequiv- the header keycontent- the header value- Since:
- jcms-5.6.0
-
getHttpEquivHeaders
Returns a map of Meta httpequiv headers.- Returns:
- Map a map of Http-equiv Headers
- Since:
- jcms-5.6.0
-
addHttpNameHeader
Adds http-name header.- Parameters:
name- the header keycontent- the header value- Since:
- jcms-5.6.0
-
getHttpNameHeaders
Returns a map of Meta name headers.- Returns:
- Map a map of Http-name Headers
- Since:
- jcms-5.6.0
-
addBodyAttributes
Adds body attributes.- Parameters:
name- the attribute namevalue- the attribute value- Since:
- jcms-5.7.0
-
getBodyAttributes
Returns a map of body attributes- Returns:
- Map a map of Http-name Headers
- Since:
- jcms-5.7.0
-
addCustomHeader
Adds inline content header.- Parameters:
content- the inline content to add- Since:
- jcms-5.7.0
-
getCustomHeaders
Returns a Map of Custom headers.- Returns:
- Set a set of Custom Headers
- Since:
- jcms-5.7.0
-
addStyleHeader
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
Adds inline style header. All styles will be written between <style type="text/css" media="screen"><!-- --></style>- Parameters:
cssquery- the inline style to addmedia- the css media
-
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
-
addPrefetchHeader
Adds a prefetch header.- Parameters:
path- the prefetch path
-
addCSSHeader
Adds a css header.- Parameters:
path- the CSS path
-
addCSSHeader
Adds a css header.- Parameters:
path- the CSS pathmedia- the Media path- Since:
- jcms-5.6.0
-
addCSSHeader
Adds css headers.- Parameters:
paths- the CSS path
-
addCSSHeader
Adds css headers.- Parameters:
paths- the CSS path
-
getCSSHeaders
Returns a map of CSS headers. Key: the css file Value: the media type- Returns:
- Map a map of CSS Headers
-
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
Returns BackOffice CSS header. Usefull for JSP in FrontOffice displaying Back Office stuff.- Returns:
- Map the BackOffice CSS Headers
- Since:
- jcms-5.6.0
-
getFrontOfficeJavaScriptSet
Returns FronOffice JavaScript files. Useful for JSP in BackOffice displaying Front Office stuff.- Returns:
- Set the BackOffice JavaScript
- Since:
- jcms-6.0
-
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 and delegate to policy filters This method must be called before printing headers- Since:
- jcms-5.7.0
-
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.
-
disablePacker
public void disablePacker()Force disable CSS & JS packer for all CSS & JS of the current request only.This method must be invoked prior to inclusion of doEmptyHeader.jsp (for CSS) and doEmptyFooter (for JS).
- Since:
- jcms-7.1.1 (JCMS-2914)
-
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
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
Adds header diff map to current context- Parameters:
oldMap- the Map to work with
-
addWebAssets
Adds web assets (JS/CSS resources) for given feature.- Parameters:
feature- a feature id, declared using properties- Since:
- jcms-10.0.2
- See Also:
-
addJavaScriptModule
Add a javacript module to the current page- Parameters:
path- a relative JavaScript path (e.g"plugins/MyPlugin/js/plugin.js")- Since:
- jcms-11.0.0
-
addJavaScript
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
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
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
-
getJavaScriptModuleSet
Retrieves the javascript module files that have been setup for current page- Returns:
-
getFinalJavaScriptModuleSet
-
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
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.
-
addJavaScriptCode
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
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
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
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 optional context map- Returns:
- true if the access is authorized, false otherwise
- Since:
- jcms-7.0
-
canAccessAdminArea
public boolean canAccessAdminArea()- Returns:
- true if loggedMember has access of resource "admin/" and request is valid admin IP.
- Since:
- jcms-11.0
- See Also:
-
checkCSRF
public boolean checkCSRF()Check that the current request validates CSRF prevention requirements.- Returns:
- true if the request is safe (or null), false if the request cannot be guaranteed for safety
-
addHandlebarTemplate
Adds an handlebar template to the current page In case of an ajax request, if the template is not already in the map of existing template, add it directly in the ajax footer. The template will then be moved with js to the bottom of the body- Parameters:
name- the template nametemplate- the template content (Html)- Returns:
- the handlebar template as a String
-
getHandlebarTemplates
- Returns:
- all handlebar templates declared in current page
-
addSvgSpriteIcon
-
getSvgSprites
Retrieve the map of SVG included in THIS request.- Returns:
- a Map, never return nul
-
getSvgSpritesHtml
-
addAvoidanceLink
Adds an avoidance link on the page- Parameters:
target- the targetlabel- the label of the avoidance link
-
getAvoidanceLinks
- Returns:
- all avoidance links for current page
-