You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@locus.apache.org on 2000/12/09 00:19:02 UTC
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/log Logger.java
costin 00/12/08 15:19:01
Modified: src/facade22/org/apache/tomcat/facade ServletWrapper.java
WebXmlReader.java
src/facade22/org/apache/tomcat/modules/facade22
JspInterceptor.java
src/share/org/apache/jasper/compiler
CommandLineCompiler.java
src/share/org/apache/tomcat/context ErrorHandler.java
src/share/org/apache/tomcat/core ContextManager.java
Handler.java
src/share/org/apache/tomcat/request AccessInterceptor.java
InvokerInterceptor.java SimpleMapper1.java
StaticInterceptor.java
src/share/org/apache/tomcat/util FileUtil.java
PrefixMapper.java
src/share/org/apache/tomcat/util/log Logger.java
Removed: src/share/org/apache/tomcat/util URLUtil.java
Log:
First round of Handler refactoring/simplification.
- added "state" ( will be used instead of guessing from initialized, errors,
etc)
- moved servlet-specific code to facade ( will continue for other
upper-layer code that is still in core )
Added few more comments to the code.
Also, removed URLUtil ( since most of it isn't used ), keep FileUtil
for path manipulation tools.
Revision Changes Path
1.13 +42 -31 jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletWrapper.java
Index: ServletWrapper.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletWrapper.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ServletWrapper.java 2000/12/06 03:59:29 1.12
+++ ServletWrapper.java 2000/12/08 23:18:29 1.13
@@ -68,6 +68,14 @@
/**
* Class used to represent a servlet inside a Context.
+ *
+ * It will deal with all servlet-specific issues:
+ * - load on startup
+ * - servlet class name ( dynamic loading )
+ * - init parameters
+ * - security roles/mappings ( per servlet )
+ * - jsp that acts like a servlet ( web.xml )
+ * - reloading
*
* @author James Duncan Davidson [duncan@eng.sun.com]
* @author Jason Hunter [jch@eng.sun.com]
@@ -101,6 +109,10 @@
// is running ( this have to be revisited !)
protected long lastAccessed;
protected int serviceCount = 0;
+ protected String servletClassName;
+
+ // special case for "jsp servlet"
+ boolean jspServletInitialized=false;
// int loadOnStartup=0;
@@ -109,14 +121,10 @@
public ServletWrapper() {
}
- public void setContext( Context context) {
- super.setContext( context );
- isReloadable=context.getReloadable();
- configF = new ServletConfigImpl(this);
- }
-
public String toString() {
- return name + "(" + servletClassName + "/" + path + ")";
+ if( path==null )
+ return "Servlet " + name + "(" + servletClassName + ")";
+ return "Jsp " + name + "(" + path + ")";
}
// -------------------- Servlet specific properties
@@ -139,10 +147,6 @@
isReloadable = reloadable;
}
- public String getName() {
- return getServletName();
- }
-
public String getServletName() {
if(name!=null) return name;
return path;
@@ -173,10 +177,13 @@
return this.servletClassName;
}
- public void setServletClass(String servletClassName) {
- super.setServletClass( servletClassName );
+ public void setServletClassName(String servletClassName) {
servlet=null; // reset the servlet, if it was set
servletClass=null;
+ this.servletClassName=servletClassName;
+ }
+ public void setServletClass(String servletClassName) {
+ setServletClassName(servletClassName);
}
public Exception getErrorException() {
@@ -233,6 +240,8 @@
public void setPath(String path) {
this.path = path;
+ if( name==null )
+ name=path; // the path will serve as servlet name if not set
}
// --------------------
@@ -304,8 +313,14 @@
// ( and easier to read )
// log("LoadServlet " + servletClass + " "
// + servletClassName);
+
+ // default
+ if( servletClassName==null )
+ servletClassName=servletName;
+
if (servletClass == null) {
if (servletClassName == null) {
+ // It happens :-(
throw new IllegalStateException("Can't happen - classname "
+ "is null, who added this ?");
}
@@ -334,9 +349,12 @@
// make sure the servlet is loaded before calling preInit
// Jsp case - maybe another Jsp engine is used
- if( servlet==null && path != null && servletClassName == null) {
- log("Calling handleJspInit " + servletClassName);
+
+ if( servlet==null && path != null && ! jspServletInitialized ) {
+ // log("Calling handleJspInit " + servletClassName);
+ // dual mode
handleJspInit();
+ jspServletInitialized=true;
}
if( servlet==null ) {
@@ -376,6 +394,9 @@
protected void doInit()
throws Exception
{
+ isReloadable=context.getReloadable();
+ configF = new ServletConfigImpl(this);
+
// ASSERT synchronized at higher level, initialized must be false
try {
final Servlet sinstance = servlet;
@@ -394,11 +415,7 @@
}
}
- /** Override service to hook reloading - it can be done in a clean
- interceptor. It also hooks jsp - we should have a separate
- JspHandler
- */
- public void service(Request req, Response res)
+ protected void doService(Request req, Response res)
throws Exception
{
// <servlet><jsp-file> case
@@ -428,14 +445,6 @@
" unavailable time expired, trying again ");
}
- // we reach here of there is no error or the exception has expired
- // will do an init
- super.service( req, res );
- }
-
- protected void doService(Request req, Response res)
- throws Exception
- {
// Get facades - each req have one facade per context
// the facade itself is very light.
@@ -458,6 +467,7 @@
try {
doService( reqF, resF );
} catch ( Exception ex ) {
+ // support for UnavailableException
if ( ex instanceof UnavailableException ) {
// if error not set
if ( ! isExceptionPresent() ) {
@@ -471,8 +481,7 @@
}
}
}
- // save error state on request and response
- saveError( req, res, ex );
+ throw ex; // will be saved/handled by Handler
}
}
@@ -490,6 +499,8 @@
}
// -------------------- Jsp hooks
+ ServletWrapper jspServletW=null;
+
// <servlet><jsp-file> case - we know it's a jsp
void handleJspInit() {
// XXX Jsp Servlet is initialized, the servlet is not generated -
@@ -498,7 +509,7 @@
// I don't think that ever worked anyway - and I don't think
// it can work without integrating Jsp handling into tomcat
// ( using interceptor )
- ServletWrapper jspServletW = (ServletWrapper)context.getServletByName("jsp");
+ jspServletW = (ServletWrapper)context.getServletByName("jsp");
servletClassName = jspServletW.getServletClass();
}
1.5 +2 -2 jakarta-tomcat/src/facade22/org/apache/tomcat/facade/WebXmlReader.java
Index: WebXmlReader.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/WebXmlReader.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WebXmlReader.java 2000/09/30 04:43:28 1.4
+++ WebXmlReader.java 2000/12/08 23:18:29 1.5
@@ -40,10 +40,10 @@
private Handler addServlet( Context ctx, String name, String classN )
throws TomcatException
{
- Handler sw=new ServletWrapper(); // ctx.createHandler();
+ ServletWrapper sw=new ServletWrapper(); // ctx.createHandler();
sw.setContext(ctx);
sw.setServletName( name );
- sw.setServletClass( classN);
+ sw.setServletClassName( classN);
ctx.addServlet( sw );
sw.setLoadOnStartUp( -2147483646 );
return sw;
1.13 +1 -1 jakarta-tomcat/src/facade22/org/apache/tomcat/modules/facade22/JspInterceptor.java
Index: JspInterceptor.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/modules/facade22/JspInterceptor.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- JspInterceptor.java 2000/12/05 14:02:38 1.12
+++ JspInterceptor.java 2000/12/08 23:18:33 1.13
@@ -219,7 +219,7 @@
log( "Added mapping " + servletPath +
" path=" + servletPath );
}
- wrapper.setServletClass( classN );
+ wrapper.setServletClassName( classN );
wrapper.setNote( jspInfoNOTE, jspInfo );
// set initial exception on the servlet if one is present
if ( jspInfo.isExceptionPresent() ) {
1.6 +5 -5 jakarta-tomcat/src/share/org/apache/jasper/compiler/CommandLineCompiler.java
Index: CommandLineCompiler.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/CommandLineCompiler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- CommandLineCompiler.java 2000/02/25 20:10:46 1.5
+++ CommandLineCompiler.java 2000/12/08 23:18:34 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/CommandLineCompiler.java,v 1.5 2000/02/25 20:10:46 mandar Exp $
- * $Revision: 1.5 $
- * $Date: 2000/02/25 20:10:46 $
+ * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/CommandLineCompiler.java,v 1.6 2000/12/08 23:18:34 costin Exp $
+ * $Revision: 1.6 $
+ * $Date: 2000/12/08 23:18:34 $
*
* The Apache Software License, Version 1.1
*
@@ -110,7 +110,7 @@
}
computeClassFileName();
computeJavaFileName();
- };
+ }
/**
@@ -119,7 +119,7 @@
*/
public boolean isOutDated() {
return true;
- };
+ }
public final void computeJavaFileName() {
1.10 +4 -4 jakarta-tomcat/src/share/org/apache/tomcat/context/ErrorHandler.java
Index: ErrorHandler.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/ErrorHandler.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ErrorHandler.java 2000/12/06 03:59:29 1.9
+++ ErrorHandler.java 2000/12/08 23:18:40 1.10
@@ -336,7 +336,7 @@
NotFoundHandler() {
initialized=true;
- internal=true;
+ setOrigin( Handler.ORIGIN_INTERNAL );
name="tomcat.notFoundHandler";
}
@@ -389,7 +389,7 @@
ExceptionHandler() {
initialized=true;
- internal=true;
+ setOrigin( Handler.ORIGIN_INTERNAL );
name="tomcat.exceptionHandler";
}
@@ -463,7 +463,7 @@
StatusHandler() {
initialized=true;
- internal=true;
+ setOrigin( Handler.ORIGIN_INTERNAL );
name="tomcat.statusHandler";
}
@@ -524,7 +524,7 @@
RedirectHandler() {
initialized=true;
- internal=true;
+ setOrigin( Handler.ORIGIN_INTERNAL );
name="tomcat.redirectHandler";
}
1.157 +2 -2 jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java
Index: ContextManager.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -r1.156 -r1.157
--- ContextManager.java 2000/12/05 13:20:46 1.156
+++ ContextManager.java 2000/12/08 23:18:43 1.157
@@ -895,7 +895,7 @@
// -------------------- Error handling --------------------
- /** Called for error-codes. Will call the error hook.
+ /** Called for error-codes. Will call the error hook with a status code.
*/
public final void handleStatus( Request req, Response res, int code ) {
if( code!=0 )
@@ -912,7 +912,7 @@
}
/**
- * Call error hook
+ * Call error hook with an exception code.
*/
public final void handleError( Request req, Response res , Throwable t ) {
BaseInterceptor ri[];
1.25 +149 -88 jakarta-tomcat/src/share/org/apache/tomcat/core/Handler.java
Index: Handler.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Handler.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- Handler.java 2000/12/07 19:52:45 1.24
+++ Handler.java 2000/12/08 23:18:43 1.25
@@ -59,24 +59,44 @@
package org.apache.tomcat.core;
import org.apache.tomcat.util.*;
+import org.apache.tomcat.util.log.*;
import org.apache.tomcat.util.collections.EmptyEnumeration;
import java.io.*;
import java.net.*;
import java.util.*;
/**
- * The class that will generate the actual response.
+ * The class that will generate the actual response or response fragment.
* Each Handler has a "name" that will determine the content that
* it will handle.
- *
- * @author costin@dnt.ro
+ *
+ * The choice to not use "mime/type" as Apache, NES, IIS
+ * is based on the fact that most of the time servlets have "names", and
+ * the mime handling is very different in servlet API.
+ * It is possible to use mime types as a name, and special interceptors can
+ * take advantage of that ( to better integrate with the server ), but
+ * this is not a basic feature.
+ *
+ * Handlers will implement doService, doInit, doDestroy - all methods are
+ * protected and can't be called from outside. This ensures the only entry
+ * points are service(), init(), destroy() and the state and error handling
+ * is consistent.
+ *
+ * Common properties:
+ * <ul>
+ * <li>name
+ * <li>configuration parameters
+ * <li>
+ * </ul>
+ *
+ * @author Costin Manolache
*/
public class Handler {
- /** ServletWrapper counts. The accounting design is not
- final, but all this is needed to tune up tomcat
- ( and to understand and be able to implement a good
- solution )
- */
+ /** accounting - various informations we capture about servlet
+ * execution.
+ * // XXX Not implemented
+ * @see org.apache.tomcat.util.Counters
+ */
public static final int ACC_LAST_ACCESSED=0;
public static final int ACC_INVOCATION_COUNT=1;
public static final int ACC_SERVICE_TIME=2;
@@ -86,29 +106,54 @@
public static final int ACCOUNTS=6;
- /** The servlet was declared in web.xml
+ // -------------------- Origin --------------------
+ /** The handler is declared in a configuration file.
*/
public static final int ORIGIN_WEB_XML=0;
+ /** The handler is automatically added by an "invoker" interceptor,
+ * that is able to add new servlets based on request
+ */
public static final int ORIGIN_INVOKER=1;
+ /** The handler is automatically added by an interceptor that
+ * implements a templating system.
+ */
public static final int ORIGIN_JSP=2;
/** any tomcat-specific component that can
register mappings that are "re-generable",
i.e. can be recreated - the mapping can
- safely be removed. Jsp and invoker are particular
- cases
+ safely be removed.
*/
public static final int ORIGIN_DYNAMIC=3;
- /** The servlet was added by the admin, it should be saved
- preferably in web.xml
- */
+ /** The handler was added by the admin interface, it should be saved
+ * preferably in web.xml
+ */
public static final int ORIGIN_ADMIN=4;
+ /** This handler is created internally by tomcat
+ */
+ public static final int ORIGIN_INTERNAL=5;
+
+ // -------------------- State --------------------
+
+ public static final int STATE_NEW=0;
+
+ public static final int STATE_ADDED=1;
+
+ public static final int STATE_READY=2;
+
+ public static final int STATE_TEMP_DISABLED=3;
+
+ public static final int STATE_DISABLED=4;
+
+
// -------------------- Properties --------------------
protected Context context;
protected ContextManager contextM;
-
+
protected String name;
+ protected int state=STATE_NEW;
+
/** True if it can handle requests.
404 or error if not.
*/
@@ -116,16 +161,11 @@
Hashtable initArgs=null;
-
// who creates the servlet definition
protected int origin;
- protected boolean internal=false;
-
protected String path;
- protected String servletClassName;
-
protected String servletName;
protected int loadOnStartup=-1;
@@ -136,82 +176,76 @@
// Debug
protected int debug=0;
+ protected Log logger=null;
protected String debugHead=null;
private Counters cntr=new Counters( ACCOUNTS );
private Object notes[]=new Object[ContextManager.MAX_NOTES];
// -------------------- Constructor --------------------
-
+
+ /** Creates a new handler.
+ */
public Handler() {
}
- public void setContext( Context context) {
+ /** A handler "belongs" to a single application ( many->one ).
+ * We don't support handlers that spawn multiple Contexts -
+ * the model is simpler because we can set the security constraints,
+ * properties, etc on a application basis.
+ */
+ public final void setContext( Context context) {
this.context = context;
contextM=context.getContextManager();
+ logger=context.getLog();
}
- public Context getContext() {
+ /** Return the context associated with the handler
+ */
+ public final Context getContext() {
return context;
}
- public void reload() {
+ public int getState() {
+ return state;
}
- public boolean isInternal() {
- return internal;
+ public void setState( int i ) {
+ this.state=i;
}
- public String getName() {
+ // -------------------- configuration --------------------
+
+ public final String getName() {
return name;
}
- public void setName(String servletName) {
- this.name=servletName;
+ public final void setName(String handlerName) {
+ this.name=handlerName;
}
/** Who created this servlet definition - default is 0, i.e. the
- web.xml mapping. It can also be the Invoker, the admin ( by using a
- web interface), JSP engine or something else.
-
- Tomcat can do special actions - for example remove non-used
- mappings if the source is the invoker or a similar component
- */
- public void setOrigin( int origin ) {
+ * web.xml mapping. It can also be the Invoker, the admin ( by using a
+ * web interface), JSP engine or something else.
+ *
+ * Tomcat can do special actions - for example remove non-used
+ * mappings if the source is the invoker or a similar component
+ */
+ public final void setOrigin( int origin ) {
this.origin=origin;
}
-
- public int getOrigin() {
+
+ public final int getOrigin() {
return origin;
}
- /** Accounting
+ /** Accounting information
*/
public final Counters getCounters() {
return cntr;
}
// -------------------- Common servlet attributes
- public String getServletName() {
- if(name!=null) return name;
- return path;
- }
-
- public void setServletName(String servletName) {
- this.servletName=servletName;
- name=servletName;
- }
-
- public String getServletClass() {
- return this.servletClassName;
- }
-
- public void setServletClass(String servletClassName) {
- if( name==null ) name=servletClassName;
- this.servletClassName = servletClassName;
- initialized=false;
- }
-
public void setLoadOnStartUp( int level ) {
loadOnStartup=level;
}
@@ -264,10 +298,16 @@
public void setPath(String path) {
this.path = path;
+ if( name==null )
+ name=path; // the path will serve as servlet name if not set
}
// -------------------- Init params
-
+
+ /** Add configuration properties associated with this handler.
+ * This is a non-final method, handler may override it with an
+ * improved/specialized version.
+ */
public void addInitParam( String name, String value ) {
if( initArgs==null) {
initArgs=new Hashtable();
@@ -295,7 +335,7 @@
/** Destroy a handler, and notify all the interested interceptors
*/
- public void destroy() throws Exception {
+ public final void destroy() throws Exception {
if ( ! initialized ) {
errorException = null;
return;// already destroyed or not init.
@@ -312,7 +352,7 @@
/** Call the init method, and notify all interested listeners.
*/
- public void init()
+ public /* final */ void init()
throws Exception
{
// if initialized, then we were sync blocked when first init() succeeded
@@ -322,6 +362,7 @@
if (errorException != null) throw errorException;
try {
doInit();
+ initialized=true;
} catch( Exception ex ) {
// save error, assume permanent
setErrorException(ex);
@@ -349,7 +390,7 @@
* Tomcat should be able to handle and log any other exception ( including
* runtime exceptions )
*/
- public /*final*/ void service(Request req, Response res)
+ public final void service(Request req, Response res)
throws Exception
{
if( ! initialized ) {
@@ -371,7 +412,7 @@
if ( ex != null ) {
// save error state on request and response
saveError( req, res, ex );
- context.log("Exception in init " + ex.getMessage(), ex );
+ log("Exception in init " + ex.getMessage(), ex );
// if in included, defer handling to higher level
if (res.isIncluded()) return;
// handle init error since at top level
@@ -383,13 +424,14 @@
}
}
- if( ! internal ) {
- BaseInterceptor reqI[]=
- req.getContainer().getInterceptors(Container.H_preService);
- for( int i=0; i< reqI.length; i++ ) {
- reqI[i].preService( req, res );
- }
+ // if( ! internal ) {
+ // no distinction for internal handlers !
+ BaseInterceptor reqI[]=
+ req.getContainer().getInterceptors(Container.H_preService);
+ for( int i=0; i< reqI.length; i++ ) {
+ reqI[i].preService( req, res );
}
+ //}
try {
doService( req, res );
@@ -399,13 +441,12 @@
}
// continue with the postService
- if( ! internal ) {
- BaseInterceptor reqI[]=
- req.getContainer().getInterceptors(Container.H_postService);
- for( int i=0; i< reqI.length; i++ ) {
- reqI[i].postService( req, res );
- }
+ // if( ! internal ) {
+ reqI=req.getContainer().getInterceptors(Container.H_postService);
+ for( int i=0; i< reqI.length; i++ ) {
+ reqI[i].postService( req, res );
}
+ // }
// if no error
if( ! res.isExceptionPresent() ) return;
@@ -414,21 +455,24 @@
// handle original error since at top level
contextM.handleError( req, res, res.getErrorException() );
}
+
+ // -------------------- methods you can override --------------------
- // -------------------- Abstract methods --------------------
+ /** Reload notification. This hook is called whenever the
+ * application ( this handler ) is reloaded
+ */
+ public void reload() {
+ }
/** This method will be called when the handler
- is removed ( by admin or timeout ). Various handlers
- can implement this, but it can't be called from outside.
- ( the "guarded" doDestroy is public )
- */
+ * is removed ( by admin or timeout ).
+ */
protected void doDestroy() throws Exception {
}
/** Initialize the handler. Handler can override this
- method to initialize themself.
- The method must set initialised=true if successfull.
+ * method to initialize themself.
*/
protected void doInit() throws Exception
{
@@ -436,7 +480,10 @@
}
/** This is the actual content generator. Can't be called
- from outside.
+ * from outside.
+ *
+ * This method can't be called directly, you must use service(),
+ * which also tests the initialization and deals with the errors.
*/
protected void doService(Request req, Response res)
throws Exception
@@ -450,27 +497,41 @@
return name;
}
+ /** Debug level for this handler.
+ */
public final void setDebug( int d ) {
debug=d;
}
protected final void log( String s ) {
- context.log(s);
+ if ( logger==null )
+ contextM.log(s);
+ else
+ logger.log(s);
}
protected final void log( String s, Throwable t ) {
- context.log(s, t);
+ if(logger==null )
+ contextM.log(s, t);
+ else
+ logger.log(s, t);
}
// --------------- Error Handling ----------------
- public final void saveError( Request req, Response res, Exception ex ) {
+ /** If an error happens during init or service it will be saved in
+ * request and response.
+ */
+ // XXX error handling in Handler shouldn't be exposed to childs, need
+ // simplifications
+ protected final void saveError( Request req, Response res, Exception ex ) {
// save current exception on the request
req.setErrorException( ex );
// if the first exception, save info on the response
if ( ! res.isExceptionPresent() ) {
res.setErrorException( ex );
- res.setErrorURI( (String)req.getAttribute("javax.servlet.include.request_uri") );
+ res.setErrorURI( (String)req.
+ getAttribute("javax.servlet.include.request_uri"));
}
}
1.25 +4 -4 jakarta-tomcat/src/share/org/apache/tomcat/request/AccessInterceptor.java
Index: AccessInterceptor.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/AccessInterceptor.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- AccessInterceptor.java 2000/12/01 08:19:16 1.24
+++ AccessInterceptor.java 2000/12/08 23:18:48 1.25
@@ -312,7 +312,7 @@
}
return true;
case Container.EXTENSION_MAP:
- return ctPath.substring( 1 ).equals( URLUtil.getExtension( path ));
+ return ctPath.substring( 1 ).equals(FileUtil.getExtension( path ));
case Container.PATH_MAP:
return path.equals( ctPath );
}
@@ -343,7 +343,7 @@
BasicAuthHandler() {
initialized=true;
- internal=true;
+ setOrigin( Handler.ORIGIN_INTERNAL );
name="tomcat.basicAuthHandler";
}
@@ -390,7 +390,7 @@
FormAuthHandler() {
initialized=true;
- internal=true;
+ setOrigin( Handler.ORIGIN_INTERNAL );
name="tomcat.formAuthHandler";
}
@@ -448,7 +448,7 @@
FormSecurityCheckHandler() {
initialized=true;
- internal=true;
+ setOrigin( Handler.ORIGIN_INTERNAL );
name="tomcat.formSecurityCheck";
}
1.15 +1 -1 jakarta-tomcat/src/share/org/apache/tomcat/request/InvokerInterceptor.java
Index: InvokerInterceptor.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/InvokerInterceptor.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- InvokerInterceptor.java 2000/11/02 21:44:50 1.14
+++ InvokerInterceptor.java 2000/12/08 23:18:48 1.15
@@ -150,7 +150,7 @@
// sw.setContext(ctx);
// sw.setServletName(servletName);
// ctx.addServlet( sw );
- sw.setServletClass( servletName );
+ // sw.setServletClass( servletName );
sw.setOrigin( Handler.ORIGIN_INVOKER );
wrapper=sw;
1.27 +1 -1 jakarta-tomcat/src/share/org/apache/tomcat/request/SimpleMapper1.java
Index: SimpleMapper1.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/SimpleMapper1.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- SimpleMapper1.java 2000/11/30 17:34:12 1.26
+++ SimpleMapper1.java 2000/12/08 23:18:48 1.27
@@ -356,7 +356,7 @@
String path = req.getServletPath(); // we haven't matched any prefix,
if( path == null ) return null;
- String extension=URLUtil.getExtension( path );
+ String extension=FileUtil.getExtension( path );
if( extension == null ) return null;
if(debug>0)
1.25 +2 -2 jakarta-tomcat/src/share/org/apache/tomcat/request/StaticInterceptor.java
Index: StaticInterceptor.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/StaticInterceptor.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- StaticInterceptor.java 2000/11/02 21:44:51 1.24
+++ StaticInterceptor.java 2000/12/08 23:18:49 1.25
@@ -218,7 +218,7 @@
FileHandler() {
initialized=true;
- internal=true;
+ setOrigin( Handler.ORIGIN_INTERNAL );
name="tomcat.fileHandler";
}
@@ -330,7 +330,7 @@
DirHandler() {
initialized=true;
- internal=true;
+ setOrigin( Handler.ORIGIN_INTERNAL );
name="tomcat.dirHandler";
}
1.16 +27 -3 jakarta-tomcat/src/share/org/apache/tomcat/util/FileUtil.java
Index: FileUtil.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/FileUtil.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- FileUtil.java 2000/11/11 15:19:42 1.15
+++ FileUtil.java 2000/12/08 23:18:53 1.16
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/FileUtil.java,v 1.15 2000/11/11 15:19:42 larryi Exp $
- * $Revision: 1.15 $
- * $Date: 2000/11/11 15:19:42 $
+ * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/FileUtil.java,v 1.16 2000/12/08 23:18:53 costin Exp $
+ * $Revision: 1.16 $
+ * $Date: 2000/12/08 23:18:53 $
*
* ====================================================================
*
@@ -323,5 +323,29 @@
}
}
+ public static String removeLast( String s) {
+ int i = s.lastIndexOf("/");
+
+ if (i > 0) {
+ s = s.substring(0, i);
+ } else if (i == 0 && ! s.equals("/")) {
+ s = "/";
+ } else {
+ s = "";
+ }
+ return s;
+ }
+
+ public static String getExtension( String path ) {
+ int i = path.lastIndexOf(".");
+ int j = path.lastIndexOf("/");
+
+ if ((i > 0) && (i > j))
+ return path.substring(i);
+ else
+ return null;
+ }
+
+
}
1.6 +4 -4 jakarta-tomcat/src/share/org/apache/tomcat/util/PrefixMapper.java
Index: PrefixMapper.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/PrefixMapper.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- PrefixMapper.java 2000/11/30 17:34:12 1.5
+++ PrefixMapper.java 2000/12/08 23:18:54 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/PrefixMapper.java,v 1.5 2000/11/30 17:34:12 costin Exp $
- * $Revision: 1.5 $
- * $Date: 2000/11/30 17:34:12 $
+ * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/PrefixMapper.java,v 1.6 2000/12/08 23:18:54 costin Exp $
+ * $Revision: 1.6 $
+ * $Date: 2000/12/08 23:18:54 $
*
* ====================================================================
*
@@ -227,7 +227,7 @@
container = myMap.prefixMappedServlets.get(s);
if (container == null) {
- s=URLUtil.removeLast( s );
+ s=FileUtil.removeLast( s );
} else {
if( myMap.mapCacheEnabled ) {
// XXX implement LRU or another replacement alghoritm
1.2 +1 -1 jakarta-tomcat/src/share/org/apache/tomcat/util/log/Logger.java
Index: Logger.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/log/Logger.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Logger.java 2000/09/29 14:33:37 1.1
+++ Logger.java 2000/12/08 23:18:59 1.2
@@ -108,7 +108,7 @@
// Usefull for subclasses
private static final String separator = System.getProperty("line.separator", "\n");
- public static final char[] NEWLINE=separator.toCharArray();;
+ public static final char[] NEWLINE=separator.toCharArray();
/**