diff --git a/projects/samskivert/src/java/com/samskivert/webmacro/DispatcherServlet.java b/projects/samskivert/src/java/com/samskivert/webmacro/DispatcherServlet.java index 6ed70ef5..8b10de7d 100644 --- a/projects/samskivert/src/java/com/samskivert/webmacro/DispatcherServlet.java +++ b/projects/samskivert/src/java/com/samskivert/webmacro/DispatcherServlet.java @@ -1,5 +1,5 @@ // -// $Id: DispatcherServlet.java,v 1.1 2001/02/15 01:44:34 mdb Exp $ +// $Id: DispatcherServlet.java,v 1.2 2001/02/16 03:27:54 mdb Exp $ package com.samskivert.webmacro; @@ -119,7 +119,7 @@ public class DispatcherServlet extends WMServlet public void start () throws ServletException { - // Log.log.info("Initializing dispatcher servlet."); + // Log.info("Initializing dispatcher servlet."); // first load the properties file Properties props = null; @@ -129,15 +129,14 @@ public class DispatcherServlet extends WMServlet props = ConfigUtil.loadProperties("dispatcher.properties", cld); } catch (IOException ioe) { - Log.log.warning("Failure trying to load " + - "'dispatcher.properties': " + ioe); + Log.warning("Failure trying to load 'dispatcher.properties': " + + ioe); } if (props == null) { - Log.log.warning("Unable to load properties for " + - "dispatcher servlet."); - Log.log.warning("Make sure 'dispatcher.properties' file " + - "exists somewhere in your classpath."); + Log.warning("Unable to load properties for dispatcher servlet."); + Log.warning("Make sure 'dispatcher.properties' file exists " + + "somewhere in your classpath."); props = new Properties(); } @@ -152,13 +151,13 @@ public class DispatcherServlet extends WMServlet // make sure we're not missing anything if (baseURI == null) { - Log.log.warning("Application '" + appid + - "' missing base_uri specification."); + Log.warning("Application '" + appid + "' missing " + + "base_uri specification."); continue; } if (basePkg == null) { - Log.log.warning("Application '" + appid + - "' missing base_pkg specification."); + Log.warning("Application '" + appid + "' missing " + + "base_pkg specification."); continue; } @@ -178,6 +177,10 @@ public class DispatcherServlet extends WMServlet throw new HandlerException("Unable to load template: " + e); } + // assume an HTML response unless otherwise massaged by the data + // populator + ctx.getResponse().setContentType("text/html"); + // then we populate the context with data try { ContextPopulator pop = selectPopulator(ctx); @@ -214,7 +217,7 @@ public class DispatcherServlet extends WMServlet throws NotFoundException { String path = cleanupURI(ctx.getRequest().getRequestURI()); - // Log.log.info("Loading template [path=" + path + "]."); + // Log.info("Loading template [path=" + path + "]."); return getTemplate(path); } @@ -234,7 +237,7 @@ public class DispatcherServlet extends WMServlet { String path = cleanupURI(ctx.getRequest().getRequestURI()); String pclass = null; - // Log.log.info("Loading populator [path=" + path + "]."); + // Log.info("Loading populator [path=" + path + "]."); // try to locate an application that matches this URI for (int i = 0; i < _apps.size(); i++) { @@ -258,9 +261,9 @@ public class DispatcherServlet extends WMServlet pop = (ContextPopulator)pcl.newInstance(); } catch (Throwable t) { - Log.log.warning("Unable to instantiate populator for " + - "matching application [path=" + path + - ", pclass=" + pclass + ", error=" + t + "]."); + Log.warning("Unable to instantiate populator for " + + "matching application [path=" + path + + ", pclass=" + pclass + ", error=" + t + "]."); // use a dummy in it's place so that we don't sit around // all day freaking out about our inability to instantiate // the proper populator class @@ -288,7 +291,7 @@ public class DispatcherServlet extends WMServlet int sidx = uri.indexOf("/", dsidx + 2); if (sidx == -1) { - Log.log.warning("Malformed URI?! [uri=" + uri + "]."); + Log.warning("Malformed URI?! [uri=" + uri + "]."); return "/"; } diff --git a/projects/samskivert/src/java/com/samskivert/webmacro/ExceptionMap.java b/projects/samskivert/src/java/com/samskivert/webmacro/ExceptionMap.java index ff5afbee..7c88c566 100644 --- a/projects/samskivert/src/java/com/samskivert/webmacro/ExceptionMap.java +++ b/projects/samskivert/src/java/com/samskivert/webmacro/ExceptionMap.java @@ -1,5 +1,5 @@ // -// $Id: ExceptionMap.java,v 1.2 2001/02/15 01:44:34 mdb Exp $ +// $Id: ExceptionMap.java,v 1.3 2001/02/16 03:27:54 mdb Exp $ package com.samskivert.webmacro; @@ -72,8 +72,7 @@ public class ExceptionMap ClassLoader cld = ExceptionMap.class.getClassLoader(); InputStream config = ConfigUtil.getStream(PROPS_NAME, cld); if (config == null) { - Log.log.warning("Unable to load " + PROPS_NAME + - " from CLASSPATH."); + Log.warning("Unable to load " + PROPS_NAME + " from CLASSPATH."); } else { // otherwise process ye old config file. @@ -101,9 +100,9 @@ public class ExceptionMap _keys.set(i, cl); } catch (Throwable t) { - Log.log.warning("Unable to resolve exception " + - "class. [class=" + exclass + - ", error=" + t + "]."); + Log.warning("Unable to resolve exception class. " + + "[class=" + exclass + + ", error=" + t + "]."); _keys.remove(i); _values.remove(i); i--; // back on up a notch @@ -111,8 +110,7 @@ public class ExceptionMap } } catch (IOException ioe) { - Log.log.warning("Error reading exception mapping file: " + - ioe); + Log.warning("Error reading exception mapping file: " + ioe); } } } diff --git a/projects/samskivert/src/java/com/samskivert/webmacro/Log.java b/projects/samskivert/src/java/com/samskivert/webmacro/Log.java index 7898992d..6aca94b3 100644 --- a/projects/samskivert/src/java/com/samskivert/webmacro/Log.java +++ b/projects/samskivert/src/java/com/samskivert/webmacro/Log.java @@ -1,5 +1,5 @@ // -// $Id: Log.java,v 1.1 2001/02/13 20:00:28 mdb Exp $ +// $Id: Log.java,v 1.2 2001/02/16 03:27:54 mdb Exp $ package com.samskivert.webmacro; @@ -11,4 +11,22 @@ public class Log { public static com.samskivert.util.Log log = new com.samskivert.util.Log("com.samskivert.webmacro"); + + /** Convenience function. */ + public static void debug (String message) + { + log.debug(message); + } + + /** Convenience function. */ + public static void info (String message) + { + log.info(message); + } + + /** Convenience function. */ + public static void warning (String message) + { + log.warning(message); + } }