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

📄 nsconfig.java

📁 Tomcat 4.1与WebServer集成组件的源代码包.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    }    /**        Set the name for the Object that implements the        jk_service call.        @param <b>name</b> Name of the obj.conf Object    */    public void setObjectName(String name) {        objectName = name;    }    // -------------------- Initialize/guess defaults --------------------    /** Initialize defaults for properties that are not set	explicitely    */    protected void initProperties() {        super.initProperties();	objConfig=getConfigFile( objConfig, configHome, NS_CONFIG);	workersConfig=getConfigFile( workersConfig, configHome, WORKERS_CONFIG);	if( nsapiJk == null )	    nsapiJk=new File(NSAPI_REDIRECTOR);	else	    nsapiJk =getConfigFile( nsapiJk, configHome, NSAPI_REDIRECTOR );	jkLog=getConfigFile( jkLog, configHome, NSAPI_LOG_LOCATION);    }    // -------------------- Generate config --------------------    protected PrintWriter getWriter() throws IOException {	String abObjConfig = objConfig.getAbsolutePath();	return new PrintWriter(new FileWriter(abObjConfig,append));    }    protected boolean generateJkHead(PrintWriter mod_jk) {	log("Generating netscape web server config = "+objConfig );		generateNsapiHead( mod_jk );		mod_jk.println("<Object name=default>");	return true;    }    private void generateNsapiHead(PrintWriter objfile)    {        objfile.println("###################################################################");		            objfile.println("# Auto generated configuration. Dated: " +  new Date());        objfile.println("###################################################################");		            objfile.println();        objfile.println("#");                objfile.println("# You will need to merge the content of this file with your ");        objfile.println("# regular obj.conf and then restart (=stop + start) your Netscape server. ");        objfile.println("#");                objfile.println();                    objfile.println("#");                            objfile.println("# Loading the redirector into your server");        objfile.println("#");                objfile.println();                    objfile.println("Init fn=\"load-modules\" funcs=\"jk_init,jk_service\" shlib=\"<put full path to the redirector here>\"");        objfile.println("Init fn=\"jk_init\" worker_file=\"" +                         workersConfig.toString().replace('\\', '/') +                          "\" log_level=\"" + jkDebug + "\" log_file=\"" +                         jkLog.toString().replace('\\', '/') +                         "\"");        objfile.println();    }    protected void generateJkTail(PrintWriter objfile)    {        objfile.println();        objfile.println("#######################################################");		            objfile.println("# Protecting the WEB-INF and META-INF directories.");        objfile.println("#######################################################");		            objfile.println("PathCheck fn=\"deny-existence\" path=\"*/WEB-INF/*\"");         objfile.println("PathCheck fn=\"deny-existence\" path=\"*/META-INF/*\"");         objfile.println();        objfile.println("</Object>");                    objfile.println();        objfile.println("#######################################################");		            objfile.println("# New object to execute your servlet requests.");        objfile.println("#######################################################");		            objfile.println("<Object name=" + objectName + ">");        objfile.println("ObjectType fn=force-type type=text/html");        objfile.println("Service fn=\"jk_service\" worker=\""+ jkWorker + "\" path=\"/*\"");        objfile.println("</Object>");        objfile.println();    }    // -------------------- Forward all mode --------------------        /** Forward all requests for a context to tomcat.	The default.     */    protected void generateStupidMappings(Context context, PrintWriter objfile )    {        String ctxPath  = context.getPath();	String nPath=("".equals(ctxPath)) ? "/" : ctxPath;        if( noRoot &&  "".equals(ctxPath) ) {            log("Ignoring root context in forward-all mode  ");            return;        } 	objfile.println("<Object name=" + context.getName() + ">");        objfile.println("NameTrans fn=\"assign-name\" from=\"" + ctxPath + "\" name=\"" + objectName + "\"");         objfile.println("NameTrans fn=\"assign-name\" from=\"" + ctxPath + "/*\" name=\"" + objectName + "\""); 	objfile.println("</Object>");    }    // -------------------- Netscape serves static mode --------------------    // This is not going to work for all apps. We fall back to stupid mode.        protected void generateContextMappings(Context context, PrintWriter objfile )    {        String ctxPath  = context.getPath();	String nPath=("".equals(ctxPath)) ? "/" : ctxPath;        if( noRoot &&  "".equals(ctxPath) ) {            log("Ignoring root context in non-forward-all mode  ");            return;        } 	objfile.println("<Object name=" + context.getName() + ">");        // Static files will be served by Netscape        objfile.println("#########################################################");		            objfile.println("# Auto configuration for the " + nPath + " context starts.");        objfile.println("#########################################################");		            objfile.println();        // XXX Need to determine what if/how static mappings are done	// InvokerInterceptor - it doesn't have a container,	// but it's implemented using a special module.		// XXX we need to better collect all mappings	if(context.getLoginConfig() != null) {	    String loginPage = context.getLoginConfig().getLoginPage();	    if(loginPage != null) {		int lpos = loginPage.lastIndexOf("/");		String jscurl = loginPage.substring(0,lpos+1) + "j_security_check";		addMapping( ctxPath, jscurl, objfile);	    }	}		String [] servletMaps=context.findServletMappings();	for(int ii=0; ii < servletMaps.length; ii++) {	    addMapping( ctxPath , servletMaps[ii] , objfile );	}	objfile.println("</Object>");    }    /** Add a Netscape extension mapping.     */    protected boolean addMapping( String ctxPath, String ext,					 PrintWriter objfile )    {        if( debug > 0 )            log( "Adding extension map for " + ctxPath + "/*." + ext );	if(! ext.startsWith("/") )	    ext = "/" + ext;	if(ext.length() > 1)	    objfile.println("NameTrans fn=\"assign-name\" from=\"" +                    ctxPath  + ext + "\" name=\"" + objectName + "\""); 	return true;    }    /** Add a fulling specified Netscape mapping.     */    protected boolean addMapping( String fullPath, PrintWriter objfile ) {        if( debug > 0 )            log( "Adding map for " + fullPath );        objfile.println("NameTrans fn=\"assign-name\" from=\"" +                        fullPath + "\" name=\"" + objectName + "\""); 	return true;    }}

⌨️ 快捷键说明

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