|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.httpserver; import org.apache.tomcat.core.*; import java.beans.*; import java.io.*; import java.io.IOException; import java.lang.reflect.*; import java.util.*; import java.util.StringTokenizer; import org.openide.ErrorManager; import org.openide.util.SharedClassObject; /** * @author costin@dnt.ro */ public class NbServletsInterceptor extends BaseInterceptor { public NbServletsInterceptor() { } private ServletWrapper addServlet( Context ctx, String name, String classN ) throws TomcatException { ServletWrapper sw=new ServletWrapper(); sw.setContext(ctx); sw.setServletName( name ); sw.setServletClass( classN); ctx.addServlet( sw ); sw.setLoadOnStartUp(0); return sw; } private void addNbServlets( Context ctx ) throws TomcatException { HttpServerSettings op = (HttpServerSettings)SharedClassObject.findObject (HttpServerSettings.class, true); ServletWrapper sw; sw=addServlet( ctx, "WrapperServlet", "org.netbeans.modules.httpserver.WrapperServlet"); // NOI18N ctx.addServletMapping(op.getWrapperBaseURL () + "*", "WrapperServlet"); // NOI18N } public void contextInit(Context ctx) throws TomcatException { if( ctx.getDebug() > 0 ) ctx.log("NbServletsInterceptor - init " + ctx.getPath() + " " + ctx.getDocBase() ); // NOI18N ContextManager cm=ctx.getContextManager(); try { // Default init addNbServlets( ctx ); } catch (Exception e) { ErrorManager em = ErrorManager.getDefault(); em.annotate(e, "NbServletsInterceptor failed"); // NOI18N em.notify(ErrorManager.INFORMATIONAL, e); } } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.