⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parambean.java

📁 java 写的一个新闻发布系统
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        return httpMethod;    }    public long getStartTime () {        return startTime;    }    public String getEngine () {        return engineName;    }    public String getOperationMode () {        return opMode;    }    public JahiaPage getPage () {        return thePage;    }    public int getPageID () {        if (thePage == null)            return -1;        return thePage.getID ();    }    public int getLastRequestedPageID () {        return lastRequestedPageID;    }    public boolean newPageRequest () {        return newPageRequest;    }    public String getLastEngineName () {        return lastEngineName;    }    public boolean engineHasChanged () {        return engineHasChanged;    }    public JahiaUser getUser () {        return theUser;    }    public String getUserAgent () {        return userAgent;    }    public int getFieldID () {        return fieldID;    }    public int getSiteID () {        return siteID;    }    public String getSiteKey () {        return siteKey;    }    public int getJahiaID () {        return getSiteID ();    } // Hollis : For backward compatibility, but ...    public JahiaSite getSite () {        return site;    }    /**     * Returns the cache status mode. The caching mode may be specified in the     * request URL by specifying the following : /cache/on, /cache/onlyupdate,     * /cache/off. If it isn't specified in the URL the default mode is /cache/on     * @return a String of one of the following values :     * ParamBean.CACHE_ON meaning the caching system should be fully     * active caching and updating cache,     * ParamBean.CACHE_ONLYUPDATE meaning only the updates in the cache are made     * but every request to a page will be fully processed without looking up in     * the cache first,     * ParamBean.CACHE_OFFONCE meaning that the cache is deactivated for this     * request ONLY. All the generated URLs will be set to the CACHE_ON value     * ParamBean.CACHE_BYPASS meaning that the cache is deactivated for this     * request ONLY and the output of the request will not be stored in the     * cache. All the generated URLs will be set to the CACHE_ON value,     * ParamBean.CACHE_OFF meaning the caching system is completely     * bypassed and not at all processed, and all the generated URLs will have a     * CACHE_OFF parameter     */    public String getCacheStatus () {        return cacheStatus;    }    /**     * Returns the original cache status request mode. This method returns     * the cache status as it was specified in the request URL or the default     * value, ignoring all the current cache status that could have been set     * by the setCacheStatus method. The caching mode may be specified in the     * request URL by specifying the following : /cache/on, /cache/onlyupdate,     * /cache/offonce, /cache/bypass, /cache/off. If it isn't specified in the     * URL the default mode is /cache/on     * @return a String of one of the following values :     * ParamBean.CACHE_ON meaning the caching system should be fully     * active caching and updating cache,     * ParamBean.CACHE_ONLYUPDATE meaning only the updates in the cache are made     * but every request to a page will be fully processed without looking up in     * the cache first,     * ParamBean.CACHE_OFFONCE meaning that the cache is deactivated for this     * request ONLY but that the result of the request will be stored in the     * cache nonetheless. All the generated URLs will be set to the CACHE_ON value,     * ParamBean.CACHE_BYPASS meaning that the cache is deactivated for this     * request ONLY and the output of the request will not be stored in the     * cache. All the generated URLs will be set to the CACHE_ON value,     * ParamBean.CACHE_OFF meaning the caching system is completely     * bypassed and not at all processed, and all the generated URLs will have a     * CACHE_OFF parameter     */    public String getOriginalCacheStatus () {        return originalCacheStatus;    }    /**     * Sets the Operation Mode for this request to the specified value.     */    public void setOperationMode (String newOperationMode) {        opMode = newOperationMode;    }    /**     * Sets the cacheStatus for this request to the specified value. Be careful     * when using this setter. If you generate URLs before you set this value,     * they will differ from the ones after this call has been made.     * @param newCacheStatus may have only a value of ParamBean.CACHE_ON,     * ParamBean.CACHE_ONLYUPDATE, ParamBean.CACHE_OFFONCE,     * ParamBean.CACHE_BYPASS, ParamBean.CACHE_OFF.     * Any other value will not be set, and the call will return a false value.     * @return true if the new status has an acceptable value, false otherwise     */    public boolean setCacheStatus (String newCacheStatus) {        if ((ParamBean.CACHE_ON.equals (newCacheStatus)) ||                (ParamBean.CACHE_ONLYUPDATE.equals (newCacheStatus)) ||                (ParamBean.CACHE_OFFONCE.equals (newCacheStatus)) ||                (ParamBean.CACHE_BYPASS.equals (newCacheStatus)) ||                (ParamBean.CACHE_OFF.equals (newCacheStatus))        ) {            this.cacheStatus = newCacheStatus;            return true;        } else {            return false;        }    }    /**     * Return true if the current user is an admin member of the current site     *     * @return boolean     */    public boolean userIsAdmin () {        return getUser ().isAdminMember (getSiteID ());    }    /**     * Return the current mode in which Jahia is running.     * There is two main mode in which Jahia is running JahiaInterface.CORE_MODE     * or JahiaInterface.ADMIN_MODE ( we are in administration mode )     * Return -1 if not defined     * This mode is stored in the session as an attribute with the name :     * 		ParamBean.SESSION_JAHIA_RUNNING_MODE     *     * @see org.jahia.bin.JahiaInterface#ADMIN_MODE     * @see org.jahia.bin.JahiaInterface#CORE_MODE     * @return int the Jahia running mode or -1 if not defined.     *     * @exception   JahiaSessionExpirationException     *      Throw this exception when the session is null. This happens usually     *      when the session expired.     */    public int getJahiaRunningMode ()            throws JahiaSessionExpirationException {        HttpSession session = mRequest.getSession (false);        if (session == null) {            throw new JahiaSessionExpirationException ();        }        Integer I = (Integer)session.getAttribute (SESSION_JAHIA_RUNNING_MODE);        if (I == null)            return -1;        return I.intValue ();    }    /**     * Return true if the current running mode is JahiaInterface.ADMIN_MODE ( we are in administration mode ).     *     * @see org.jahia.bin.JahiaInterface#ADMIN_MODE     * @see org.jahia.bin.JahiaInterface#CORE_MODE     * @return boolean     *     * @exception   JahiaSessionExpirationException     *      Throw this exception when the session is null. This happens usually     *      when the session expired.     */    public final boolean isInAdminMode ()            throws JahiaSessionExpirationException {        HttpSession session = mRequest.getSession (false);        if (session == null) {            throw new JahiaSessionExpirationException ();        }        Integer I = (Integer)session.getAttribute (SESSION_JAHIA_RUNNING_MODE);        if (I == null)            return false;        return (I.intValue () == Jahia.ADMIN_MODE);    }    //-------------------------------------------------------------------------    /** Return the session ID.     *     * @return     *      Return the session ID.     *     * @exception   JahiaSessionExpirationException     *      Throw this exception when the session is null. This happens usually     *      when the session expired.     */    public String getSessionID ()            throws JahiaSessionExpirationException {        HttpSession session = mRequest.getSession (false);        if (session == null) {            throw new JahiaSessionExpirationException ();        }        return session.getId ();    }    //-------------------------------------------------------------------------    /** Return the reference on the current session.     *     * @return     *      Return the session reference.     *     * @exception   JahiaSessionExpirationException     *      Throw this exception when the session is null. This happens usually     *      when the session expired.     */    public HttpSession getSession ()            throws JahiaSessionExpirationException {        HttpSession session = mRequest.getSession (false);        if (session == null) {            throw new JahiaSessionExpirationException ();        }        return session;    }    //-------------------------------------------------------------------------    /**     * Invalidates the current session and replaces it with a new one, avoiding     * a call to getSession for the Jahia developper.     */    public void invalidateSession ()            throws JahiaSessionExpirationException {        HttpSession session = mRequest.getSession (false);        if (session == null) {            throw new JahiaSessionExpirationException ();        }        session.invalidate ();        session = mRequest.getSession (true);    }    /**     * Removes all objects that are stored in the session, but does NOT call     * a session.invalidate. This should work better for login / logout.     * @throws JahiaSessionExpirationException if the session cannot be retrieved     * from the request object.     */    public void purgeSession ()            throws JahiaSessionExpirationException {        HttpSession session = mRequest.getSession (false);        if (session == null) {            throw new JahiaSessionExpirationException ();        }        JahiaConsole.println ("ParamBean.purgeSession",                "Purging session of all objects...");        // a little hack to be able to remove objects later, because during an        // enumeration we can't remove objects.        Enumeration attributeNamesEnum = session.getAttributeNames ();        Vector attributeNames = new Vector ();        while (attributeNamesEnum.hasMoreElements ()) {            String curAttributeName = (String)attributeNamesEnum.nextElement ();            attributeNames.add (curAttributeName);        }        attributeNamesEnum = attributeNames.elements ();        while (attributeNamesEnum.hasMoreElements ()) {            String curAttributeName = (String)attributeNamesEnum.nextElement ();            /*            JahiaConsole.println("ParamBean.purgeSession",                                 "Removing attribute " + curAttributeName +                                 " from session " +                                 session.getId());            */            session.removeAttribute (curAttributeName);        }    }    /**     * Small helper class to store languages returned by a browser. Implements     * comparison and equality operation for easy sorting.     * @author Serge Huber     */    private class LanguageEntry implements Comparable {        private String language = "";        private String country = "";        private double qValue = 0.0;        /**

⌨️ 快捷键说明

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