Class JcmsJspContext
- java.lang.Object
-
- com.jalios.jcms.context.JcmsContext
-
- 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 initialized by JCMS.You can either :
- Use the one declared in request attributes with :
JcmsJspContext jspCtx = request.getAttribute("jcmsContext")
-
Instantiate a new one with :
JcmsJspContext jspCtx = new JcmsJspContext(pageContext)
-
Create your own bean/handler classes by extending this 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: 134031 $
- Author:
- Olivier Jaquemet
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
AJAX_REQUEST_ATTRIBUTES
static java.lang.String
BODY_HEADER
static java.lang.String
CSS_FOOTER
static java.lang.String
CSS_HEADER
static java.util.LinkedHashMap<java.lang.String,java.lang.String>
cssboMap
static java.util.LinkedHashMap<java.lang.String,java.lang.String>
cssfoMap
static java.lang.String
CUSTOM_HEADER
protected boolean
editIcon
static java.lang.String
HTTPEQUIV_HEADER
static java.util.LinkedHashMap<java.lang.String,java.lang.String>
httpequivMap
static java.lang.String
HTTPNAME_HEADER
static java.util.LinkedHashMap<java.lang.String,java.lang.String>
httpnameMap
protected boolean
initEditIcon
static java.lang.String
JAVASCRIPT_CODE_SET_ATTRIBUTE
Request attribute name for theSet
of JavaScript code used in current page.static java.lang.String
JAVASCRIPT_SET_ATTRIBUTE
Request attribute name for theSet
of JavaScript path used in current page.static java.util.LinkedHashSet<java.lang.String>
jsboSet
static java.util.LinkedHashSet<java.lang.String>
jsfoSet
protected javax.servlet.jsp.JspWriter
out
protected javax.servlet.jsp.PageContext
pageContext
static java.lang.String
REVISION
protected static java.lang.String
SHOW_EDIT_ICON
static java.lang.String
STYLE_HEADER
-
Fields 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, workspace
-
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
-
Fields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADMIN_NOTES_PROP, 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, DEFAULT_PHOTO_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, 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_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, 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, TEMPLATE_TAB, 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, 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
Constructors Constructor Description JcmsJspContext()
If you use this constructor, pageContext or request must be initialized at a later timeJcmsJspContext(javax.servlet.jsp.PageContext pageContext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addAvoidanceLink(java.lang.String target, java.lang.String label)
Adds an avoidance link on the pagevoid
addBodyAttributes(java.lang.String name, java.lang.String value)
Adds body attributes.void
addCSSHeader(java.lang.String path)
Adds a css header.void
addCSSHeader(java.lang.String[] paths)
Adds css headers.void
addCSSHeader(java.lang.String path, java.lang.String media)
Adds a css header.void
addCSSHeader(java.util.Map<java.lang.String,java.lang.String> paths)
Adds css headers.void
addCustomHeader(java.lang.String content)
Adds inline content header.java.lang.String
addHandlebarTemplate(java.lang.String name, java.lang.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.void
addHttpEquivHeader(java.lang.String httpequiv, java.lang.String content)
Adds http-equiv header.void
addHttpNameHeader(java.lang.String name, java.lang.String content)
Adds http-name header.void
addJavaScript(java.lang.String path)
Adds a javascript file to the current page.void
addJavaScript(java.lang.String[] paths)
Adds several javascript files to the current page.void
addJavaScript(java.util.Collection<java.lang.String> pathsColl)
Adds several javascript files to the current page.void
addJavaScriptCode(java.lang.String code)
Adds some javascript CODE to be executed on page load (or an after an ajax update).void
addPrefetchHeader(java.lang.String path)
Adds a prefetch header.void
addStyleHeader(java.lang.String cssquery)
Adds inline style header.void
addStyleHeader(java.lang.String cssquery, java.lang.String media)
Adds inline style header.void
addWebAssets(java.lang.String feature)
Adds web assets (JS/CSS resources) for given feature.boolean
checkAccess(java.lang.String resource)
Check if the current member is authorized to access the specified resource.boolean
checkAccess(java.lang.String resource, java.util.Map<java.lang.String,java.lang.Object> ctxt)
Check if the current member is authorized to access the specified resource.boolean
checkCSRF()
Check that the current request validates CSRF prevention requirements.void
debugDisplayContext()
void
disablePacker()
Force disable CSS & JS packer for all CSS & JS of the current request only.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).java.lang.Object
getAjaxRequestAttribute(java.lang.String key)
Returns the attribute value associated to given key if the attribute has been stored for the ajax scopejava.lang.String
getAjaxRequestId()
Retrieve the Ajax Request Id for the current requestjava.util.Map
getAllHeadersDiffMap(java.util.Map oldMap)
Returns a Map of "Header Name" / "Header Map" that contains added items since given mapjava.util.Map
getAllHeadersMap()
Returns a Map of "Header Name" / "Header Map" that contains all current headers.java.util.Map<java.lang.String,java.lang.String>
getAvoidanceLinks()
static java.util.Map<java.lang.String,java.lang.String>
getBackOfficeCSSHeader()
Returns BackOffice CSS header.static java.util.Set<java.lang.String>
getBackOfficeJavaScriptSet()
Returns BackOffice JavaScript files.java.util.Map<java.lang.String,java.lang.String>
getBodyAttributes()
Returns a map of body attributesPublication
getContentForm()
java.util.Map<java.lang.String,java.lang.String>
getCSSHeaders()
Returns a map of CSS headers.Category[]
getCtxCategories()
Category
getCurrentCategory()
java.util.Collection
getCustomHeaders()
Returns a Map of Custom headers.java.lang.String
getDocType(java.lang.String defaultValue)
This method return the doc type set in request attribute "docType" Otherwise use the default value.java.util.LinkedHashMap<java.lang.String,java.lang.String>
getFinalCSSFooterMap()
Retrieve the final (ultimate) map of CSS files to be added in footer if addCSSheader was invoked after doEmptyHeader.jspf executionjava.util.LinkedHashMap<java.lang.String,java.lang.String>
getFinalCSSMap()
Retrieve the final (ultimate) map of CSS files (and media to be used in the page).java.util.LinkedHashSet<java.lang.String>
getFinalJavaScriptSet()
Retrieve the final (ultimate) set of JavaScript file to be used in the page.static java.util.Map<java.lang.String,java.lang.String>
getFrontOfficeCSSHeader()
Returns FronOffice CSS header.static java.util.Set<java.lang.String>
getFrontOfficeJavaScriptSet()
Returns FronOffice JavaScript files.java.lang.String
getHandlebarTemplates()
java.util.Map<java.lang.String,java.lang.String>
getHttpEquivHeaders()
Returns a map of Meta httpequiv headers.java.util.Map<java.lang.String,java.lang.String>
getHttpNameHeaders()
Returns a map of Meta name headers.java.util.LinkedHashSet<java.lang.String>
getJavaScriptCodeSet()
Retrieves the javascript CODE that have been setup to be called on current page load.java.util.LinkedHashSet<java.lang.String>
getJavaScriptSet()
Retrieves the javascript files that have been setup for current page.org.jabsorb.JSONRPCBridge
getJSONBridge()
Returns the JSON-RPC Bridge declared by the InitFilterjavax.servlet.jsp.PageContext
getPageContext()
java.lang.String
getPageTitle(java.lang.String defaultValue)
This method return the title of the pagejava.lang.String
getPageZone(java.lang.String defaultValue)
This method return the zone of the page.PortalInterface
getPortal()
Category
getPortalCategory()
PortalElement
getPortlet()
Publication
getPublication()
java.util.Map<java.lang.String,java.lang.String>
getStyleHeaders()
Returns a Map of Style headers.java.lang.String
getTemplateUsage()
void
internalSetupEmptyHeader()
Convenient method to setup all headers and delegate to policy filters This method must be called before printing headersboolean
isEditIcon()
Deprecated.Use new method isEditIcon with workspace and data as parametersboolean
isEditIcon(Workspace ws, Publication pub)
boolean
isEditIconForPublish(Workspace ws, java.lang.Class clazz)
boolean
isEditIconForPublish(Workspace ws, java.util.Set<java.lang.Class<?>> classSet)
boolean
isPrintView()
void
registerDisplayContext(DisplayContext ctxt)
Register the given DisplayContext into the JcmsContextjava.lang.Object
removeAjaxRequestAttribute(java.lang.String key)
Remove a request attribute persistent in the AJAX request Scope.void
setAjaxRequestAttribute(java.lang.String key, java.lang.Object value)
Set a request attribute persistent in the AJAX request Scopevoid
setAjaxRequestId(java.lang.String ajaxReqId)
Set the Ajax Request Id for the current JcmsContextvoid
setAllHeadersDiffMap(java.util.Map oldMap)
Adds header diff map to current contextvoid
setDocType(java.lang.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
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 variablesvoid
setPageTitle(java.lang.String title)
This method set custom page title to append to header tag.void
setPageZone(java.lang.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 hiddenvoid
setTemplateUsage(java.lang.String usage)
Set the current template usage.boolean
showEditIcon()
Returns editIcon state.boolean
showEditIcon(Workspace ws, Data pub)
boolean
showEditIcon(Workspace ws, Data pub, java.lang.Class clazz)
java.lang.String
workaroundBrowserBaseHrefBug(java.lang.String path)
If needed, apply workaround for specified path.-
Methods inherited from class com.jalios.jcms.context.JcmsContext
addCookie, addMsg, addMsg, addMsgSession, addMsgSession, addToastr, addToastr, addToastrSession, addToastrSession, applySelector, 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, getUploadedFile, getUploadedFileList, getUploadedFiles, getUploadedFiles, getUrlWithCommonUpdatedParams, getUserCountry, getUserLang, getUserLocale, getUserZoneId, getWarningMsg, getWarningMsgList, getWarningMsgSession, getWarningMsgSessionList, getWorkspace, glp, isAdmin, isAdminZone, isAjaxRequest, isDBMember, isDebug, isDebugTemplate, isInFrontOffice, isLogged, isWebdavAccess, isWorkZone, removeMessage, removeMessage, retrieveUploadedFile, 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 Detail
-
REVISION
public static final java.lang.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 java.lang.String SHOW_EDIT_ICON
- See Also:
- Constant Field Values
-
AJAX_REQUEST_ATTRIBUTES
public static final java.lang.String AJAX_REQUEST_ATTRIBUTES
- See Also:
- Constant Field Values
-
JAVASCRIPT_SET_ATTRIBUTE
public static final java.lang.String JAVASCRIPT_SET_ATTRIBUTE
Request attribute name for theSet
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 java.lang.String JAVASCRIPT_CODE_SET_ATTRIBUTE
Request attribute name for theSet
of JavaScript code used in current page.- Since:
- jcms-6.0
- See Also:
addJavaScriptCode(String)
,getJavaScriptCodeSet()
, Constant Field Values
-
CSS_HEADER
public static final java.lang.String CSS_HEADER
- See Also:
- Constant Field Values
-
CSS_FOOTER
public static final java.lang.String CSS_FOOTER
- See Also:
- Constant Field Values
-
STYLE_HEADER
public static final java.lang.String STYLE_HEADER
- See Also:
- Constant Field Values
-
CUSTOM_HEADER
public static final java.lang.String CUSTOM_HEADER
- See Also:
- Constant Field Values
-
BODY_HEADER
public static final java.lang.String BODY_HEADER
- See Also:
- Constant Field Values
-
HTTPEQUIV_HEADER
public static final java.lang.String HTTPEQUIV_HEADER
- See Also:
- Constant Field Values
-
HTTPNAME_HEADER
public static final java.lang.String HTTPNAME_HEADER
- See Also:
- Constant Field Values
-
httpequivMap
public static final java.util.LinkedHashMap<java.lang.String,java.lang.String> httpequivMap
-
httpnameMap
public static final java.util.LinkedHashMap<java.lang.String,java.lang.String> httpnameMap
-
cssfoMap
public static final java.util.LinkedHashMap<java.lang.String,java.lang.String> cssfoMap
-
cssboMap
public static final java.util.LinkedHashMap<java.lang.String,java.lang.String> cssboMap
-
jsfoSet
public static final java.util.LinkedHashSet<java.lang.String> jsfoSet
-
jsboSet
public static final java.util.LinkedHashSet<java.lang.String> jsboSet
-
-
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 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
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 java.lang.String 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
public void setTemplateUsage(java.lang.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
@Deprecated public boolean 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
public boolean isEditIconForPublish(Workspace ws, java.util.Set<java.lang.Class<?>> classSet)
- Parameters:
ws
- theWorkspace
used to check rightsclassSet
- the Set ofPublication
class 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
public boolean isEditIconForPublish(Workspace ws, java.lang.Class clazz)
- Parameters:
ws
- theWorkspace
used to check rightsclazz
- thePublication
class 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
public boolean isEditIcon(Workspace ws, Publication pub)
- Parameters:
ws
- theWorkspace
used to check rightspub
- thePublication
to 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(Workspace ws, Data pub)
- Parameters:
ws
- theWorkspace
used to check rightspub
- theData
to 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(Workspace ws, Data pub, java.lang.Class clazz)
- Parameters:
ws
- theWorkspace
used to check rightspub
- theData
to edit used to check rightsclazz
- the class ofData
to 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
public void setAjaxRequestId(java.lang.String ajaxReqId)
Set the Ajax Request Id for the current JcmsContext- Parameters:
ajaxReqId
- the Ajax Request Id
-
getAjaxRequestId
public java.lang.String getAjaxRequestId()
Retrieve the Ajax Request Id for the current request- Returns:
- ajaxReqId the Ajax Request Id
-
setAjaxRequestAttribute
public void setAjaxRequestAttribute(java.lang.String key, java.lang.Object value)
Set a request attribute persistent in the AJAX request Scope- Parameters:
key
- the keyvalue
- the value
-
getAjaxRequestAttribute
public java.lang.Object getAjaxRequestAttribute(java.lang.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 java.lang.Object removeAjaxRequestAttribute(java.lang.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
-
setPageTitle
public void setPageTitle(java.lang.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 java.lang.String getPageTitle(java.lang.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(java.lang.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 java.lang.String getPageZone(java.lang.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(java.lang.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 java.lang.String getDocType(java.lang.String defaultValue)
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
public void addHttpEquivHeader(java.lang.String httpequiv, java.lang.String content)
Adds http-equiv header.- Parameters:
httpequiv
- the header keycontent
- the header value- Since:
- jcms-5.6.0
-
getHttpEquivHeaders
public java.util.Map<java.lang.String,java.lang.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(java.lang.String name, java.lang.String content)
Adds http-name header.- Parameters:
name
- the header keycontent
- the header value- Since:
- jcms-5.6.0
-
getHttpNameHeaders
public java.util.Map<java.lang.String,java.lang.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(java.lang.String name, java.lang.String value)
Adds body attributes.- Parameters:
name
- the attribute namevalue
- the attribute value- Since:
- jcms-5.7.0
-
getBodyAttributes
public java.util.Map<java.lang.String,java.lang.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(java.lang.String content)
Adds inline content header.- Parameters:
content
- the inline content to add- Since:
- jcms-5.7.0
-
getCustomHeaders
public java.util.Collection getCustomHeaders()
Returns a Map of Custom headers.- Returns:
- Set a set of Custom Headers
- Since:
- jcms-5.7.0
-
addStyleHeader
public void addStyleHeader(java.lang.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(java.lang.String cssquery, java.lang.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 addmedia
- the css media
-
getStyleHeaders
public java.util.Map<java.lang.String,java.lang.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
-
addPrefetchHeader
public void addPrefetchHeader(java.lang.String path)
Adds a prefetch header.- Parameters:
path
- the prefetch path
-
addCSSHeader
public void addCSSHeader(java.lang.String path)
Adds a css header.- Parameters:
path
- the CSS path
-
addCSSHeader
public void addCSSHeader(java.lang.String path, java.lang.String media)
Adds a css header.- Parameters:
path
- the CSS pathmedia
- the Media path- Since:
- jcms-5.6.0
-
addCSSHeader
public void addCSSHeader(java.lang.String[] paths)
Adds css headers.- Parameters:
paths
- the CSS path
-
addCSSHeader
public void addCSSHeader(java.util.Map<java.lang.String,java.lang.String> paths)
Adds css headers.- Parameters:
paths
- the CSS path
-
getCSSHeaders
public java.util.Map<java.lang.String,java.lang.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 java.util.Map<java.lang.String,java.lang.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 java.util.Map<java.lang.String,java.lang.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
-
getFrontOfficeJavaScriptSet
public static java.util.Set<java.lang.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 java.util.Set<java.lang.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 and delegate to policy filters This method must be called before printing headers- Since:
- jcms-5.7.0
-
getFinalCSSMap
public java.util.LinkedHashMap<java.lang.String,java.lang.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.
-
getFinalCSSFooterMap
public java.util.LinkedHashMap<java.lang.String,java.lang.String> getFinalCSSFooterMap()
Retrieve the final (ultimate) map of CSS files to be added in footer if addCSSheader was invoked after doEmptyHeader.jspf executionIf 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
public java.util.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 java.util.Map getAllHeadersDiffMap(java.util.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(java.util.Map oldMap)
Adds header diff map to current context- Parameters:
oldMap
- the Map to work with
-
addWebAssets
public void addWebAssets(java.lang.String feature)
Adds web assets (JS/CSS resources) for given feature.- Parameters:
feature
- a feature id, declared using properties- Since:
- jcms-10.0.2
- See Also:
WebAssetsUtils.addWebAssets(JcmsJspContext, String)
-
addJavaScript
public void addJavaScript(java.lang.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(java.lang.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(java.util.Collection<java.lang.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 java.util.LinkedHashSet<java.lang.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 java.util.LinkedHashSet<java.lang.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.
-
workaroundBrowserBaseHrefBug
public java.lang.String workaroundBrowserBaseHrefBug(java.lang.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(java.lang.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 java.util.LinkedHashSet<java.lang.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(java.lang.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(java.lang.String resource, java.util.Map<java.lang.String,java.lang.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 optional context map- Returns:
- true if the access is authorized, false otherwise
- Since:
- jcms-7.0
-
checkCSRF
public boolean checkCSRF()
Check that the current request validates CSRF prevention requirements.This method does not check that CSRF is enabled, see
HttpUtil.isCSRFEnabled()
.- Returns:
- true if the request is safe (or null), false if the request cannot be guaranteed for safety
-
addHandlebarTemplate
public java.lang.String addHandlebarTemplate(java.lang.String name, java.lang.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. 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
public java.lang.String getHandlebarTemplates()
- Returns:
- all handlebar templates declared in current page
-
addAvoidanceLink
public void addAvoidanceLink(java.lang.String target, java.lang.String label)
Adds an avoidance link on the page- Parameters:
target
- the targetlabel
- the label of the avoidance link
-
getAvoidanceLinks
public java.util.Map<java.lang.String,java.lang.String> getAvoidanceLinks()
- Returns:
- all avoidance links for current page
-
-