public class JcmsJspContext extends JcmsContext
JcmsJspContext jspCtx = request.getAttribute("jcmsContext")
JcmsJspContext jspCtx = new JcmsJspContext(pageContext)
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")); } } }
<%@ 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(); %>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AJAX_REQUEST_ATTRIBUTES |
static java.lang.String |
BODY_HEADER |
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 the
Set of JavaScript code used in current page. |
static java.lang.String |
JAVASCRIPT_SET_ATTRIBUTE
Request attribute name for the
Set 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 |
browser, caddy, channel, inFO, initDone, initWorkspace, isAdmin, isAjaxRequest, isDBMember, isDebug, isLogged, loggedMember, request, response, userCountry, userLang, userLocale, workspace
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, 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_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, 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, 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, URL_REGEXP, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
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 and Description |
---|
JcmsJspContext()
If you use this constructor, pageContext or request must be initialized at a later time
|
JcmsJspContext(javax.servlet.jsp.PageContext pageContext) |
Modifier and Type | Method and Description |
---|---|
void |
addBodyAttributes(java.lang.String name,
java.lang.String value)
Adds body attributes.
|
void |
addCSSHeader(java.util.Map<java.lang.String,java.lang.String> paths)
Adds css headers.
|
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 |
addCustomHeader(java.lang.String content)
Adds inline content header.
|
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.util.Collection<java.lang.String> pathsColl)
Adds several javascript files to the current page.
|
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 |
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.
|
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 scope
|
java.lang.String |
getAjaxRequestId()
Retrieve the Ajax Request Id for the current request
|
java.util.Map |
getAllHeadersDiffMap(java.util.Map oldMap)
Returns a Map of "Header Name" / "Header Map"
that contains added items since given map
|
java.util.Map |
getAllHeadersMap()
Returns a Map of "Header Name" / "Header Map"
that contains all current headers.
|
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 attributes
|
Publication |
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> |
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.
|
int |
getFormElementCount() |
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.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 InitFilter
|
static java.lang.String |
getPackVersion()
Retrieve JS and CSS pack version used in packer URL for improved caching management.
|
javax.servlet.jsp.PageContext |
getPageContext() |
java.lang.String |
getPageTitle(java.lang.String defaultValue)
This method return the title of the page
|
java.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 headers
|
boolean |
isEditIcon()
Deprecated.
Use new method isEditIcon with workspace and data as parameters
|
boolean |
isEditIcon(Workspace ws,
Publication pub) |
boolean |
isPrintView() |
void |
registerDisplayContext(DisplayContext ctxt)
Register the given DisplayContext into the JcmsContext
|
java.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 Scope
|
void |
setAjaxRequestId(java.lang.String ajaxReqId)
Set the Ajax Request Id for the current JcmsContext
|
void |
setAllHeadersDiffMap(java.util.Map oldMap)
Adds header diff map to current context
|
void |
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 |
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(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 hidden
|
void |
setTemplateUsage(java.lang.String usage)
Set the current template usage.
|
boolean |
showEditIcon()
Returns editIcon state.
|
boolean |
showEditIcon(Workspace ws,
Data pub) |
java.lang.String |
workaroundBrowserBaseHrefBug(java.lang.String path)
If needed, apply workaround for specified path.
|
addCookie, addMsg, addMsg, addMsgSession, addMsgSession, applySelector, forceWorkspaceUpdate, getBaseUrl, getBrowser, getCaddy, getContextPath, getErrorMsg, getErrorMsgList, getErrorMsgSession, getErrorMsgSessionList, getInfoMsg, getInfoMsgList, getInfoMsgSession, getInfoMsgSessionList, getLoggedMember, getMsgList, getMsgSessionList, getRequest, getResponse, getSession, getUploadedFile, getUploadedFileList, getUrlWithCommonUpdatedParams, getUserCountry, getUserLang, getUserLocale, getWarningMsg, getWarningMsgList, getWarningMsgSession, getWarningMsgSessionList, getWorkspace, glp, isAdmin, isAjaxRequest, isDBMember, isDebug, isInFrontOffice, isLogged, isWebdavAccess, removeMessage, removeMessage, retrieveUploadedFile, select, sendForbidden, sendForbidden, sendRedirect, sendRedirect, sendRedirect, sendRedirect, setErrorMsg, setErrorMsg, setErrorMsgSession, setErrorMsgSession, setInfoMsg, setInfoMsg, setInfoMsgSession, setInfoMsgSession, setLoggedMember, setRequest, setResponse, setWarningMsg, setWarningMsg, setWarningMsgSession, setWarningMsgSession, validateRegexp, validateSchedule
public static final java.lang.String REVISION
protected javax.servlet.jsp.PageContext pageContext
protected javax.servlet.jsp.JspWriter out
protected boolean initEditIcon
protected boolean editIcon
protected static final java.lang.String SHOW_EDIT_ICON
public static final java.lang.String AJAX_REQUEST_ATTRIBUTES
public static final java.lang.String JAVASCRIPT_SET_ATTRIBUTE
Set
of JavaScript path used in current page.addJavaScript(String)
,
addJavaScript(String[])
,
getJavaScriptSet()
,
Constant Field Valuespublic static final java.lang.String JAVASCRIPT_CODE_SET_ATTRIBUTE
Set
of JavaScript code used in current page.addJavaScriptCode(String)
,
getJavaScriptCodeSet()
,
Constant Field Valuespublic static final java.lang.String CSS_HEADER
public static final java.lang.String STYLE_HEADER
public static final java.lang.String CUSTOM_HEADER
public static final java.lang.String BODY_HEADER
public static final java.lang.String HTTPEQUIV_HEADER
public static final java.lang.String HTTPNAME_HEADER
public static final java.util.LinkedHashMap<java.lang.String,java.lang.String> httpequivMap
public static final java.util.LinkedHashMap<java.lang.String,java.lang.String> httpnameMap
public static final java.util.LinkedHashMap<java.lang.String,java.lang.String> cssfoMap
public static final java.util.LinkedHashMap<java.lang.String,java.lang.String> cssboMap
public static final java.util.LinkedHashSet<java.lang.String> jsfoSet
public static final java.util.LinkedHashSet<java.lang.String> jsboSet
public JcmsJspContext()
public JcmsJspContext(javax.servlet.jsp.PageContext pageContext)
public void forceUpdate()
forceUpdate
in class JcmsContext
public void setPageContext(javax.servlet.jsp.PageContext pageContext)
pageContext
- the jsp PageContext to be used for initialization of this JcmsJspContextpublic javax.servlet.jsp.PageContext getPageContext()
public Publication getPublication()
public Publication getContentForm()
public PortalElement getPortlet()
public PortalInterface getPortal()
public Category getCurrentCategory()
public Category getPortalCategory()
public Category[] getCtxCategories()
public java.lang.String getTemplateUsage()
public boolean isPrintView()
public void setTemplateUsage(java.lang.String usage)
usage
- the current template usagepublic void registerDisplayContext(DisplayContext ctxt)
ctxt
- the DisplayContextpublic void debugDisplayContext()
public boolean isEditIcon()
public boolean isEditIcon(Workspace ws, Publication pub)
ws
- the Workspace
used to check rightspub
- the Publication
to edit used to check rights
Returns true if edit area must be displayed.
public boolean showEditIcon(Workspace ws, Data pub)
ws
- the Workspace
used to check rightspub
- the Data
to edit used to check rights
Returns true if edit area must be displayed.
public boolean showEditIcon()
public void setShowEditIcon(boolean show)
show
- boolean true to display EditAreapublic void setEditIcon(boolean editIcon, boolean request, boolean session)
editIcon
- the new edit Icon staterequest
- store in requestsession
- store in sessionpublic void forceEditIcon(boolean editIcon)
editIcon
- the new edit Icon statepublic void setAjaxRequestId(java.lang.String ajaxReqId)
ajaxReqId
- the Ajax Request Idpublic java.lang.String getAjaxRequestId()
public void setAjaxRequestAttribute(java.lang.String key, java.lang.Object value)
key
- the keyvalue
- the valuepublic java.lang.Object getAjaxRequestAttribute(java.lang.String key)
key
- the keypublic java.lang.Object removeAjaxRequestAttribute(java.lang.String key)
key
- the keypublic org.jabsorb.JSONRPCBridge getJSONBridge()
public int getFormElementCount()
public void setFormElementCount(int count)
public void setPageTitle(java.lang.String title)
title
- the custom title headerpublic java.lang.String getPageTitle(java.lang.String defaultValue)
defaultValue
- the default value to returnpublic void setPageZone(java.lang.String zone)
zone
- the custom zonepublic java.lang.String getPageZone(java.lang.String defaultValue)
defaultValue
- the default zonepublic void setDocType(java.lang.String docType)
docType
- the doc typepublic java.lang.String getDocType(java.lang.String defaultValue)
defaultValue
- the default value if there is no doctypepublic void addHttpEquivHeader(java.lang.String httpequiv, java.lang.String content)
httpequiv
- the header keycontent
- the header valuepublic java.util.Map<java.lang.String,java.lang.String> getHttpEquivHeaders()
public void addHttpNameHeader(java.lang.String name, java.lang.String content)
name
- the header keycontent
- the header valuepublic java.util.Map<java.lang.String,java.lang.String> getHttpNameHeaders()
public void addBodyAttributes(java.lang.String name, java.lang.String value)
name
- the attribute namevalue
- the attribute valuepublic java.util.Map<java.lang.String,java.lang.String> getBodyAttributes()
public void addCustomHeader(java.lang.String content)
content
- the inline content to addpublic java.util.Collection getCustomHeaders()
public void addStyleHeader(java.lang.String cssquery)
cssquery
- the inline style to addpublic void addStyleHeader(java.lang.String cssquery, java.lang.String media)
cssquery
- the inline style to addmedia
- the css mediapublic java.util.Map<java.lang.String,java.lang.String> getStyleHeaders()
public void addPrefetchHeader(java.lang.String path)
path
- the prefetch pathpublic void addCSSHeader(java.lang.String path)
path
- the CSS pathpublic void addCSSHeader(java.lang.String path, java.lang.String media)
path
- the CSS pathmedia
- the Media pathpublic void addCSSHeader(java.lang.String[] paths)
paths
- the CSS pathpublic void addCSSHeader(java.util.Map<java.lang.String,java.lang.String> paths)
paths
- the CSS pathpublic java.util.Map<java.lang.String,java.lang.String> getCSSHeaders()
public static java.util.Map<java.lang.String,java.lang.String> getFrontOfficeCSSHeader()
public static java.util.Map<java.lang.String,java.lang.String> getBackOfficeCSSHeader()
public static java.util.Set<java.lang.String> getFrontOfficeJavaScriptSet()
public static java.util.Set<java.lang.String> getBackOfficeJavaScriptSet()
public void internalSetupEmptyHeader()
public java.util.LinkedHashMap<java.lang.String,java.lang.String> getFinalCSSMap()
If csspacker is enabled (property "channel.css-packer.enabled"
), the existing css map is
converted into a new map of packed resources.
public void disablePacker()
This method must be invoked prior to inclusion of doEmptyHeader.jsp (for CSS) and doEmptyFooter (for JS).
public java.util.Map getAllHeadersMap()
public java.util.Map getAllHeadersDiffMap(java.util.Map oldMap)
oldMap
- the map to diff withpublic void setAllHeadersDiffMap(java.util.Map oldMap)
oldMap
- the Map to work withpublic void addJavaScript(java.lang.String path)
path
- a relative JavaScript path (e.g "plugins/MyPlugin/js/plugin.js"
)public void addJavaScript(java.lang.String[] paths)
paths
- an array of relative JavaScript path (e.g { "plugins/MyPlugin/js/myscript1.js", "plugins/MyPlugin/js/myscript2.js" }
)public void addJavaScript(java.util.Collection<java.lang.String> pathsColl)
pathsColl
- a collection of relative JavaScript path (e.g { "plugins/MyPlugin/js/myscript1.js", "plugins/MyPlugin/js/myscript2.js" }
)public java.util.LinkedHashSet<java.lang.String> getJavaScriptSet()
The returned set will only contains file that have been added prior to invocation of this method. Some files may be added after.
public java.util.LinkedHashSet<java.lang.String> getFinalJavaScriptSet()
If jspacker is enabled, the existing javascript set is converted into a new set of packed resources (unless resource contain a 'nopack' querystring argument).
public static java.lang.String getPackVersion()
public java.lang.String workaroundBrowserBaseHrefBug(java.lang.String path)
path
- the path to convert to absolute URL, if neededpublic void addJavaScriptCode(java.lang.String code)
jcmsContext.addJavaScriptCodeOnLoad("someMethod(); alert('Page has been loaded by browser'); ");
code
- some javascript codepublic java.util.LinkedHashSet<java.lang.String> getJavaScriptCodeSet()
The returned set will only contains code that have been added prior to invocation of this method. Some code may be added after.
public boolean checkAccess(java.lang.String resource)
boolean isAuthorized = checkAccess(loggedMember, "admin/dev/store-cleaner");
resource
- a resource URI using a path representation, eg "admin/dev/store-cleaner"public boolean checkAccess(java.lang.String resource, java.util.Map<java.lang.String,java.lang.Object> ctxt)
boolean isAuthorized = checkAccess(loggedMember, "admin-ws/types/content", ctxtMap);
resource
- a resource URI using a path representation, eg "admin/dev/store-cleaner"ctxt
- an optionnal context mappublic boolean checkCSRF()
This method does not check that CSRF is enabled, see HttpUtil.isCSRFEnabled()
.
Copyright © 2001-2010 Jalios SA. All Rights Reserved.