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

📄 jahia.java

📁 java 写的一个新闻发布系统
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
// $Id: Jahia.java,v 1.35 2003/11/03 14:47:56 shuber Exp $////                                   ____.//                       __/\ ______|    |__/\.     _______//            __   .____|    |       \   |    +----+       \//    _______|  /--|    |    |    -   \  _    |    :    -   \_________//   \\______: :---|    :    :           |    :    |         \________>//           |__\---\_____________:______:    :____|____:_____\//                                      /_____|////              . . . i n   j a h i a   w e   t r u s t . . .//////  Jahia////  30.10.2000  EV  added in jahia.//  17.01.2001  AK  change dispatcher method.//  19.01.2001  AK  replace methods doGet and doPost by the method service.//  29.01.2001  AK  change re-init way, remove sets methods.//  10.02.2001  AK  pseudo-bypass the login by forwarding request attributes.//  27.03.2001  AK  javadoc and change the access to JahiaPrivateSettings.load().//  28.03.2001  AK  add some jahia path variables.//  29.03.2001  AK  rename jahia.basic file in jahia.skeleton.//  20.04.2001  AK  bugfix request uri.//  17.05.2001  AK  tomcat users check during init.//  23.05.2001  NK  bug two same parameter in url resolved by removing pathinfo data from request uri//package org.jahia.bin;import java.io.*;                                   // IOExceptionimport java.util.*;                                 // Properties, HashMapimport javax.servlet.*;					            // ServletExceptionimport javax.servlet.http.*;			            // HttpServletRequest, HttpSerlvetResponseimport org.jahia.utils.*;                       // JahiaConsoleimport org.jahia.utils.modifier.*;              // TomcatUsersModifierimport org.jahia.settings.*;                    // JahiaPrivateSettingsimport org.jahia.params.*;                      // ParamBeanimport org.jahia.operations.*;                  // OperationManagerimport org.jahia.registries.*;                  // EnginesRegistry, FieldsDefinitionsRegistryimport org.jahia.registries.locks.*;            // EnginesRegistry, FieldsDefinitionsRegistryimport org.jahia.security.license.*;import org.jahia.services.usermanager.*;        // JahiaUserManagerimport org.jahia.services.htmlcache.CacheServerService;import org.jahia.exceptions.JahiaException;import org.jahia.exceptions.JahiaSiteNotFoundException;import org.jahia.exceptions.JahiaSecurityException;import org.jahia.exceptions.JahiaPageNotFoundException;import org.jahia.exceptions.JahiaSessionExpirationException;import org.jahia.exceptions.JahiaOperationNotAllowedException;import org.jahia.exceptions.services.ServiceNotFoundException;import org.jahia.security.license.LicenseKey;import org.jahia.security.license.LicenseException;import org.jahia.security.license.InvalidBuildNumberException;import org.jahia.security.license.InvalidReleaseNumberException;/////////////////////////////////////////////////////////////////////////////////////////////////////  PROFILER :////      this importation is needed to prifile Jahia with OptimizeIt.//      Comment this line to remove profiling.///////////////////////////////////////////////////////////////////////////////////////////////////////import intuitive.audit.Audit;////////////////////////////////////////////////////////////////////////////////////////////////////** * desc:  This is the main servlet of Jahia. *   ----=[  Welcome to the Jahia portal  ]=---- * * Copyright:    Copyright (c) 2002 * Company:      Jahia Ltd * * @author  Eric Vassalli * @author  Alexandre Kraft * @author  Khue N'Guyen * @version 1.0 */public final class Jahia    extends HttpServlet                            implements JahiaInterface{    /** "jahia" string constant in order to avoid creating a new string for     * each concole output. */    static private final String JAHIA_STR = "jahia";    /** this class name */    static public final String CLASS_NAME = "Jahia";    /** properties filename */    static private final String PROPERTIES_FILENAME = "jahia.properties";    /** license filename */    static private final String LICENSE_FILENAME = "jahia.license";    /** skeleton properties filename */    static private final String PROPERTIES_BASIC = "jahia.skeleton";    /** ... */    static private final String JAHIA_LAUNCH = "jahiaLaunch";    /** ... */    static private final String GET_REQUEST = "GET";    /** ... */    static private final String POST_REQUEST = "POST";    /** ... */    static private final String INIT_PARAM_WEBINF_PATH = "webinf_path";    /** ... */    static private final String INIT_PARAM_LOGGING_LEVEL = "logging_level";    // web app descriptor initialization parameter    static private final String INIT_PARAM_SUPPORTED_JDK_VERSIONS = "supported_jdk_versions";    static private final String INIT_PARAM_ADMIN_SERVLET_PATH = "admin_servlet_path";    static private final String INIT_PARAM_CONFIG_SERVLET_PATH = "config_servlet_path";    /** ... */    static public final String COPYRIGHT = "<font class=\"text\">Copyright 2002 <a href=\"http://www.jahia.org\" target=\"newJahia\">Jahia Ltd</a> - All rights reserved.</font>";    /**     * the lock name in the lock registery     */    public static final String JAHIA_LOCK_NAME = CLASS_NAME+"_lock_name";    /** Jahia lock session id */    public static final String JAHIA_LOCK_SESSION_ID = CLASS_NAME+"_lock_session_id" ;    /** Jahia lock session id */    public static final String JAHIA_LOCK = CLASS_NAME+"_lock" ;    /** Jahia lock user */    public static final String JAHIA_LOCK_USER = CLASS_NAME+"_lock_user" ;    static private int              initTryCount            = 0;    static private boolean          reInit                  = false;    static private boolean          tomcatXMLRestart        = false;    static private boolean          mInitError;    static private boolean          mInitWarning;    static private boolean          mInitiated				= false;    static private boolean          runInstaller;    static protected final String     JDK_REQUIRED = "1.3";    private   static JahiaPrivateSettings    jSettings;    private   OperationManager        operations;    private   ServletConfig           config;    private   ServletContext          context;    static protected   Exception      initException;                    // used to catch exception on init, where we don't have request and response...    static protected   Exception      initWarningException;    static private   String           jahiaPropertiesFileName;    static protected String           mLicenseFilename;    static protected String           jahiaBasicFileName;    static protected String           jahiaPropertiesPath;    static protected String           jahiaTemplatesScriptsPath;    static protected String           jahiaEtcFilesPath;    static protected String           jahiaVarFilesPath;    static public    String           jahiaDatabaseScriptsPath;    static protected String           jahiaBaseFilesPath      = "";    static private   String           relativeServletURI      = null;    static private   String           jahiaServletPath        = null;    static private   String           jahiaContextPath        = null;    static private   String           jahiaInitAdminServletPath = null;    static private   String           jahiaInitConfigServletPath = null;    static protected String           xml_use_old_db;    static private LicenseKey 		  mLicenseKey = null;    static private String             supportedJDKVersions = null;    static private boolean            supportedJDKWarningAlreadyShowed = false;    /** flag for the profiler */    static boolean isProfilerStarted = false;    public static String getRelativeServletURI() { return relativeServletURI; }    public static String getJahiaPropertiesFileName() { return jahiaPropertiesFileName; }    public static String getServletPath()        { return jahiaServletPath;   }    public static String getContextPath()        { return jahiaContextPath;   }    public static String getInitAdminServletPath()   { return jahiaInitAdminServletPath; }    public static String getInitConfigServletPath() { return jahiaInitConfigServletPath; }    static private ThreadLocal paramBeanThreadLocal = new ThreadLocal();    /**     * Default init inherited from HttpServlet.     *     * @param   config  Servlet configuration (inherited).     */    public void init (ServletConfig config)        throws  ServletException    {        String webinf_path;        int    countSlash       = 0;        mInitError   = false;        runInstaller = false;        if(initTryCount < 5) {            initTryCount++;        }        JahiaConsole.setServlet (this);        // the first time display the welcome banner...        if(initTryCount == 1) {            JahiaConsole.startupWithTrust (BUILD_NUMBER);        }        // get servlet basic variables, like confid and context...        this.config  = config;        this.context = config.getServletContext();        super.init (config);        // get some value from the web.xml file...        webinf_path             =  this.config.getInitParameter (INIT_PARAM_WEBINF_PATH);        String loggingLevelStr  =  this.config.getInitParameter (INIT_PARAM_LOGGING_LEVEL);        xml_use_old_db          =  this.config.getInitParameter ("use_old_database_feature");        supportedJDKVersions    =  this.config.getInitParameter (INIT_PARAM_SUPPORTED_JDK_VERSIONS);        jahiaInitAdminServletPath = this.config.getInitParameter(INIT_PARAM_ADMIN_SERVLET_PATH);        jahiaInitConfigServletPath = this.config.getInitParameter(INIT_PARAM_CONFIG_SERVLET_PATH);        if (loggingLevelStr == null) {            JahiaConsole.setLoggingLevel(0);        } else {            int loggingLevel = Integer.parseInt(loggingLevelStr);            if ((loggingLevel >= 0) && (loggingLevel <= JahiaConsole.MAX_LOGGING_LEVEL)) {                JahiaConsole.setLoggingLevel(loggingLevel);            }        }        /*        // display all system's properties.......        Properties xx = System.getProperties();        Enumeration y = xx.propertyNames();        while(y.hasMoreElements()) {            String p = (String) y.nextElement();            System.out.println(p+" : "+System.getProperty(p));        }        */        if ( (!supportedJDKWarningAlreadyShowed) &&             (supportedJDKVersions != null) ) {            Version currentJDKVersion = null;            try {                currentJDKVersion = new Version(System.getProperty("java.version"));                if (!isSupportedJDKVersion(currentJDKVersion, supportedJDKVersions)) {                    mInitWarning = true;                    StringBuffer jemsg = new StringBuffer();                    jemsg.append( "WARNING<br>\n" );                    jemsg.append( "<b><font size=\"2\">You are using an unsupported JDK version\n" );                    jemsg.append( "or have an invalid " + INIT_PARAM_SUPPORTED_JDK_VERSIONS + " parameter string in \n" );                    jemsg.append( "the deployment descriptor file web.xml.</font></b>\n" );                    jemsg.append( "<br><br>Here is the range specified in the web.xml file : " + supportedJDKVersions + ".\n" );                    jemsg.append( "<br>If you want to disable this warning, remove the " + INIT_PARAM_SUPPORTED_JDK_VERSIONS + "\n");                    jemsg.append( "<br>initialization parameter in the tomcat/webapps/jahia/WEB-INF/web.xml<br>\n" );                    jemsg.append( "<br><br>Please note that if you deactivate this check or use unsupported versions<br>\n" );                    jemsg.append( "<br>You might run into serious problems and we cannot offer support for these.<br>\n" );                    jemsg.append( "<br>You may download a supported JDK from <a href=\"http://java.sun.com\" target=\"_newSunWindow\">http://java.sun.com</a>." );                    jemsg.append( "<br><br>&nbsp;\n" );                    initWarningException = new JahiaException(jemsg.toString(),                                                              "JDK version warning",                                                              JahiaException.INITIALIZATION_ERROR,                                                              JahiaException.WARNING);                }            } catch (NumberFormatException nfe) {                JahiaConsole.println("Jahia.init",                                     "Couldn't convert JDK version to internal version testing system, ignoring JDK version test...");            }            supportedJDKWarningAlreadyShowed = true;        }        if (this.jahiaInitAdminServletPath == null) {            JahiaConsole.println("Jahia.init",                                 "Error in web.xml for init parameter " +                                 INIT_PARAM_ADMIN_SERVLET_PATH +                                 ". Make sure it's set...Trying to use hardcoded /administration/ dispatching ...");

⌨️ 快捷键说明

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