Class JcmsContext

  • All Implemented Interfaces:
    JcmsConstants, JaliosConstants
    Direct Known Subclasses:
    JcmsJspContext, PagerHandler

    public class JcmsContext
    extends java.lang.Object
    implements JcmsConstants
    This class keep track of all variables declared in doInitPage and give access to convenient methods when you are not in a jsp (servlet, tag, custom class etc) To use methods of this class, You MUST set a valid request and response (either with the contructor or with the setters). The current JcmsContext can be retrieved either through the variable jcmsContext in a JSP or through the method Channel.getCurrentJcmsContext().
    Since:
    jcms-5.0.0
    Author:
    Olivier Jaquemet
    • Field Detail

      • channel

        protected static final Channel channel
      • initDone

        protected boolean initDone
      • initWorkspace

        protected boolean initWorkspace
      • request

        protected javax.servlet.http.HttpServletRequest request
      • response

        protected javax.servlet.http.HttpServletResponse response
      • isLogged

        protected boolean isLogged
      • isAdmin

        protected boolean isAdmin
      • isDBMember

        protected boolean isDBMember
      • isDebug

        protected boolean isDebug
      • isDebugTemplatePath

        protected boolean isDebugTemplatePath
      • loggedMember

        protected Member loggedMember
      • userLocale

        protected java.util.Locale userLocale
      • userZoneId

        protected java.time.ZoneId userZoneId
      • userLang

        protected java.lang.String userLang
      • userCountry

        protected java.lang.String userCountry
      • browser

        protected Browser browser
      • caddy

        protected Caddy caddy
      • inFO

        protected boolean inFO
      • isAjaxRequest

        protected boolean isAjaxRequest
    • Constructor Detail

      • JcmsContext

        public JcmsContext()
        If you use this constructor, request must be initialized at a later time (This constructor is kept to allow JcmsJspContext to be initialized as a bean, with pageContext parameter)
      • JcmsContext

        public JcmsContext​(javax.servlet.http.HttpServletRequest request,
                           javax.servlet.http.HttpServletResponse response)
    • 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).
      • setRequest

        public void setRequest​(javax.servlet.http.HttpServletRequest request)
        Setter for the request. Will initialize all the variable of the JcmsContext if available in the request. (Therefore, it must be called after all the treatements done in doInitPage)
        Parameters:
        request - the HttpServletRequest from twhich to retrieve all jcms context information.
      • getRequest

        public javax.servlet.http.HttpServletRequest getRequest()
        Returns:
        the request of this JcmsContext
      • setResponse

        public void setResponse​(javax.servlet.http.HttpServletResponse response)
        Setter for the response.
        Response is only needed for some methods of the context such as sendRedirect(String)
        Parameters:
        response - the HttpServletResponse to use when needed.
      • getResponse

        public javax.servlet.http.HttpServletResponse getResponse()
        Returns:
        the response of this JcmsContext
      • getSession

        public javax.servlet.http.HttpSession getSession()
        Shorter Method to get Session from request
        Returns:
        HttpSession the Session
      • getUploadedFiles

        public java.util.List<DocUploadInfo> getUploadedFiles​(java.lang.String field)
        Performs upload for the given field.
        Parameters:
        field - the submited field
        Returns:
        a List of uploaded files DocUploadInfo, never return null
        Since:
        jcms-10.0.6 / JCMS-8317
        See Also:
        getUploadedFiles(String, FileUploadOptions)
      • getUploadedFile

        @Deprecated
        public java.lang.Object getUploadedFile​(java.lang.String field,
                                                boolean isFileDocument,
                                                boolean override)
        Performs upload for the given field to JCMS upload directory. Calling method must handle job around file like creating or updating associated FileDocument.
        Parameters:
        field - the submited field
        isFileDocument - upload to a FileDocument path upload/docs/...
        override - IGNORED
        Returns:
        Object a List of uploaded files (DocUploadInfo) or a DocUploadInfo
        Since:
        jcms-5.7.0
        See Also:
        UploadManager.getUploadedFile(JcmsContext, String, boolean, boolean)
      • retrieveUploadedFile

        @Deprecated
        protected DocUploadInfo retrieveUploadedFile​(org.apache.commons.fileupload.FileItem item,
                                                     boolean isFileDocument,
                                                     boolean override)
        Performs upload of a given FileItem to JCMS upload directory. Calling method must handle job around file like creating or updating associated FileDocument.
        Parameters:
        item - the FileItem handling uploaded file information
        isFileDocument - upload to a FileDocument path upload/docs/...
        override - IGNORED
        Returns:
        DocUploadInfo the uploaded DocUploadInfo
        Since:
        jcms-5.7.0
        See Also:
        UploadManager.retrieveUploadedFile(FileItem, boolean, boolean)
      • isLogged

        public boolean isLogged()
        Return the user logging status for current request. Fast: this method is cached using initDone (it is recomputed only on forceUpdate() or setRequest()).
        Returns:
        true if a member is logged, false otherwise.
      • isWebdavAccess

        public boolean isWebdavAccess()
        Check if the current request is a Webdav Access
        Returns:
        boolean true if it is a Webdav Access
        Since:
        jcms-5.5.0
      • isDebug

        public boolean isDebug()
        Return the debug state of the request depending on request parameter "debug"
        Returns:
        true if request is in debug mode
      • isDebugTemplate

        public boolean isDebugTemplate()
        Return the debug template state of the request depending on request parameters "_debugTemplate", and "_debugTemplateSession" (since jcms-10.0.8).
        Returns:
        true if request or session is in debug template mode
        Since:
        jcms-10.0.5
      • isAdmin

        public boolean isAdmin()
        Return the admin status of the current logged user. Fast: this method is cached using initDone (it is recomputed only on forceUpdate() or setRequest()).
        Returns:
        true if the logged member is admin, false otherwise.
      • isDBMember

        public boolean isDBMember()
        Return the DB status of the current logged user. Fast: this method is cached using initDone (it is recomputed only on forceUpdate() or setRequest()).
        Returns:
        true if the logged member is an DBMember, false otherwise.
      • getLoggedMember

        public Member getLoggedMember()
        Retrieve the loggedMember variable for this context. Fast: this method is cached using initDone (it is recomputed only on forceUpdate() or setRequest()).
        Returns:
        the logged member (or null if nobody is logged)
      • setLoggedMember

        public void setLoggedMember​(Member mbr)
        Set the logged member for this context.

        This methods only changed the logged member for this context instance, this method is provided in case you want to force the logged member in bean/handlers.
        It will NOT change the logged member of the current request, if you want to do that, see AuthenticationHandler.

        Parameters:
        mbr - the Member to set as the currently logged Member.
        Since:
        jcms-5.7.1
      • getUserLang

        public java.lang.String getUserLang()
        Retrieves the user lang variable for this context.
        Fast: this method is cached using initDone (it is recomputed only on forceUpdate() or setRequest()).
        Returns:
        the user lang (define in InitFilter, guessed either from logged member lang, userLang portlet action, http request Accept-Language header, or defaut channel language
      • getUserCountry

        public java.lang.String getUserCountry()
        Retrieves the user country variable for this context.
        Fast: this method is cached using initDone (it is recomputed only on forceUpdate() or setRequest()).
        Returns:
        the user country (define in InitFilter, guessed either from logged member country, http request Accept-Language header, or defaut channel language
      • getUserLocale

        public java.util.Locale getUserLocale()
        Retrieve the userLocale variable for this context.
        Fast: this method is cached using initDone (it is retrieved again only on forceUpdate() or setRequest()).
        Returns:
        the Locale associated with the user language
      • getUserZoneId

        public java.time.ZoneId getUserZoneId()
        Retrieve the userZoneId variable for this context.
        Fast: this method is cached using initDone (it is retrieved again only on forceUpdate() or setRequest()).
        Returns:
        the ZoneId associated with the current user timezone
      • isInFrontOffice

        public boolean isInFrontOffice()
        retrieve the inFO variable for this context. This parameter indicate if the jsp/servlet is in the FrontOffice or Not. Fast: this method is cached using initDone (it is retrieve again only on forceUpdate() or setRequest()).
        Returns:
        true if in FrontOffice otherwise false
      • isAdminZone

        public boolean isAdminZone()
        Returns:
        true if "zone" request attribute is equal to "AdminArea".
        Since:
        jcms-10.0.5
      • isWorkZone

        public boolean isWorkZone()
        Returns:
        true if "zone" request attribute is equal to "WorkArea".
        Since:
        jcms-10.0.5
      • forceWorkspaceUpdate

        public void forceWorkspaceUpdate()
        Force Workspace update on next getWorkspace()
      • getWorkspace

        public Workspace getWorkspace()
        Retrieve the current Workspace variable for this context either from request if inFO or from session if in back office. Fast: this method is cached using initDone (it is recomputed only on forceUpdate() or setRequest()).
        Returns:
        the Workspace associated with the current session or the default workspace in none was found in session
      • getBrowser

        public Browser getBrowser()
        Returns the Client Browser computed for this session identified from userAgent. Fast: this method is cached using initDone (it is retrieve again only on forceUpdate() or setRequest()).
        Returns:
        the Client Browser
      • getCaddy

        public Caddy getCaddy()
        Returns the caddy stored in current session. Fast: this method is cached using initDone (it is retrieve again only on forceUpdate() or setRequest()).
        Returns:
        the session caddy
      • isAjaxRequest

        public boolean isAjaxRequest()
        Check if the current request is an Ajax Request (performed through by prototypejs API). Fast: this method is cached using initDone (it is retrieve again only on forceUpdate() or setRequest()).
        Returns:
        true if request is an ajax request, false otherwise
      • sendRedirect

        public void sendRedirect​(Data data)
                          throws java.io.IOException
        Redirect to the given data (eg a publication, a category, ...) Will not redirect if data is null or if response has already been commited, but we put the request attribute "redirect" with the value of the url so that doDisplayBuffer can be able to redirect with the javascript hack.
        Parameters:
        data - the data to redirect to.
        Throws:
        java.io.IOException - if an error occured while writing in response headers
        Since:
        jcms-5.7.1
        See Also:
        sendRedirect(String, HttpServletRequest, HttpServletResponse)
      • sendRedirect

        public void sendRedirect​(java.lang.String url)
                          throws java.io.IOException
        Redirect current request to given URL. Will not redirect if response has already been commited, but we put the request attribute "redirect" with the value of the url so that doDisplayBuffer can be able to redirect with the javascript hack.
        Parameters:
        url - the url to redirect to.
        Throws:
        java.io.IOException - if an error occured while writing in response headers
        Since:
        jcms-5.0.0
        See Also:
        sendRedirect(String, HttpServletRequest, HttpServletResponse)
      • sendForbidden

        public void sendForbidden()
                           throws java.io.IOException
        Send a redirect to the forbidden page
        Throws:
        java.io.IOException - if an error occured while writing in response headers
        Since:
        jcms-5.0.0
        See Also:
        sendForbidden(HttpServletRequest, HttpServletResponse)
      • sendRedirect

        public static void sendRedirect​(java.lang.String url,
                                        javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response)
                                 throws java.io.IOException
        Redirect current request to given URL.

        The specified URL must match security configuration of HttpUtil.isValidHttpUrl(String) in order for the redirect to be performed. If the URL does not validate those requirement, the request is redirected to the webapp root.

        As of current implementation,, the redirect will not happen using HTTP if the response has already been commited. Instead a request attribute "redirect" is set with the value of the url, it is later used by doDisplayBuffer to redirect the user with a javascript hack (applies only to front office).

        Parameters:
        url - the url to redirect to.
        request - the current request from which the redirect is performed
        response - the response in which to write redirect headers
        Throws:
        java.io.IOException - if an error occured while writing in response headers
        Since:
        jcms-5.5.0
      • sendRedirect

        public static void sendRedirect​(java.lang.String url,
                                        boolean checkUrlSecurity,
                                        javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response)
                                 throws java.io.IOException
        Redirect current request to given URL.

        If checkUrlSecurity param is set to true, the specified URL must match security configuration of HttpUtil.isValidHttpUrl(String) in order for the redirect to be performed. If the URL does not validate those requirement, the request is redirected to the webapp root.

        It is highly recommended to always use method sendRedirect(String, HttpServletRequest, HttpServletResponse) which always enable this verification. Use this method and checkUrlSecurity=false only if you are absolutely sure of the specified URL security and can trust its value.

        As of current implementation,, the redirect will not happen using HTTP if the response has already been commited. Instead a request attribute "redirect" is set with the value of the url, it is later used by doDisplayBuffer to redirect the user with a javascript hack (applies only to front office).

        Parameters:
        url - the url to redirect to.
        checkUrlSecurity - if true, check the URL for validity to prevent phishing, unwanted external redirect and other forward attack. set to false to disable those verification (which is not recommended)
        request - the current request from which the redirect is performed
        response - the response in which to write redirect headers
        Throws:
        java.io.IOException - if an error occured while writing in response headers
        Since:
        jcms-7.1.0
        See Also:
        sendRedirect(String, HttpServletRequest, HttpServletResponse)
      • sendForbidden

        public static void sendForbidden​(javax.servlet.http.HttpServletRequest request,
                                         javax.servlet.http.HttpServletResponse response)
                                  throws java.io.IOException
        Send a redirect to the forbidden page if parameter forbidden is set, then redirect to the given url without logging anything.
        Parameters:
        request - the current request from which the forbidden redirect is performed
        response - the response in which to write forbidden redirect headers
        Throws:
        java.io.IOException - if an error occured while writing in response headers
        Since:
        jcms-5.5.0
      • sendError

        public void sendError​(int statusCode,
                              java.lang.String message)
        Sends an error response to the client using the specified status code and clears the output buffer.
        The server defaults to creating the response to look like an HTML-formatted server error page containing the specified message, setting the content type to "text/html", leaving cookies and other headers unmodified. If an error-page declaration has been made for the web application corresponding to the status code passed in, it will be served back in preference to the suggested msg parameter.
        If the response has already been committed, this method won't send the error message. After using this method, the response should be considered to be committed and should not be written to.
        Parameters:
        statusCode - the error status code
        message - the descriptive message
      • sendError

        public void sendError​(int statusCode)
        Sends an error response to the client using the specified status code and clears the buffer.
        This is equivalent to calling sendError(int, String) with the same status code and null for the message.
        Parameters:
        statusCode - the error status code
      • addCookie

        public void addCookie​(javax.servlet.http.Cookie cookie)
        Deprecated.
        Adds the specified cookie to the response (or in a http-equiv is the response has already been commited, in this case, only for front office use). This method can be called multiple times to set more than one cookie.

        The cookie is not added to the response if it has already been commited, instead, we put the request attribute "cookieList" with a ArrayList containing all cookies to add so that doDisplayBuffer.jsp can use "http-equiv" able to add those cookies. doDisplayBuffer.jsp is automatically called by display.jsp.
        Parameters:
        cookie - the cookie to be added
        Since:
        jcms-5.0.0
      • getContextPath

        public java.lang.String getContextPath()
        Convenient method which returns ServletUtil.getContextPath(request)
        Returns:
        the context path of the request (without trailing '/')
        Since:
        jcms-5.0.0
        See Also:
        ServletUtil.getContextPath(HttpServletRequest)
      • getBaseUrl

        public java.lang.String getBaseUrl()
        Convenient method which returns ServletUtil.getBaseUrl(request);
        Returns:
        the base url of the request
        Since:
        jcms-5.0.0
        See Also:
        ServletUtil.getBaseUrl(HttpServletRequest)
      • getUrlWithCommonUpdatedParams

        public java.lang.String getUrlWithCommonUpdatedParams​(java.lang.String[] names,
                                                              java.lang.String[] values,
                                                              boolean encodeParams)
        Parameters:
        names - an array of parameter names added or updated the url
        values - an array of values added or updated the url corresponding to names
        encodeParams - whether to do a encodeURL on given param (if false, don't forget to do the encodeURL yourself on the parameters which need it! it is provided as a performance boost because encodeURL can be slow)
        Returns:
        Returns a relative URL with the given parameters added or updated plus common parameters: portal, id, portlet, jsp, cid if they are in the current request parameters
        See Also:
        PortalManager.getUrlWithCommonUpdatedParams(HttpServletRequest, String[], String[], boolean)
      • setSuccessMsg

        public void setSuccessMsg​(java.lang.String msg)
        Set JCMS success message for current request (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
      • setSuccessMsgSession

        public void setSuccessMsgSession​(java.lang.String msg)
        Set JCMS success message for current session (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
      • setInfoMsg

        public void setInfoMsg​(java.lang.String msg)
        Set JCMS info message for current request (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
      • setInfoMsgSession

        public void setInfoMsgSession​(java.lang.String msg)
        Set JCMS info message for current session (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
      • setWarningMsg

        public void setWarningMsg​(java.lang.String msg)
        Set JCMS warning message for current request (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
      • setWarningMsgSession

        public void setWarningMsgSession​(java.lang.String msg)
        Set JCMS warning message for current session (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
      • setErrorMsg

        public void setErrorMsg​(java.lang.String msg)
        Set JCMS warning message for current request (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
      • setErrorMsgSession

        public void setErrorMsgSession​(java.lang.String msg)
        Set JCMS warning message for current session (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
      • setSuccessMsg

        public static void setSuccessMsg​(java.lang.String msg,
                                         javax.servlet.http.HttpServletRequest request)
        Set JCMS success message for specified request (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
        request - the current request from which the message is being set
      • setSuccessMsgSession

        public static void setSuccessMsgSession​(java.lang.String msg,
                                                javax.servlet.http.HttpServletRequest request)
        Set JCMS success message for specified session (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
        request - the current request from which the message is being set
      • setInfoMsg

        public static void setInfoMsg​(java.lang.String msg,
                                      javax.servlet.http.HttpServletRequest request)
        Set JCMS info message for specified request (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
        request - the current request from which the message is being set
      • setInfoMsgSession

        public static void setInfoMsgSession​(java.lang.String msg,
                                             javax.servlet.http.HttpServletRequest request)
        Set JCMS info message for specified session (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
        request - the current request from which the message is being set
      • setWarningMsg

        public static void setWarningMsg​(java.lang.String msg,
                                         javax.servlet.http.HttpServletRequest request)
        Set JCMS warning message for specified request (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
        request - the current request from which the message is being set
      • setWarningMsgSession

        public static void setWarningMsgSession​(java.lang.String msg,
                                                javax.servlet.http.HttpServletRequest request)
        Set JCMS warning message for specified session (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
        request - the current request from which the message is being set
      • setErrorMsg

        public static void setErrorMsg​(java.lang.String msg,
                                       javax.servlet.http.HttpServletRequest request)
        Set JCMS warning message for specified request (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
        request - the current request from which the message is being set
      • setErrorMsgSession

        public static void setErrorMsgSession​(java.lang.String msg,
                                              javax.servlet.http.HttpServletRequest request)
        Set JCMS warning message for specified session (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
        request - the current request from which the message is being set
      • getSuccessMsg

        public static java.lang.String getSuccessMsg​(javax.servlet.http.HttpServletRequest request)
        Returns the success message in the J2EE request.
        Parameters:
        request - the request to check for
        Returns:
        the information message if any or null if none was set.
      • getSuccessMsgSession

        public static java.lang.String getSuccessMsgSession​(javax.servlet.http.HttpServletRequest request)
        Returns the success message in the J2EE session.
        Parameters:
        request - the request to check for
        Returns:
        the information message if any or null if none was set.
      • getInfoMsg

        public static java.lang.String getInfoMsg​(javax.servlet.http.HttpServletRequest request)
        Returns the information message in the J2EE request.
        Parameters:
        request - the request to check for
        Returns:
        the information message if any or null if none was set.
        Since:
        jcms-6.1.1
      • getInfoMsgSession

        public static java.lang.String getInfoMsgSession​(javax.servlet.http.HttpServletRequest request)
        Returns the information message in the J2EE session.
        Parameters:
        request - the request to check for
        Returns:
        the information message if any or null if none was set.
        Since:
        jcms-6.1.1
      • getWarningMsg

        public static java.lang.String getWarningMsg​(javax.servlet.http.HttpServletRequest request)
        Returns the warning message in the J2EE request.
        Parameters:
        request - the request to check for
        Returns:
        the warning message if any or null if none was set.
        Since:
        jcms-6.1.1
      • getWarningMsgSession

        public static java.lang.String getWarningMsgSession​(javax.servlet.http.HttpServletRequest request)
        Returns the warning message in the J2EE session.
        Parameters:
        request - the request to check for
        Returns:
        the warning message if any or null if none was set.
        Since:
        jcms-6.1.1
      • getErrorMsg

        public static java.lang.String getErrorMsg​(javax.servlet.http.HttpServletRequest request)
        Returns the error message in the J2EE request.
        Parameters:
        request - the request to check for
        Returns:
        the error message if any or null if none was set.
        Since:
        jcms-6.1.1
      • getErrorMsgSession

        public static java.lang.String getErrorMsgSession​(javax.servlet.http.HttpServletRequest request)
        Returns the error message in the J2EE session.
        Parameters:
        request - the request to check for
        Returns:
        the error message if any or null if none was set.
        Since:
        jcms-6.1.1
      • removeMessage

        public static void removeMessage​(javax.servlet.http.HttpServletRequest request,
                                         java.util.List<JcmsMessage> messages)
        Remove specified messages from the session and request message list.
        Parameters:
        request - the current request must not be null
        messages - a list of JcmsMessage to remove
      • removeMessage

        public static void removeMessage​(javax.servlet.http.HttpServletRequest request,
                                         JcmsMessage jcmsMessage)
        Remove specified message from the session and request message list.
        Parameters:
        request - the current request must not be null
        jcmsMessage - the message to remove
      • removeMsg

        protected static void removeMsg​(javax.servlet.http.HttpServletRequest request,
                                        java.util.List<JcmsMessage> messages)
        Remove specified messages from the request message list.
        Parameters:
        request - the current request from which the message is being removed
        messages - a list of JcmsMessage to remove
        Since:
        jcms-10.0.8
      • addToastr

        public void addToastr​(JcmsToastr toastr)
        Add JCMS toastr for specified request (displayed through doToastr.jspf)
        Parameters:
        toastr - JcmsToastr
        Since:
        jcms-10.0.0
      • addToastrSession

        public void addToastrSession​(JcmsToastr toastr)
        Add JCMS toastr for current session (displayed through doToastr.jspf)
        Parameters:
        toastr - JcmsToastr
        Since:
        jcms-10.0.0
      • addToastr

        public static void addToastr​(javax.servlet.http.HttpServletRequest request,
                                     JcmsToastr toastr)
        Add JCMS toastr for specified request (displayed through doToastr.jspf)
        Parameters:
        request - the current request from which the message is being added
        toastr - JcmsToastr to be displayed
        Since:
        jcms-10.0.0
      • addToastrSession

        public static void addToastrSession​(javax.servlet.http.HttpServletRequest request,
                                            JcmsToastr toastr)
        Add JCMS toastr for specified session (displayed through doToastr.jspf)
        Parameters:
        request - the current request from which the message is being added
        toastr - JcmsToastr to be displayed
        Since:
        jcms-10.0.0
      • getToastrSessionCollection

        public static java.util.Set<JcmsToastr> getToastrSessionCollection​(javax.servlet.http.HttpServletRequest request)
        Returns the toastr collection in the J2EE session.
        Parameters:
        request - the request to check for
        Returns:
        the toastr collection if any or null if none was added.
        Since:
        jcms-10.0.0
      • getToastrCollection

        public static java.util.Set<JcmsToastr> getToastrCollection​(javax.servlet.http.HttpServletRequest request)
        Returns the toastr collection in the J2EE request.
        Parameters:
        request - the request to check for
        Returns:
        the toastr collection if any or null if none was added.
        Since:
        jcms-10.0.0
      • addMsg

        public void addMsg​(JcmsMessage msg)
        Add JCMS info message for specified request (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
        Since:
        jcms-7.0.0
      • addMsgSession

        public void addMsgSession​(JcmsMessage msg)
        Add JCMS info message for current session (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
        Since:
        jcms-7.1.0
      • addMsg

        public static void addMsg​(javax.servlet.http.HttpServletRequest request,
                                  JcmsMessage msg)
        Add JCMS info message for specified request (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
        request - the current request from which the message is being added
        Since:
        jcms-7.0.0
      • addMsgSession

        public static void addMsgSession​(javax.servlet.http.HttpServletRequest request,
                                         JcmsMessage msg)
        Add JCMS info message for specified session (displayed through doMessageBox.jsp)
        Parameters:
        msg - the message to display
        request - the current request from which the message is being added
        Since:
        jcms-7.0.0
      • getMsgList

        public static java.util.List<JcmsMessage> getMsgList​(javax.servlet.http.HttpServletRequest request)
        Returns the information message in the J2EE request.
        Parameters:
        request - the request to check for
        Returns:
        the information message set if any or null if none was added.
        Since:
        jcms-7.0.0
      • getMsgSessionList

        public static java.util.List<JcmsMessage> getMsgSessionList​(javax.servlet.http.HttpServletRequest request)
        Returns the message list in the J2EE session.
        Parameters:
        request - the request to check for
        Returns:
        the information message set if any or null if none was added.
        Since:
        jcms-7.0.0
      • getSuccessMsgList

        public static java.util.List<JcmsMessage> getSuccessMsgList​(javax.servlet.http.HttpServletRequest request)
        Returns the information message in the J2EE request.
        Parameters:
        request - the request to check for
        Returns:
        the success message set if any or null if none was added.
        Since:
        jcms-9.0.0
      • getSuccessMsgSessionList

        public static java.util.List<JcmsMessage> getSuccessMsgSessionList​(javax.servlet.http.HttpServletRequest request)
        Returns the success message in the J2EE session.
        Parameters:
        request - the request to check for
        Returns:
        the success message set if any or null if none was added.
        Since:
        jcms-9.0.0
      • getInfoMsgList

        public static java.util.List<JcmsMessage> getInfoMsgList​(javax.servlet.http.HttpServletRequest request)
        Returns the success message in the J2EE request.
        Parameters:
        request - the request to check for
        Returns:
        the information message set if any or null if none was added.
        Since:
        jcms-7.0.0
      • getInfoMsgSessionList

        public static java.util.List<JcmsMessage> getInfoMsgSessionList​(javax.servlet.http.HttpServletRequest request)
        Returns the information message in the J2EE session.
        Parameters:
        request - the request to check for
        Returns:
        the information message set if any or null if none was added.
        Since:
        jcms-7.0.0
      • getWarningMsgList

        public static java.util.List<JcmsMessage> getWarningMsgList​(javax.servlet.http.HttpServletRequest request)
        Returns the warning message in the J2EE request.
        Parameters:
        request - the request to check for
        Returns:
        the warning message List if any or null if none was added.
        Since:
        jcms-7.0.0
      • getWarningMsgSessionList

        public static java.util.List<JcmsMessage> getWarningMsgSessionList​(javax.servlet.http.HttpServletRequest request)
        Returns the warning message in the J2EE session.
        Parameters:
        request - the request to check for
        Returns:
        the warning message List if any or null if none was added.
        Since:
        jcms-7.0.0
      • getErrorMsgList

        public static java.util.List<JcmsMessage> getErrorMsgList​(javax.servlet.http.HttpServletRequest request)
        Returns the error message in the J2EE request.
        Parameters:
        request - the request to check for
        Returns:
        the error message List if any or null if none was added.
        Since:
        jcms-7.0.0
      • getErrorMsgSessionList

        public static java.util.List<JcmsMessage> getErrorMsgSessionList​(javax.servlet.http.HttpServletRequest request)
        Returns the error message in the J2EE session.
        Parameters:
        request - the request to check for
        Returns:
        the error message List if any or null if none was added.
        Since:
        jcms-7.0.0
      • copyMsgListToMsgSessionList

        protected static void copyMsgListToMsgSessionList​(javax.servlet.http.HttpServletRequest request)
        Put optional message(s) from request (processStatus) to session for compatibility with intermediate redirection, and messages to be displayed after redirection.
        Parameters:
        request - the request to process its message list
        Since:
        jcms-10.0.8
      • glp

        public java.lang.String glp​(java.lang.String key,
                                    java.lang.Object... params)
        Resolve a language property in the user language of the current request.
        Parameters:
        key - the language property to resolve, for example "ui.com.lbl.contents"
        params - an array of parameters to use when resolving the format of the given property
        Returns:
        the resolved property
        Since:
        jcms-5.0.0
      • validateSchedule

        public boolean validateSchedule​(java.lang.String param)
        Validate a string as valid Schedule and set a convienient warning message in the request if not valid.
        Parameters:
        param - The parameter to validate
        Returns:
        true if the parameter is a valid Schedule string
        Since:
        jcms-6.0
      • validateRegexp

        public boolean validateRegexp​(java.lang.String regexp)
        Validate a pattern as a Perl regexp and set a convienient warning message in the request if not valid.
        Parameters:
        regexp - The pattern to validate
        Returns:
        true if the pattern is a valid Perl 5 regexp.
        Since:
        jcms-6.0
      • select

        public static java.util.List<JcmsMessage> select​(java.util.Collection<? extends JcmsMessage> dataColl,
                                                         JcmsMessageSelector selector)
        Perform a selection on a Collection of JcmsMessage using the given JcmsMessageSelector
        Parameters:
        dataColl - the Collection of Data to select.
        selector - the DataSelector to use.
        Returns:
        a NEW or CLONED List of JcmsMessage.
        Since:
        jcms-7.0.0
      • applySelector

        public static java.util.List<JcmsMessage> applySelector​(java.util.List<JcmsMessage> msgList,
                                                                JcmsMessageSelector selector)
        Apply given JcmsMessageSelector by removing non selected JcmsMessage from the given List.
        This method DOES NOT create any new List, modify the existing one.
        Parameters:
        msgList - a List of JcmsMessage from which to remove non selected data.
        selector - the JcmsMessageSelector to apply
        Returns:
        the SAME List that was given but modified.
        Since:
        jcms-7.0.0
      • updateWorkspace

        public void updateWorkspace​(Workspace workspace)
        Set the given workspace to the request and refreshes the context by forcing an update.
        Parameters:
        workspace - the workspace
        Since:
        jcms-10.0.7