cmscontextinfo.java

来自「找了很久才找到到源代码」· Java 代码 · 共 537 行 · 第 1/2 页

JAVA
537
字号
     * @return the fully qualified name of the organizational unit
     */
    public String getOuFqn() {

        return m_ouFqn;
    }

    /**
     * Returns the project, or <code>null</code> if the project 
     * has not been configured.<p>
     * 
     * If the project has not been configured, at last the 
     * project name will be available.<p> 
     * 
     * @return the project
     * 
     * @see #getProjectName()
     * @see CmsRequestContext#currentProject()
     */
    public CmsProject getProject() {

        return m_project;
    }

    /**
     * Returns the project name.<p>
     *
     * @return the project name
     * 
     * @see #getProject()
     * @see CmsRequestContext#currentProject()
     */
    public String getProjectName() {

        return m_projectName;
    }

    /**
     * Returns the remote ip address.<p>
     *
     * @return the remote ip address
     * 
     * @see CmsRequestContext#getRemoteAddress()
     */
    public String getRemoteAddr() {

        return m_remoteAddr;
    }

    /**
     * Returns the requested uri.<p>
     *
     * @return the requested uri
     * 
     * @see CmsRequestContext#getUri()
     */
    public String getRequestedUri() {

        return m_requestedUri;
    }

    /**
     * Returns the request time used for validation of resource publication and expiration dates.<p>
     *
     * @return the request time used for validation of resource publication and expiration dates
     * 
     * @see CmsRequestContext#getRequestTime()
     */
    public long getRequestTime() {

        return m_requestTime;
    }

    /**
     * Returns the siteroot.<p>
     *
     * @return the siteroot
     * 
     * @see CmsRequestContext#getSiteRoot()
     */
    public String getSiteRoot() {

        return m_siteRoot;
    }

    /**
     * Returns the user, or <code>null</code> if the user 
     * has not been configured.<p>
     * 
     * If the user has not been configured, at last the 
     * user name will be available.<p> 
     * 
     * @return the user
     * 
     * @see #getUserName()
     * @see CmsRequestContext#currentUser()
     */
    public CmsUser getUser() {

        return m_user;
    }

    /**
     * Returns the username.<p>
     *
     * @return the username
     * 
     * @see #getUser()
     * @see CmsRequestContext#currentUser()
     */
    public String getUserName() {

        return m_userName;
    }

    /**
     * Sets the encoding.<p>
     *
     * @param encoding the encoding to set
     * 
     * @see CmsRequestContext#setEncoding(String)
     */
    public void setEncoding(String encoding) {

        checkFrozen();
        m_encoding = CmsEncoder.lookupEncoding(encoding, OpenCms.getSystemInfo().getDefaultEncoding());
    }

    /**
     * Sets the locale.<p>
     *
     * Setting the locale name will override the currently selected locale
     * and vice-versa. The locale name and the locale will always match.<p>
     *
     * @param locale the locale to set
     * 
     * @see #setLocaleName(String)
     * @see CmsRequestContext#getLocale()
     */
    public void setLocale(Locale locale) {

        checkFrozen();
        m_locale = locale;
        m_localeName = m_locale.toString();
    }

    /**
     * Sets the locale name.<p>
     * 
     * Setting the locale name will override the currently selected locale
     * and vice-versa. The locale name and the locale will always match.<p>
     *
     * @param localeName the locale name to set
     * 
     * @see #setLocale(Locale)
     * @see CmsRequestContext#getLocale()
     */
    public void setLocaleName(String localeName) {

        checkFrozen();
        m_localeName = localeName;
        m_locale = CmsLocaleManager.getLocale(localeName);
    }

    /**
     * Sets the fully qualified name of the organizational unit.<p>
     * 
     * @param ouFqn the fully qualified name of the organizational unit to set
     */
    public void setOuFqn(String ouFqn) {

        m_ouFqn = ouFqn;
    }

    /**
     * Sets the project name.<p>
     *
     * @param projectName the project name to set
     * 
     * @see CmsRequestContext#currentProject()
     */
    public void setProjectName(String projectName) {

        checkFrozen();
        m_projectName = projectName;
    }

    /**
     * Sets the remote ip address.<p>
     *
     * @param remoteAddr the remote ip address
     * 
     * @see CmsRequestContext#getRemoteAddress()
     */
    public void setRemoteAddr(String remoteAddr) {

        checkFrozen();
        m_remoteAddr = remoteAddr;
    }

    /**
     * Sets the requested uri.<p>
     *
     * @param requestedUri the requested uri to set
     * 
     * @see CmsRequestContext#setUri(String)
     */
    public void setRequestedUri(String requestedUri) {

        checkFrozen();
        m_requestedUri = requestedUri;
    }

    /**
     * Sets the request time used for validation of resource publication and expiration dates.<p>
     *
     * @param requestTime the request time to set
     * 
     * @see CmsRequestContext#getRequestTime()
     */
    public void setRequestTime(long requestTime) {

        checkFrozen();
        if (requestTime == CURRENT_TIME) {
            m_requestTime = System.currentTimeMillis();
        } else {
            m_requestTime = requestTime;
        }
    }

    /**
     * Sets the siteroot.<p>
     *
     * @param siteRoot the siteroot to set
     * 
     * @see CmsRequestContext#setSiteRoot(String)
     */
    public void setSiteRoot(String siteRoot) {

        checkFrozen();
        m_siteRoot = siteRoot;
    }

    /**
     * Sets the username.<p>
     *
     * @param userName the username to set
     * 
     * @see CmsRequestContext#currentUser()
     */
    public void setUserName(String userName) {

        checkFrozen();
        m_userName = userName;
    }

    /**
     * Checks if this context info configuration is frozen.<p>
     * 
     * @throws CmsRuntimeException in case the configuration is already frozen
     */
    protected void checkFrozen() throws CmsRuntimeException {

        if (m_frozen) {
            throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONTEXT_INFO_FROZEN_0));
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?