You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2004/06/23 18:59:42 UTC
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/naming/resources BaseDirContext.java
remm 2004/06/23 09:59:42
Modified: catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java StandardHostValve.java
ContainerBase.java StandardWrapperValve.java
StandardDefaultContext.java StandardWrapper.java
StandardEngineValve.java StandardPipeline.java
StandardServer.java StandardService.java
StandardContextValve.java
catalina/src/share/org/apache/catalina/connector
Connector.java InputBuffer.java CoyoteAdapter.java
OutputBuffer.java
catalina/src/share/org/apache/catalina/loader
WebappLoader.java WebappClassLoader.java
catalina/src/share/org/apache/catalina/startup Tool.java
Embedded.java ClassLoaderFactory.java
Bootstrap.java HostConfig.java Catalina.java
modules/cluster/src/share/org/apache/catalina/cluster/session
DeltaSession.java
catalina/src/share/org/apache/catalina Context.java
Pipeline.java
catalina/src/share/org/apache/catalina/session
ManagerBase.java StandardSession.java
catalina/src/share/org/apache/catalina/mbeans
GlobalResourcesLifecycleListener.java
ServerLifecycleListener.java
catalina/src/share/org/apache/naming/resources
BaseDirContext.java
Log:
- Tweak some of the pipeline processing to decrease the stack size a little bit more.
- Remove more debug fields, and replace with checks on the logger.
Revision Changes Path
1.37 +1 -7 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
Index: ApplicationDispatcher.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- ApplicationDispatcher.java 23 Jun 2004 13:51:35 -0000 1.36
+++ ApplicationDispatcher.java 23 Jun 2004 16:59:40 -0000 1.37
@@ -172,12 +172,6 @@
/**
- * The debugging detail level for this component.
- */
- private int debug = 0;
-
-
- /**
* Are we performing an include() instead of a forward()?
*/
private boolean including = false;
1.22 +2 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostValve.java
Index: StandardHostValve.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostValve.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- StandardHostValve.java 23 Jun 2004 13:51:35 -0000 1.21
+++ StandardHostValve.java 23 Jun 2004 16:59:40 -0000 1.22
@@ -123,7 +123,7 @@
}
// Ask this Context to process this request
- context.getPipeline().invoke(request, response);
+ context.getPipeline().getFirst().invoke(request, response);
// Error page processing
response.setSuspended(false);
1.35 +11 -32 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ContainerBase.java
Index: ContainerBase.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ContainerBase.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- ContainerBase.java 23 Jun 2004 13:51:35 -0000 1.34
+++ ContainerBase.java 23 Jun 2004 16:59:40 -0000 1.35
@@ -157,12 +157,6 @@
/**
- * The debugging detail level for this component.
- */
- protected int debug = 0;
-
-
- /**
* The processor delay for this component.
*/
protected int backgroundProcessorDelay = -1;
@@ -276,31 +270,6 @@
/**
- * Return the debugging detail level for this component.
- */
- public int getDebug() {
-
- return (this.debug);
-
- }
-
-
- /**
- * Set the debugging detail level for this component.
- *
- * @param debug The new debugging detail level
- */
- public void setDebug(int debug) {
-
- int oldDebug = this.debug;
- this.debug = debug;
- support.firePropertyChange("debug", new Integer(oldDebug),
- new Integer(this.debug));
-
- }
-
-
- /**
* Get the delay between the invocation of the backgroundProcess method on
* this container and its children. Child containers will not be invoked
* if their delay value is not negative (which would mean they are using
@@ -890,7 +859,7 @@
public final void invoke(Request request, Response response)
throws IOException, ServletException {
- pipeline.invoke(request, response);
+ pipeline.getFirst().invoke(request, response);
}
@@ -1217,6 +1186,16 @@
public Valve getBasic() {
return (pipeline.getBasic());
+
+ }
+
+
+ /**
+ * Return the first valve in the pipeline.
+ */
+ public Valve getFirst() {
+
+ return (pipeline.getFirst());
}
1.29 +21 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
Index: StandardWrapperValve.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- StandardWrapperValve.java 23 Jun 2004 13:51:35 -0000 1.28
+++ StandardWrapperValve.java 23 Jun 2004 16:59:41 -0000 1.29
@@ -39,6 +39,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tomcat.util.buf.MessageBytes;
+import org.apache.tomcat.util.log.SystemLogHandler;
/**
* Valve that implements the default basic behavior for the
@@ -98,9 +99,10 @@
requestCount++;
StandardWrapper wrapper = (StandardWrapper) getContainer();
Servlet servlet = null;
-
+ Context context = (Context) wrapper.getParent();
+
// Check for the application being marked unavailable
- if (!((Context) wrapper.getParent()).getAvailable()) {
+ if (!context.getAvailable()) {
response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE,
sm.getString("standardContext.isUnavailable"));
unavailable = true;
@@ -197,7 +199,22 @@
else
request.removeAttribute(Globals.JSP_FILE_ATTR);
if ((servlet != null) && (filterChain != null)) {
- filterChain.doFilter(request, response);
+
+ // Swallow output if needed
+ if (context.getSwallowOutput()) {
+ try {
+ SystemLogHandler.startCapture();
+ filterChain.doFilter(request, response);
+ } finally {
+ String log = SystemLogHandler.stopCapture();
+ if (log != null && log.length() > 0) {
+ context.getLogger().info(log);
+ }
+ }
+ } else {
+ filterChain.doFilter(request, response);
+ }
+
}
request.removeAttribute(Globals.JSP_FILE_ATTR);
} catch (ClientAbortException e) {
1.16 +1 -3 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardDefaultContext.java
Index: StandardDefaultContext.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardDefaultContext.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- StandardDefaultContext.java 26 May 2004 15:36:35 -0000 1.15
+++ StandardDefaultContext.java 23 Jun 2004 16:59:41 -0000 1.16
@@ -1535,8 +1535,6 @@
context_loader.setDelegate(loader.getDelegate());
context_loader.setReloadable(loader.getReloadable());
if (loader instanceof WebappLoader) {
- ((WebappLoader)context_loader).setDebug
- (((WebappLoader)loader).getDebug());
((WebappLoader)context_loader).setLoaderClass
(((WebappLoader)loader).getLoaderClass());
}
1.44 +1 -32 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardWrapper.java
Index: StandardWrapper.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- StandardWrapper.java 7 Jun 2004 12:02:34 -0000 1.43
+++ StandardWrapper.java 23 Jun 2004 16:59:41 -0000 1.44
@@ -107,12 +107,6 @@
/**
- * The debugging detail level for this component.
- */
- private int debug = 0;
-
-
- /**
* The facade associated with this wrapper.
*/
private StandardWrapperFacade facade =
@@ -288,31 +282,6 @@
public int getCountAllocated() {
return (this.countAllocated);
-
- }
-
-
- /**
- * Return the debugging detail level for this component.
- */
- public int getDebug() {
-
- return (this.debug);
-
- }
-
-
- /**
- * Set the debugging detail level for this component.
- *
- * @param debug The new debugging detail level
- */
- public void setDebug(int debug) {
-
- int oldDebug = this.debug;
- this.debug = debug;
- support.firePropertyChange("debug", new Integer(oldDebug),
- new Long(this.debug));
}
1.9 +2 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardEngineValve.java
Index: StandardEngineValve.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardEngineValve.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- StandardEngineValve.java 23 Jun 2004 08:25:00 -0000 1.8
+++ StandardEngineValve.java 23 Jun 2004 16:59:41 -0000 1.9
@@ -104,7 +104,7 @@
}
// Ask this Host to process this request
- host.getPipeline().invoke(request, response);
+ host.getPipeline().getFirst().invoke(request, response);
}
1.22 +9 -37 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardPipeline.java
Index: StandardPipeline.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardPipeline.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- StandardPipeline.java 23 Jun 2004 13:51:35 -0000 1.21
+++ StandardPipeline.java 23 Jun 2004 16:59:41 -0000 1.22
@@ -18,11 +18,9 @@
package org.apache.catalina.core;
-import java.io.IOException;
import java.util.ArrayList;
import javax.management.ObjectName;
-import javax.servlet.ServletException;
import org.apache.catalina.Contained;
import org.apache.catalina.Container;
@@ -31,8 +29,6 @@
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Pipeline;
import org.apache.catalina.Valve;
-import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
import org.apache.catalina.util.LifecycleSupport;
import org.apache.catalina.util.StringManager;
import org.apache.catalina.valves.ValveBase;
@@ -103,12 +99,6 @@
/**
- * The debugging detail level for this component.
- */
- protected int debug = 0;
-
-
- /**
* Descriptive information about this implementation.
*/
protected String info = "org.apache.catalina.core.StandardPipeline/1.0";
@@ -516,33 +506,6 @@
}
/**
- * Cause the specified request and response to be processed by the Valves
- * associated with this pipeline, until one of these valves causes the
- * response to be created and returned. The implementation must ensure
- * that multiple simultaneous requests (on different threads) can be
- * processed through the same Pipeline without interfering with each
- * other's control flow.
- *
- * @param request The servlet request we are processing
- * @param response The servlet response we are creating
- *
- * @exception IOException if an input/output error occurs
- * @exception ServletException if a servlet exception is thrown
- */
- public void invoke(Request request, Response response)
- throws IOException, ServletException {
-
- // Invoke the first Valve in this pipeline for this request
- if (first != null) {
- first.invoke(request, response);
- } else {
- basic.invoke(request, response);
- }
-
- }
-
-
- /**
* Remove the specified Valve from the pipeline associated with this
* Container, if it is found; otherwise, do nothing. If the Valve is
* found and removed, the Valve's <code>setContainer(null)</code> method
@@ -577,6 +540,15 @@
unregisterValve(valve);
}
+ }
+
+
+ public Valve getFirst() {
+ if (first != null) {
+ return first;
+ } else {
+ return basic;
+ }
}
1.32 +3 -33 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardServer.java
Index: StandardServer.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- StandardServer.java 23 Jun 2004 13:51:35 -0000 1.31
+++ StandardServer.java 23 Jun 2004 16:59:41 -0000 1.32
@@ -221,12 +221,6 @@
/**
- * Debugging detail level.
- */
- private int debug = 0;
-
-
- /**
* Global naming resources context.
*/
private javax.naming.Context globalNamingContext = null;
@@ -311,28 +305,6 @@
/**
- * Return the debugging detail level.
- */
- public int getDebug() {
-
- return (this.debug);
-
- }
-
-
- /**
- * Set the debugging detail level.
- *
- * @param debug The new debugging detail level
- */
- public void setDebug(int debug) {
-
- this.debug = debug;
-
- }
-
-
- /**
* Return the global naming resources context.
*/
public javax.naming.Context getGlobalNamingContext() {
@@ -897,8 +869,7 @@
return (false);
}
WebappLoader wloader = (WebappLoader) loader;
- if ((wloader.getDebug() != 0) ||
- (wloader.getDelegate() != false) ||
+ if ((wloader.getDelegate() != false) ||
!wloader.getLoaderClass().equals
("org.apache.catalina.loader.WebappClassLoader")) {
return (false);
@@ -920,8 +891,7 @@
return (false);
}
StandardManager smanager = (StandardManager) manager;
- if ((smanager.getDebug() != 0) ||
- !smanager.getPathname().equals("SESSIONS.ser") ||
+ if (!smanager.getPathname().equals("SESSIONS.ser") ||
!smanager.getRandomClass().equals("java.security.SecureRandom") ||
(smanager.getMaxActiveSessions() != -1) ||
!smanager.getAlgorithm().equals("MD5")) {
1.15 +0 -30 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardService.java
Index: StandardService.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardService.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- StandardService.java 23 Jun 2004 08:25:00 -0000 1.14
+++ StandardService.java 23 Jun 2004 16:59:41 -0000 1.15
@@ -93,12 +93,6 @@
/**
- * The debugging detail level for this component.
- */
- protected int debug = 0;
-
-
- /**
* The property change support for this component.
*/
protected PropertyChangeSupport support = new PropertyChangeSupport(this);
@@ -183,30 +177,6 @@
return ((ContainerBase)container).getJmxName();
}
return null;
- }
-
-
- /**
- * Return the debugging detail level of this component.
- */
- public int getDebug() {
-
- return (this.debug);
-
- }
-
-
- /**
- * Set the debugging detail level of this component.
- *
- * @param debug The new debugging detail level
- */
- public void setDebug(int debug) {
-
- int oldDebug = this.debug;
- this.debug = debug;
- support.firePropertyChange("debug", new Integer(oldDebug),
- new Integer(this.debug));
}
1.17 +23 -35 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContextValve.java
Index: StandardContextValve.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContextValve.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- StandardContextValve.java 23 Jun 2004 13:51:35 -0000 1.16
+++ StandardContextValve.java 23 Jun 2004 16:59:41 -0000 1.17
@@ -26,7 +26,7 @@
import javax.servlet.ServletRequestListener;
import javax.servlet.http.HttpServletResponse;
-import org.apache.catalina.Context;
+import org.apache.catalina.Container;
import org.apache.catalina.Globals;
import org.apache.catalina.Wrapper;
import org.apache.catalina.connector.Request;
@@ -36,7 +36,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tomcat.util.buf.MessageBytes;
-import org.apache.tomcat.util.log.SystemLogHandler;
/**
* Valve that implements the default basic behavior for the
@@ -72,6 +71,9 @@
private static Log log = LogFactory.getLog(StandardContextValve.class);
+
+ private StandardContext context = null;
+
// ------------------------------------------------------------- Properties
@@ -90,6 +92,17 @@
/**
+ * Cast to a StandardContext right away, as it will be needed later.
+ *
+ * @see org.apache.catalina.Contained#setContainer(org.apache.catalina.Container)
+ */
+ public void setContainer(Container container) {
+ super.setContainer(container);
+ context = (StandardContext) container;
+ }
+
+
+ /**
* Select the appropriate child Wrapper to process this request,
* based on the specified request URI. If no matching Wrapper can
* be found, return an appropriate HTTP error.
@@ -116,7 +129,7 @@
}
// Wait if we are reloading
- while (((StandardContext) container).getPaused()) {
+ while (context.getPaused()) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -133,35 +146,7 @@
}
// Normal request processing
- if (((StandardContext) container).getSwallowOutput()) {
- try {
- SystemLogHandler.startCapture();
- invokeInternal(wrapper, request, response);
- } finally {
- String log = SystemLogHandler.stopCapture();
- if (log != null && log.length() > 0) {
- container.getLogger().info(log);
- }
- }
- } else {
- invokeInternal(wrapper, request, response);
- }
-
- }
-
-
- // -------------------------------------------------------- Private Methods
-
-
- /**
- * Call invoke.
- */
- private void invokeInternal(Wrapper wrapper, Request request,
- Response response)
- throws IOException, ServletException {
-
- Object instances[] =
- ((Context) container).getApplicationEventListeners();
+ Object instances[] = context.getApplicationEventListeners();
ServletRequestEvent event = null;
@@ -190,7 +175,7 @@
}
}
- wrapper.getPipeline().invoke(request, response);
+ wrapper.getPipeline().getFirst().invoke(request, response);
if ((instances !=null ) &&
(instances.length > 0)) {
@@ -212,8 +197,11 @@
}
}
}
-
+
}
+
+
+ // -------------------------------------------------------- Private Methods
/**
1.3 +1 -29 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/Connector.java
Index: Connector.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/Connector.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Connector.java 23 Jun 2004 13:51:35 -0000 1.2
+++ Connector.java 23 Jun 2004 16:59:41 -0000 1.3
@@ -110,12 +110,6 @@
/**
- * The debugging detail level for this component.
- */
- private int debug = 0;
-
-
- /**
* The "enable DNS lookups" flag for this Connector.
*/
private boolean enableLookups = false;
@@ -632,28 +626,6 @@
public void setContainer(Container container) {
this.container = container;
-
- }
-
-
- /**
- * Return the debugging detail level for this component.
- */
- public int getDebug() {
-
- return (debug);
-
- }
-
-
- /**
- * Set the debugging detail level for this component.
- *
- * @param debug The new debugging detail level
- */
- public void setDebug(int debug) {
-
- this.debug = debug;
}
1.2 +8 -33 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/InputBuffer.java
Index: InputBuffer.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/InputBuffer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InputBuffer.java 23 Jun 2004 08:24:58 -0000 1.1
+++ InputBuffer.java 23 Jun 2004 16:59:41 -0000 1.2
@@ -48,8 +48,6 @@
public static final String DEFAULT_ENCODING =
org.apache.coyote.Constants.DEFAULT_CHARACTER_ENCODING;
public static final int DEFAULT_BUFFER_SIZE = 8*1024;
- static final int debug = 0;
-
// The buffer can be used for byte[] and char[] reading
// ( this is needed to support ServletInputStream and BufferedReader )
@@ -208,14 +206,11 @@
* Recycle the output buffer.
*/
public void recycle() {
-
- if (debug > 0)
- log("recycle()");
-
- state = INITIAL_STATE;
- bytesRead = 0;
- charsRead = 0;
-
+
+ state = INITIAL_STATE;
+ bytesRead = 0;
+ charsRead = 0;
+
// If usage of mark made the buffer too big, reallocate it
if (cb.getChars().length > size) {
cb = new CharChunk(size);
@@ -228,14 +223,14 @@
markPos = -1;
bb.recycle();
closed = false;
-
+
if (conv != null) {
conv.recycle();
}
-
+
gotEnc = false;
enc = null;
-
+
}
@@ -277,9 +272,6 @@
public int realReadBytes(byte cbuf[], int off, int len)
throws IOException {
- if (debug > 2)
- log("realRead() " + coyoteRequest);
-
if (closed)
return -1;
if (coyoteRequest == null)
@@ -329,15 +321,9 @@
public int realReadChars(char cbuf[], int off, int len)
throws IOException {
- if (debug > 0)
- log("realRead() " + cb.getOffset() + " " + len);
-
if (!gotEnc)
setConverter();
- if (debug > 0)
- log("encoder: " + conv + " " + gotEnc);
-
if (bb.getLength() <= 0) {
int nRead = realReadBytes(bb.getBytes(), 0, bb.getBytes().length);
if (nRead < 0) {
@@ -474,9 +460,6 @@
if (coyoteRequest != null)
enc = coyoteRequest.getCharacterEncoding();
- if (debug > 0)
- log("Got encoding: " + enc);
-
gotEnc = true;
if (enc == null)
enc = DEFAULT_ENCODING;
@@ -497,9 +480,6 @@
Exception e = ex.getException();
if (e instanceof IOException)
throw (IOException)e;
-
- if (debug > 0)
- log("setConverter: " + ex.getMessage());
}
} else {
conv = new B2CConverter(enc);
@@ -507,11 +487,6 @@
encoders.put(enc, conv);
}
- }
-
-
- protected void log( String s ) {
- System.out.println("InputBuffer: " + s);
}
1.2 +2 -9 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/CoyoteAdapter.java
Index: CoyoteAdapter.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/CoyoteAdapter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CoyoteAdapter.java 23 Jun 2004 08:24:57 -0000 1.1
+++ CoyoteAdapter.java 23 Jun 2004 16:59:41 -0000 1.2
@@ -70,7 +70,6 @@
super();
this.connector = connector;
- this.debug = connector.getDebug();
}
@@ -85,12 +84,6 @@
/**
- * The debugging detail level for this component.
- */
- private int debug = 0;
-
-
- /**
* The match string for identifying a session ID parameter.
*/
private static final String match =
@@ -155,7 +148,7 @@
// request parameters
if ( postParseRequest(req, request, res, response) ) {
// Calling the container
- connector.getContainer().invoke(request, response);
+ connector.getContainer().getPipeline().getFirst().invoke(request, response);
}
response.finishResponse();
1.2 +8 -50 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/OutputBuffer.java
Index: OutputBuffer.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/OutputBuffer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- OutputBuffer.java 23 Jun 2004 08:24:57 -0000 1.1
+++ OutputBuffer.java 23 Jun 2004 16:59:41 -0000 1.2
@@ -49,7 +49,6 @@
public static final String DEFAULT_ENCODING =
org.apache.coyote.Constants.DEFAULT_CHARACTER_ENCODING;
public static final int DEFAULT_BUFFER_SIZE = 8*1024;
- static final int debug = 0;
// The buffer can be used for byte[] and char[] writing
@@ -227,26 +226,23 @@
* Recycle the output buffer.
*/
public void recycle() {
-
- if (debug > 0)
- log("recycle()");
-
- state = INITIAL_STATE;
- bytesWritten = 0;
- charsWritten = 0;
-
+
+ state = INITIAL_STATE;
+ bytesWritten = 0;
+ charsWritten = 0;
+
cb.recycle();
bb.recycle();
closed = false;
suspended = false;
-
+
if (conv!= null) {
conv.recycle();
}
-
+
gotEnc = false;
enc = null;
-
+
}
@@ -351,9 +347,6 @@
public void realWriteBytes(byte buf[], int off, int cnt)
throws IOException {
- if (debug > 2)
- log("realWrite(b, " + off + ", " + cnt + ") " + coyoteResponse);
-
if (closed)
return;
if (coyoteResponse == null)
@@ -394,8 +387,6 @@
if (closed)
return;
- if (debug > 0)
- log("write(b,off,len)");
bb.append(b, off, len);
bytesWritten += len;
@@ -409,7 +400,6 @@
}
- // XXX Char or byte ?
public void writeByte(int b)
throws IOException {
@@ -420,9 +410,6 @@
cb.flushBuffer();
state = BYTE_STATE;
- if (debug > 0)
- log("write(b)");
-
bb.append( (byte)b );
bytesWritten++;
@@ -440,9 +427,6 @@
state = CHAR_STATE;
- if (debug > 0)
- log("writeChar(b)");
-
cb.append((char) c);
charsWritten++;
@@ -468,9 +452,6 @@
state = CHAR_STATE;
- if (debug > 0)
- log("write(c,off,len)" + cb.getLength() + " " + cb.getLimit());
-
cb.append(c, off, len);
charsWritten += len;
@@ -485,9 +466,6 @@
state = CHAR_STATE;
- if (debug > 1)
- log("write(s,off,len)");
-
int len = sb.length();
charsWritten += len;
cb.append(sb);
@@ -506,9 +484,6 @@
state=CHAR_STATE;
- if (debug > 1)
- log("write(s,off,len)");
-
charsWritten += len;
if (s==null)
s="null";
@@ -534,9 +509,6 @@
public void flushChars()
throws IOException {
- if (debug > 0)
- log("flushChars() " + cb.getLength());
-
cb.flushBuffer();
state = BYTE_STATE;
@@ -556,15 +528,9 @@
public void realWriteChars(char c[], int off, int len)
throws IOException {
- if (debug > 0)
- log("realWrite(c,o,l) " + cb.getOffset() + " " + len);
-
if (!gotEnc)
setConverter();
- if (debug > 0)
- log("encoder: " + conv + " " + gotEnc);
-
conv.convert(c, off, len);
conv.flushBuffer(); // ???
@@ -586,9 +552,6 @@
if (coyoteResponse != null)
enc = coyoteResponse.getCharacterEncoding();
- if (debug > 0)
- log("Got encoding: " + enc);
-
gotEnc = true;
if (enc == null)
enc = DEFAULT_ENCODING;
@@ -610,9 +573,6 @@
Exception e = ex.getException();
if (e instanceof IOException)
throw (IOException)e;
-
- if (debug > 0)
- log("setConverter: " + ex.getMessage());
}
} else {
conv = new C2BConverter(bb, enc);
@@ -633,8 +593,6 @@
public void flushBytes()
throws IOException {
- if (debug > 0)
- log("flushBytes() " + bb.getLength());
bb.flushBuffer();
}
1.29 +1 -33 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java
Index: WebappLoader.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- WebappLoader.java 23 Jun 2004 13:51:36 -0000 1.28
+++ WebappLoader.java 23 Jun 2004 16:59:41 -0000 1.29
@@ -133,12 +133,6 @@
/**
- * The debugging detail level for this component.
- */
- private int debug = 0;
-
-
- /**
* The DefaultContext with which this Loader is associated.
*/
protected DefaultContext defaultContext = null;
@@ -296,31 +290,6 @@
/**
- * Return the debugging detail level for this component.
- */
- public int getDebug() {
-
- return (this.debug);
-
- }
-
-
- /**
- * Set the debugging detail level for this component.
- *
- * @param debug The new debugging detail level
- */
- public void setDebug(int debug) {
-
- int oldDebug = this.debug;
- this.debug = debug;
- support.firePropertyChange("debug", new Integer(oldDebug),
- new Integer(this.debug));
-
- }
-
-
- /**
* Return the "follow standard delegation model" flag used to configure
* our ClassLoader.
*/
@@ -675,7 +644,6 @@
classLoader = createClassLoader();
classLoader.setResources(container.getResources());
- classLoader.setDebug(this.debug);
classLoader.setDelegate(this.delegate);
for (int i = 0; i < repositories.length; i++) {
1.35 +1 -29 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
Index: WebappClassLoader.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- WebappClassLoader.java 26 May 2004 15:47:40 -0000 1.34
+++ WebappClassLoader.java 23 Jun 2004 16:59:41 -0000 1.35
@@ -225,12 +225,6 @@
/**
- * The debugging detail level of this component.
- */
- protected int debug = 0;
-
-
- /**
* Should this class loader delegate to the parent class loader
* <strong>before</strong> searching its own repositories (i.e. the
* usual Java2 delegation model)? If set to <code>false</code>,
@@ -384,28 +378,6 @@
public void setResources(DirContext resources) {
this.resources = resources;
-
- }
-
-
- /**
- * Return the debugging detail level for this component.
- */
- public int getDebug() {
-
- return (this.debug);
-
- }
-
-
- /**
- * Set the debugging detail level for this component.
- *
- * @param debug The new debugging detail level
- */
- public void setDebug(int debug) {
-
- this.debug = debug;
}
1.5 +12 -20 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Tool.java
Index: Tool.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Tool.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Tool.java 27 Feb 2004 14:58:49 -0000 1.4
+++ Tool.java 23 Jun 2004 16:59:41 -0000 1.5
@@ -22,6 +22,9 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* <p>General purpose wrapper for command line tools that should execute in an
@@ -51,7 +54,6 @@
* (useful when your command line tool runs Ant).</li>
* <li><em>-common</em> : Add <code>common/classes</code> and
* <code>common/lib</codE) to the class loader repositories.</li>
- * <li><em>-debug</em> : Enable debugging messages from this wrapper.</li>
* <li><em>-server</em> : Add <code>server/classes</code> and
* <code>server/lib</code> to the class loader repositories.</li>
* <li><em>-shared</em> : Add <code>shared/classes</code> and
@@ -70,6 +72,8 @@
public final class Tool {
+ private static Log log = LogFactory.getLog(Tool.class);
+
// ------------------------------------------------------- Static Variables
@@ -92,12 +96,6 @@
/**
- * Enable debugging detail messages?
- */
- private static boolean debug = false;
-
-
- /**
* Include server classes in the repositories?
*/
private static boolean server = false;
@@ -136,8 +134,6 @@
ant = true;
else if ("-common".equals(args[index]))
common = true;
- else if ("-debug".equals(args[index]))
- debug = true;
else if ("-server".equals(args[index]))
server = true;
else if ("-shared".equals(args[index]))
@@ -158,10 +154,6 @@
// Construct the class loader we will be using
ClassLoader classLoader = null;
try {
- if (debug) {
- log("Constructing class loader");
- ClassLoaderFactory.setDebug(1);
- }
ArrayList packed = new ArrayList();
ArrayList unpacked = new ArrayList();
unpacked.add(new File(catalinaHome, "classes"));
@@ -199,8 +191,8 @@
Class clazz = null;
String className = args[index++];
try {
- if (debug)
- log("Loading application class " + className);
+ if (log.isDebugEnabled())
+ log.debug("Loading application class " + className);
clazz = classLoader.loadClass(className);
} catch (Throwable t) {
log("Exception creating instance of " + className, t);
@@ -212,8 +204,8 @@
String params[] = new String[args.length - index];
System.arraycopy(args, index, params, 0, params.length);
try {
- if (debug)
- log("Identifying main() method");
+ if (log.isDebugEnabled())
+ log.debug("Identifying main() method");
String methodName = "main";
Class paramTypes[] = new Class[1];
paramTypes[0] = params.getClass();
@@ -225,8 +217,8 @@
// Invoke the main method of the application class
try {
- if (debug)
- log("Calling main() method");
+ if (log.isDebugEnabled())
+ log.debug("Calling main() method");
Object paramValues[] = new Object[1];
paramValues[0] = params;
method.invoke(null, paramValues);
1.19 +1 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Embedded.java
Index: Embedded.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Embedded.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- Embedded.java 23 Jun 2004 13:51:37 -0000 1.18
+++ Embedded.java 23 Jun 2004 16:59:41 -0000 1.19
@@ -478,7 +478,6 @@
StandardContext context = new StandardContext();
- context.setDebug(debug);
context.setDocBase(docBase);
context.setPath(path);
@@ -502,7 +501,6 @@
StandardEngine engine = new StandardEngine();
- engine.setDebug(debug);
// Default host will be set to the first host added
engine.setRealm(realm); // Inherited by all children
@@ -546,7 +544,6 @@
StandardHost host = new StandardHost();
host.setAppBase(appBase);
- host.setDebug(debug);
host.setName(name);
return (host);
1.7 +10 -40 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ClassLoaderFactory.java
Index: ClassLoaderFactory.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ClassLoaderFactory.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ClassLoaderFactory.java 27 Feb 2004 14:58:48 -0000 1.6
+++ ClassLoaderFactory.java 23 Jun 2004 16:59:41 -0000 1.7
@@ -23,6 +23,8 @@
import java.util.ArrayList;
import org.apache.catalina.loader.StandardClassLoader;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
@@ -47,39 +49,7 @@
public final class ClassLoaderFactory {
- // ------------------------------------------------------- Static Variables
-
-
- /**
- * Debugging detail level for processing the startup.
- */
- private static int debug = 0;
-
-
- // ------------------------------------------------------ Static Properties
-
-
- /**
- * Return the debugging detail level.
- */
- public static int getDebug() {
-
- return (debug);
-
- }
-
-
- /**
- * Set the debugging detail level.
- *
- * @param newDebug The new debugging detail level
- */
- public static void setDebug(int newDebug) {
-
- debug = newDebug;
-
- }
-
+ private static Log log = LogFactory.getLog(ClassLoaderFactory.class);
// --------------------------------------------------------- Public Methods
@@ -132,8 +102,8 @@
ClassLoader parent)
throws Exception {
- if (debug >= 1)
- log("Creating new class loader");
+ if (log.isDebugEnabled())
+ log.debug("Creating new class loader");
// Construct the "class path" for this class loader
ArrayList list = new ArrayList();
@@ -144,8 +114,8 @@
File file = unpacked[i];
if (!file.exists() || !file.canRead())
continue;
- if (debug >= 1)
- log(" Including directory or JAR "
+ if (log.isDebugEnabled())
+ log.debug(" Including directory or JAR "
+ file.getAbsolutePath());
URL url = new URL("file", null,
file.getCanonicalPath() + File.separator);
@@ -166,8 +136,8 @@
if (!filename.endsWith(".jar"))
continue;
File file = new File(directory, filenames[j]);
- if (debug >= 1)
- log(" Including jar file " + file.getAbsolutePath());
+ if (log.isDebugEnabled())
+ log.debug(" Including jar file " + file.getAbsolutePath());
URL url = new URL("file", null,
file.getCanonicalPath());
list.add(url.toString());
1.19 +12 -52 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Bootstrap.java
Index: Bootstrap.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- Bootstrap.java 12 Mar 2004 14:32:47 -0000 1.18
+++ Bootstrap.java 23 Jun 2004 16:59:41 -0000 1.19
@@ -30,6 +30,8 @@
import javax.management.ObjectName;
import org.apache.catalina.security.SecurityClassLoad;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
@@ -48,7 +50,8 @@
public final class Bootstrap {
-
+ private static Log log = LogFactory.getLog(Bootstrap.class);
+
// -------------------------------------------------------------- Constants
@@ -79,12 +82,6 @@
/**
- * Debugging detail level for processing the startup.
- */
- protected int debug = 0;
-
-
- /**
* Daemon reference.
*/
private Object catalinaDaemon = null;
@@ -100,12 +97,11 @@
private void initClassLoaders() {
try {
- ClassLoaderFactory.setDebug(debug);
commonLoader = createClassLoader("common", null);
catalinaLoader = createClassLoader("server", commonLoader);
sharedLoader = createClassLoader("shared", commonLoader);
} catch (Throwable t) {
- log("Class loader creation threw exception", t);
+ log.error("Class loader creation threw exception", t);
System.exit(1);
}
}
@@ -197,16 +193,16 @@
SecurityClassLoad.securityClassLoad(catalinaLoader);
// Load our startup class and call its process() method
- if (debug >= 1)
- log("Loading startup class");
+ if (log.isDebugEnabled())
+ log.debug("Loading startup class");
Class startupClass =
catalinaLoader.loadClass
("org.apache.catalina.startup.Catalina");
Object startupInstance = startupClass.newInstance();
// Set the shared extensions class loader
- if (debug >= 1)
- log("Setting startup class properties");
+ if (log.isDebugEnabled())
+ log.debug("Setting startup class properties");
String methodName = "setParentClassLoader";
Class paramTypes[] = new Class[1];
paramTypes[0] = Class.forName("java.lang.ClassLoader");
@@ -242,8 +238,8 @@
}
Method method =
catalinaDaemon.getClass().getMethod(methodName, paramTypes);
- if (debug >= 1)
- log("Calling startup class " + method);
+ if (log.isDebugEnabled())
+ log.debug("Calling startup class " + method);
method.invoke(catalinaDaemon, param);
}
@@ -258,15 +254,6 @@
public void init(String[] arguments)
throws Exception {
- // Read the arguments
- if (arguments != null) {
- for (int i = 0; i < arguments.length; i++) {
- if (arguments[i].equals("-debug")) {
- debug = 1;
- }
- }
- }
-
init();
load(arguments);
@@ -499,33 +486,6 @@
*/
public static String getCatalinaBase() {
return System.getProperty("catalina.base", getCatalinaHome());
- }
-
-
- /**
- * Log a debugging detail message.
- *
- * @param message The message to be logged
- */
- protected static void log(String message) {
-
- System.out.print("Bootstrap: ");
- System.out.println(message);
-
- }
-
-
- /**
- * Log a debugging detail message with an exception.
- *
- * @param message The message to be logged
- * @param exception The exception to be logged
- */
- protected static void log(String message, Throwable exception) {
-
- log(message);
- exception.printStackTrace(System.out);
-
}
1.33 +1 -33 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
Index: HostConfig.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- HostConfig.java 23 Jun 2004 13:51:37 -0000 1.32
+++ HostConfig.java 23 Jun 2004 16:59:41 -0000 1.33
@@ -91,12 +91,6 @@
/**
- * The debugging detail level for this component.
- */
- protected int debug = 0;
-
-
- /**
* The names of applications that we have auto-deployed (to avoid
* double deployment attempts).
*/
@@ -209,28 +203,6 @@
/**
- * Return the debugging detail level for this component.
- */
- public int getDebug() {
-
- return (this.debug);
-
- }
-
-
- /**
- * Set the debugging detail level for this component.
- *
- * @param debug The new debugging detail level
- */
- public void setDebug(int debug) {
-
- this.debug = debug;
-
- }
-
-
- /**
* Return the deploy XML config file flag for this component.
*/
public boolean isDeployXML() {
@@ -329,10 +301,6 @@
try {
host = (Host) event.getLifecycle();
if (host instanceof StandardHost) {
- int hostDebug = ((StandardHost) host).getDebug();
- if (hostDebug > this.debug) {
- this.debug = hostDebug;
- }
setDeployXML(((StandardHost) host).isDeployXML());
setUnpackWARs(((StandardHost) host).isUnpackWARs());
setXmlNamespaceAware(((StandardHost) host).getXmlNamespaceAware());
1.30 +2 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Catalina.java
Index: Catalina.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Catalina.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- Catalina.java 23 Jun 2004 08:25:03 -0000 1.29
+++ Catalina.java 23 Jun 2004 16:59:41 -0000 1.30
@@ -218,8 +218,6 @@
isConfig = false;
} else if (args[i].equals("-config")) {
isConfig = true;
- } else if (args[i].equals("-debug")) {
- debug = 1;
} else if (args[i].equals("-nonaming")) {
setUseNaming( false );
} else if (args[i].equals("-help")) {
@@ -620,7 +618,7 @@
System.out.println
("usage: java org.apache.catalina.startup.Catalina"
- + " [ -config {pathname} ] [ -debug ]"
+ + " [ -config {pathname} ]"
+ " [ -nonaming ] { start | stop }");
}
1.25 +1 -3 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java
Index: DeltaSession.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- DeltaSession.java 2 Jun 2004 14:10:01 -0000 1.24
+++ DeltaSession.java 23 Jun 2004 16:59:41 -0000 1.25
@@ -99,8 +99,6 @@
super();
this.manager = manager;
- if (manager instanceof ManagerBase)
- this.debug = ((ManagerBase) manager).getDebug();
}
1.13 +17 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Context.java
Index: Context.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Context.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Context.java 26 May 2004 15:25:12 -0000 1.12
+++ Context.java 23 Jun 2004 16:59:42 -0000 1.13
@@ -386,6 +386,22 @@
/**
+ * Return the value of the swallowOutput flag.
+ */
+ public boolean getSwallowOutput();
+
+
+ /**
+ * Set the value of the swallowOutput flag. If set to true, the system.out
+ * and system.err will be redirected to the logger during a servlet
+ * execution.
+ *
+ * @param swallowOutput The new value
+ */
+ public void setSwallowOutput(boolean swallowOutput);
+
+
+ /**
* Return the Java class name of the Wrapper implementation used
* for servlets registered in this Context.
*/
1.4 +8 -26 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Pipeline.java
Index: Pipeline.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Pipeline.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Pipeline.java 23 Jun 2004 08:24:59 -0000 1.3
+++ Pipeline.java 23 Jun 2004 16:59:42 -0000 1.4
@@ -18,13 +18,6 @@
package org.apache.catalina;
-import java.io.IOException;
-import javax.servlet.ServletException;
-
-import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
-
-
/**
* <p>Interface describing a collection of Valves that should be executed
* in sequence when the <code>invoke()</code> method is invoked. It is
@@ -107,24 +100,6 @@
/**
- * Cause the specified request and response to be processed by the Valves
- * associated with this pipeline, until one of these valves causes the
- * response to be created and returned. The implementation must ensure
- * that multiple simultaneous requests (on different threads) can be
- * processed through the same Pipeline without interfering with each
- * other's control flow.
- *
- * @param request The servlet request we are processing
- * @param response The servlet response we are creating
- *
- * @exception IOException if an input/output error occurs
- * @exception ServletException if a servlet exception is thrown
- */
- public void invoke(Request request, Response response)
- throws IOException, ServletException;
-
-
- /**
* Remove the specified Valve from the pipeline associated with this
* Container, if it is found; otherwise, do nothing. If the Valve is
* found and removed, the Valve's <code>setContainer(null)</code> method
@@ -133,6 +108,13 @@
* @param valve Valve to be removed
*/
public void removeValve(Valve valve);
+
+
+ /**
+ * <p>Return the Valve instance that has been distinguished as the basic
+ * Valve for this Pipeline (if any).
+ */
+ public Valve getFirst();
}
1.28 +1 -28 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/ManagerBase.java
Index: ManagerBase.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/ManagerBase.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- ManagerBase.java 26 May 2004 16:13:59 -0000 1.27
+++ ManagerBase.java 23 Jun 2004 16:59:42 -0000 1.28
@@ -89,12 +89,6 @@
/**
- * The debugging detail level for this component.
- */
- protected int debug = 0;
-
-
- /**
* The DefaultContext with which this Manager is associated.
*/
protected DefaultContext defaultContext = null;
@@ -281,27 +275,6 @@
}
- /**
- * Return the debugging detail level for this component.
- */
- public int getDebug() {
-
- return (this.debug);
-
- }
-
-
- /**
- * Set the debugging detail level for this component.
- *
- * @param debug The new debugging detail level
- */
- public void setDebug(int debug) {
-
- this.debug = debug;
-
- }
-
/** Returns the name of the implementation class.
*/
public String getClassName() {
1.45 +35 -65 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardSession.java
Index: StandardSession.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardSession.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- StandardSession.java 2 Jun 2004 10:18:20 -0000 1.44
+++ StandardSession.java 23 Jun 2004 16:59:42 -0000 1.45
@@ -90,8 +90,6 @@
super();
this.manager = manager;
- if (manager instanceof ManagerBase)
- this.debug = ((ManagerBase) manager).getDebug();
}
@@ -153,13 +151,6 @@
/**
- * The debugging detail level for this component. NOTE: This value
- * is not included in the serialized version of this object.
- */
- protected transient int debug = 0;
-
-
- /**
* Set of attribute names which are not allowed to be persisted.
*/
private static final String[] excludedAttributes = {
@@ -231,7 +222,7 @@
*/
protected boolean isValid = false;
-
+
/**
* Internal notes associated with this session by Catalina components
* and event listeners. <b>IMPLEMENTATION NOTE:</b> This object is
@@ -389,7 +380,8 @@
} catch (Exception e) {
;
}
- log(sm.getString("standardSession.sessionEvent"), t);
+ manager.getContainer().getLogger().error
+ (sm.getString("standardSession.sessionEvent"), t);
}
}
}
@@ -683,7 +675,8 @@
} catch (Exception e) {
;
}
- log(sm.getString("standardSession.sessionEvent"), t);
+ manager.getContainer().getLogger().error
+ (sm.getString("standardSession.sessionEvent"), t);
}
}
}
@@ -730,7 +723,8 @@
((HttpSessionActivationListener)attribute)
.sessionWillPassivate(event);
} catch (Throwable t) {
- log(sm.getString("standardSession.attributeEvent"), t);
+ manager.getContainer().getLogger().error
+ (sm.getString("standardSession.attributeEvent"), t);
}
}
}
@@ -756,7 +750,8 @@
((HttpSessionActivationListener)attribute)
.sessionDidActivate(event);
} catch (Throwable t) {
- log(sm.getString("standardSession.attributeEvent"), t);
+ manager.getContainer().getLogger().error
+ (sm.getString("standardSession.attributeEvent"), t);
}
}
}
@@ -1221,7 +1216,8 @@
try {
((HttpSessionBindingListener) value).valueBound(event);
} catch (Throwable t){
- log(sm.getString("standardSession.bindingEvent"), t);
+ manager.getContainer().getLogger().error
+ (sm.getString("standardSession.bindingEvent"), t);
}
}
@@ -1235,7 +1231,8 @@
((HttpSessionBindingListener) unbound).valueUnbound
(new HttpSessionBindingEvent(getSession(), name));
} catch (Throwable t) {
- log(sm.getString("standardSession.bindingEvent"), t);
+ manager.getContainer().getLogger().error
+ (sm.getString("standardSession.bindingEvent"), t);
}
}
@@ -1289,7 +1286,8 @@
} catch (Exception e) {
;
}
- log(sm.getString("standardSession.attributeEvent"), t);
+ manager.getContainer().getLogger().error
+ (sm.getString("standardSession.attributeEvent"), t);
}
}
@@ -1325,8 +1323,9 @@
principal = null; // Transient only
// setId((String) stream.readObject());
id = (String) stream.readObject();
- if (debug >= 2)
- log("readObject() loading session " + id);
+ if (manager.getContainer().getLogger().isDebugEnabled())
+ manager.getContainer().getLogger().debug
+ ("readObject() loading session " + id);
// Deserialize the attribute count and attribute values
if (attributes == null)
@@ -1339,8 +1338,8 @@
Object value = (Object) stream.readObject();
if ((value instanceof String) && (value.equals(NOT_SERIALIZED)))
continue;
- if (debug >= 2)
- log(" loading attribute '" + name +
+ if (manager.getContainer().getLogger().isDebugEnabled())
+ manager.getContainer().getLogger().debug(" loading attribute '" + name +
"' with value '" + value + "'");
synchronized (attributes) {
attributes.put(name, value);
@@ -1380,8 +1379,9 @@
stream.writeObject(new Boolean(isValid));
stream.writeObject(new Long(thisAccessedTime));
stream.writeObject(id);
- if (debug >= 2)
- log("writeObject() storing session " + id);
+ if (manager.getContainer().getLogger().isDebugEnabled())
+ manager.getContainer().getLogger().debug
+ ("writeObject() storing session " + id);
// Accumulate the names of serializable and non-serializable attributes
String keys[] = keys();
@@ -1410,15 +1410,18 @@
stream.writeObject((String) saveNames.get(i));
try {
stream.writeObject(saveValues.get(i));
- if (debug >= 2)
- log(" storing attribute '" + saveNames.get(i) +
+ if (manager.getContainer().getLogger().isDebugEnabled())
+ manager.getContainer().getLogger().debug
+ (" storing attribute '" + saveNames.get(i) +
"' with value '" + saveValues.get(i) + "'");
} catch (NotSerializableException e) {
- log(sm.getString("standardSession.notSerializable",
- saveNames.get(i), id), e);
+ manager.getContainer().getLogger().warn
+ (sm.getString("standardSession.notSerializable",
+ saveNames.get(i), id), e);
stream.writeObject(NOT_SERIALIZED);
- if (debug >= 2)
- log(" storing attribute '" + saveNames.get(i) +
+ if (manager.getContainer().getLogger().isDebugEnabled())
+ manager.getContainer().getLogger().debug
+ (" storing attribute '" + saveNames.get(i) +
"' with value NOT_SERIALIZED");
}
}
@@ -1596,42 +1599,9 @@
} catch (Exception e) {
;
}
- log(sm.getString("standardSession.attributeEvent"), t);
+ manager.getContainer().getLogger().error
+ (sm.getString("standardSession.attributeEvent"), t);
}
- }
-
- }
-
-
- /**
- * Log a message on the Logger associated with our Manager (if any).
- *
- * @param message Message to be logged
- */
- protected void log(String message) {
-
- if ((manager != null) && (manager instanceof ManagerBase)) {
- ((ManagerBase) manager).log(message);
- } else {
- System.out.println("StandardSession: " + message);
- }
-
- }
-
-
- /**
- * Log a message on the Logger associated with our Manager (if any).
- *
- * @param message Message to be logged
- * @param throwable Associated exception
- */
- protected void log(String message, Throwable throwable) {
-
- if ((manager != null) && (manager instanceof ManagerBase)) {
- ((ManagerBase) manager).log(message, throwable);
- } else {
- System.out.println("StandardSession: " + message);
- throwable.printStackTrace(System.out);
}
}
1.6 +8 -25 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java
Index: GlobalResourcesLifecycleListener.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- GlobalResourcesLifecycleListener.java 9 Jun 2004 20:38:16 -0000 1.5
+++ GlobalResourcesLifecycleListener.java 23 Jun 2004 16:59:42 -0000 1.6
@@ -65,23 +65,6 @@
protected static Registry registry = MBeanUtils.createRegistry();
- // ------------------------------------------------------------- Properties
-
-
- /**
- * The debugging detail level for this component.
- */
- protected int debug = 0;
-
- public int getDebug() {
- return (this.debug);
- }
-
- public void setDebug(int debug) {
- this.debug = debug;
- }
-
-
// ---------------------------------------------- LifecycleListener Methods
@@ -142,7 +125,7 @@
protected void createMBeans(String prefix, Context context)
throws NamingException {
- if (debug >= 1) {
+ if (log.isDebugEnabled()) {
log.debug("Creating MBeans for Global JNDI Resources in Context '" +
prefix + "'");
}
@@ -153,7 +136,7 @@
Binding binding = (Binding) bindings.next();
String name = prefix + binding.getName();
Object value = context.lookup(binding.getName());
- if (debug >= 2) {
+ if (log.isDebugEnabled()) {
log.debug("Checking resource " + name);
}
if (value instanceof Context) {
@@ -188,7 +171,7 @@
throws Exception {
// Create the MBean for the UserDatabase itself
- if (debug >= 2) {
+ if (log.isDebugEnabled()) {
log.debug("Creating UserDatabase MBeans for resource " + name);
log.debug("Database=" + database);
}
@@ -201,7 +184,7 @@
Iterator roles = database.getRoles();
while (roles.hasNext()) {
Role role = (Role) roles.next();
- if (debug >= 3) {
+ if (log.isDebugEnabled()) {
log.debug(" Creating Role MBean for role " + role);
}
if (MBeanUtils.createMBean(role) == null) {
@@ -214,7 +197,7 @@
Iterator groups = database.getGroups();
while (groups.hasNext()) {
Group group = (Group) groups.next();
- if (debug >= 3) {
+ if (log.isDebugEnabled()) {
log.debug(" Creating Group MBean for group " + group);
}
if (MBeanUtils.createMBean(group) == null) {
@@ -227,7 +210,7 @@
Iterator users = database.getUsers();
while (users.hasNext()) {
User user = (User) users.next();
- if (debug >= 3) {
+ if (log.isDebugEnabled()) {
log.debug(" Creating User MBean for user " + user);
}
if (MBeanUtils.createMBean(user) == null) {
@@ -244,7 +227,7 @@
*/
protected void destroyMBeans() {
- if (debug >= 1) {
+ if (log.isDebugEnabled()) {
log.debug("Destroying MBeans for Global JNDI Resources");
}
1.16 +1 -15 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/ServerLifecycleListener.java
Index: ServerLifecycleListener.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/ServerLifecycleListener.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ServerLifecycleListener.java 23 Jun 2004 13:51:38 -0000 1.15
+++ ServerLifecycleListener.java 23 Jun 2004 16:59:42 -0000 1.16
@@ -74,20 +74,6 @@
/**
- * The debugging detail level for this component.
- */
- protected int debug = 0;
-
- public int getDebug() {
- return (this.debug);
- }
-
- public void setDebug(int debug) {
- this.debug = debug;
- }
-
-
- /**
* Semicolon separated list of paths containing MBean desciptor resources.
*/
protected String descriptors = null;
1.5 +1 -25 jakarta-tomcat-catalina/catalina/src/share/org/apache/naming/resources/BaseDirContext.java
Index: BaseDirContext.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/naming/resources/BaseDirContext.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BaseDirContext.java 27 Feb 2004 14:58:54 -0000 1.4
+++ BaseDirContext.java 23 Jun 2004 16:59:42 -0000 1.5
@@ -68,12 +68,6 @@
/**
- * The debugging detail level for this component.
- */
- protected int debug = 0;
-
-
- /**
* The document base path.
*/
protected String docBase = null;
@@ -116,24 +110,6 @@
// ------------------------------------------------------------- Properties
-
-
- /**
- * Return the debugging detail level for this component.
- */
- public int getDebug() {
- return (this.debug);
- }
-
-
- /**
- * Set the debugging detail level for this component.
- *
- * @param debug The new debugging detail level
- */
- public void setDebug(int debug) {
- this.debug = debug;
- }
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org