Author: chris.laprun(a)jboss.com
Date: 2008-02-13 12:15:25 -0500 (Wed, 13 Feb 2008)
New Revision: 9953
Modified:
modules/web/trunk/web/src/main/java/org/jboss/portal/web/ServletContainer.java
modules/web/trunk/web/src/main/java/org/jboss/portal/web/impl/tomcat/TC6ServletContainerContext.java
Log:
- Replaced output to sysout by logging.
Modified: modules/web/trunk/web/src/main/java/org/jboss/portal/web/ServletContainer.java
===================================================================
---
modules/web/trunk/web/src/main/java/org/jboss/portal/web/ServletContainer.java 2008-02-13
14:45:12 UTC (rev 9952)
+++
modules/web/trunk/web/src/main/java/org/jboss/portal/web/ServletContainer.java 2008-02-13
17:15:25 UTC (rev 9953)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.web;
+import org.jboss.logging.Logger;
import org.jboss.portal.web.spi.ServletContainerContext;
import org.jboss.portal.web.spi.WebAppContext;
@@ -29,12 +30,12 @@
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import java.util.HashMap;
-import java.io.InputStream;
-import java.io.IOException;
/**
* A static registry for the servlet container context.
@@ -44,6 +45,7 @@
*/
public class ServletContainer
{
+ private final static Logger log = Logger.getLogger(ServletContainer.class);
/** . */
private final Object lock = new Object();
@@ -58,15 +60,15 @@
private RegistrationImpl registration;
/**
- * Register a servlet container context. The registration is considered as successful
if no existing context
- * is already registered.
+ * Register a servlet container context. The registration is considered as successful
if no existing context is
+ * already registered.
*
* @param context the servlet container context to register
* @throws IllegalArgumentException if the context is null
*/
public void register(ServletContainerContext context)
{
- synchronized(lock)
+ synchronized (lock)
{
if (context == null)
{
@@ -87,7 +89,7 @@
public boolean addWebAppListener(WebAppListener listener)
{
- synchronized(lock)
+ synchronized (lock)
{
if (listener == null)
{
@@ -110,7 +112,7 @@
public boolean removeWebAppListener(WebAppListener listener)
{
- synchronized(lock)
+ synchronized (lock)
{
if (listener == null)
{
@@ -147,7 +149,7 @@
private void fireEvent(WebAppEvent event)
{
- for (Iterator i = listeners.iterator();i.hasNext();)
+ for (Iterator i = listeners.iterator(); i.hasNext();)
{
safeFireEvent((WebAppListener)i.next(), event);
}
@@ -157,10 +159,10 @@
* Generic detyped request dispatch to a servlet context using the include mechanism.
*
* @param targetServletContext the target servlet context to dispatch to
- * @param request the request valid in the current servlet context
- * @param response the response valid in the current servlet context
- * @param callback the callback to perform after the dispatch operation
- * @param handback the handback object to provide
+ * @param request the request valid in the current servlet context
+ * @param response the response valid in the current servlet context
+ * @param callback the callback to perform after the dispatch operation
+ * @param handback the handback object to provide
* @return any object
* @throws Exception any exception
*/
@@ -207,7 +209,7 @@
{
throw new IllegalStateException("Disposed registration");
}
- synchronized(container.lock)
+ synchronized (container.lock)
{
if (webAppContext == null)
{
@@ -220,14 +222,14 @@
//
if (container.webAppMap.containsKey(key))
{
- System.out.println("Web application " + key + " is already
registered");
+ log.debug("Web application " + key + " is already
registered");
return false;
}
else
{
try
{
- System.out.println("Web application " + key + "
registration");
+ log.debug("Web application " + key + "
registration");
webAppContext.start();
WebAppImpl webApp = new WebAppImpl(webAppContext);
container.webAppMap.put(key, webApp);
@@ -236,7 +238,7 @@
}
catch (Exception e)
{
- System.out.println("Was not able to start web app context "+
key);
+ log.debug("Was not able to start web app context " + key);
e.printStackTrace();
return false;
}
@@ -250,7 +252,7 @@
{
throw new IllegalStateException("Disposed registration");
}
- synchronized(container.lock)
+ synchronized (container.lock)
{
if (webAppId == null)
{
@@ -261,14 +263,14 @@
WebAppImpl webApp = (WebAppImpl)container.webAppMap.remove(webAppId);
if (webApp != null)
{
- System.out.println("Web application " + webAppId + "
cleanup");
+ log.debug("Web application " + webAppId + "
cleanup");
container.fireEvent(new WebAppLifeCycleEvent(webApp,
WebAppLifeCycleEvent.REMOVED));
webApp.context.stop();
return true;
}
else
{
- System.out.println("Web application " + webAppId + " was
not registered");
+ log.debug("Web application " + webAppId + " was not
registered");
return false;
}
}
@@ -280,7 +282,7 @@
{
throw new IllegalStateException("Disposed registration");
}
- synchronized(container.lock)
+ synchronized (container.lock)
{
// Unregister all web apps
for (Iterator i = container.webAppMap.values().iterator(); i.hasNext();)
@@ -311,9 +313,7 @@
}
}
- /**
- * Implementation of the <code>WebApp</code> interface.
- */
+ /** Implementation of the <code>WebApp</code> interface. */
private static class WebAppImpl implements WebApp
{
Modified:
modules/web/trunk/web/src/main/java/org/jboss/portal/web/impl/tomcat/TC6ServletContainerContext.java
===================================================================
---
modules/web/trunk/web/src/main/java/org/jboss/portal/web/impl/tomcat/TC6ServletContainerContext.java 2008-02-13
14:45:12 UTC (rev 9952)
+++
modules/web/trunk/web/src/main/java/org/jboss/portal/web/impl/tomcat/TC6ServletContainerContext.java 2008-02-13
17:15:25 UTC (rev 9953)
@@ -22,27 +22,28 @@
******************************************************************************/
package org.jboss.portal.web.impl.tomcat;
-import org.jboss.portal.web.RequestDispatchCallback;
-import org.jboss.portal.web.impl.DefaultServletContainerFactory;
-import org.jboss.portal.web.command.CommandDispatcher;
-import org.jboss.portal.web.spi.ServletContainerContext;
import org.apache.catalina.Container;
+import org.apache.catalina.ContainerEvent;
+import org.apache.catalina.ContainerListener;
+import org.apache.catalina.Context;
import org.apache.catalina.Engine;
import org.apache.catalina.Host;
-import org.apache.catalina.ContainerEvent;
-import org.apache.catalina.Context;
-import org.apache.catalina.ContainerListener;
import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
-import org.apache.catalina.LifecycleEvent;
+import org.jboss.logging.Logger;
+import org.jboss.portal.web.RequestDispatchCallback;
+import org.jboss.portal.web.command.CommandDispatcher;
+import org.jboss.portal.web.impl.DefaultServletContainerFactory;
+import org.jboss.portal.web.spi.ServletContainerContext;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.HashSet;
import java.util.Set;
-import java.util.HashSet;
-import java.io.IOException;
/**
* An implementation of the <code>ServletContainerContext</code> for Tomcat.
@@ -52,6 +53,7 @@
*/
public class TC6ServletContainerContext implements ServletContainerContext,
ContainerListener, LifecycleListener
{
+ private final static Logger log = Logger.getLogger(TC6ServletContainerContext.class);
/** . */
private final CommandDispatcher dispatcher = new CommandDispatcher();
@@ -185,9 +187,8 @@
}
/**
- * Register an host for registration which means that we fire events for all the
contexts it
- * contains and we subscribe for its life cycle events. If the host is already
monitored
- * nothing is done.
+ * Register an host for registration which means that we fire events for all the
contexts it contains and we
+ * subscribe for its life cycle events. If the host is already monitored nothing is
done.
*
* @param host the host to register for monitoring
*/
@@ -281,7 +282,7 @@
{
try
{
- System.out.println("Context added " + context.getPath());
+ log.debug("Context added " + context.getPath());
TC6WebAppContext webAppContext = new TC6WebAppContext(context);
//
Show replies by date