|
What this is
Other links
The source codepackage org.apache.tomcat.j2ee; import java.net.*; import java.io.*; import java.util.*; import com.sun.web.server.*; import org.apache.tomcat.core.*; import org.apache.tomcat.request.*; import org.apache.tomcat.context.*; import java.security.*; import javax.servlet.*; import org.apache.tomcat.startup.EmbededTomcat; /** * Simple adapter EmbededTomcat, workaround to avoid * using com.sun.web.servet.WebService inside tomcat. * * @author costin@eng.sun.com */ public class TomcatJ2EEAdapter extends WebService { EmbededTomcat server; ContextManager cm; int debug=0; public TomcatJ2EEAdapter() { server=new EmbededTomcat(); cm=server.getContextManager(); } public void setDebug( int debug ) { super.setDebug(debug); server.setDebug(debug); this.debug=debug; } public void setApplication( Object app ) { super.setApplication( app ); server.setApplication( app ); } public void addApplicationAdapter( Object adapter ) { try { server.addApplicationAdapter( (BaseInterceptor)adapter ); } catch(TomcatException ex ) { ex.printStackTrace(); } } public void setWorkDir( String dir ) { cm.setWorkDir( dir ); } public void addEndpoint( int port, InetAddress addr , String hostname) { try { server.addEndpoint( port, addr, hostname); } catch(TomcatException ex ) { ex.printStackTrace(); } } public void addSecureEndpoint( int port, InetAddress addr, String hostname, String keyFile, String keyPass ) { try { server.addSecureEndpoint( port, addr, hostname, keyFile, keyPass); } catch(TomcatException ex ) { ex.printStackTrace(); } } Hashtable contexts=new Hashtable(); public ServletContext addContext( String ctxPath, URL docRoot ) { try { Context ctx=(Context)server.addContext( ctxPath, docRoot, null); contexts.put( ctx.getFacade(), ctx ); return (ServletContext)ctx.getFacade(); } catch(TomcatException ex ) { ex.printStackTrace(); } return null; } public void initContext( ServletContext sctx ) { Context ctx=(Context)contexts.get( sctx ); Vector cp=(Vector)extraClassPaths.get( sctx ); if( cp!=null ) { for( int i=0; i |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 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.