org.webmacro.servlet
Class Servlet20Broker

java.lang.Object
  extended byorg.webmacro.Broker
      extended byorg.webmacro.servlet.ServletBroker
          extended byorg.webmacro.servlet.Servlet20Broker

public class Servlet20Broker
extends ServletBroker

An implementation of Broker tailored for Servlet 2.0/2.1 environments. Loads templates and other resources from the class path, writes log messages to the servlet log.

Since:
0.96
Author:
Brian Goetz

Field Summary
protected  java.lang.ClassLoader _servletClassLoader
           
 
Fields inherited from class org.webmacro.servlet.ServletBroker
_servletContext
 
Fields inherited from class org.webmacro.Broker
_config, _log, _ls, _myClassLoader, _name, _prof, _propertyOperators, _providers, _systemClassLoader, BROKERS, SETTINGS_PREFIX, WEBMACRO_DEFAULTS, WEBMACRO_PROPERTIES
 
Constructor Summary
protected Servlet20Broker(javax.servlet.ServletContext sc, java.lang.ClassLoader cl)
           
 
Method Summary
 java.lang.Class classForName(java.lang.String name)
          Loads a class by name.
static Broker getBroker(javax.servlet.Servlet s)
           
 java.net.URL getResource(java.lang.String name)
          Get a resource (file) from the the Broker's class loader
 java.io.InputStream getResourceAsStream(java.lang.String name)
          Get a resource (file) from the Broker's class loader
 
Methods inherited from class org.webmacro.servlet.ServletBroker
getServletContext, initLog
 
Methods inherited from class org.webmacro.Broker
addProvider, findBroker, get, getBooleanSetting, getBroker, getBroker, getBrokerLocal, getClassLoader, getEvaluationExceptionHandler, getFastWriter, getFunction, getIntegerSetting, getIntegerSetting, getLog, getLog, getName, getProvider, getSetting, getSettings, getTemplate, getValue, init, initLog, loadDefaultSettings, loadSettings, loadSystemSettings, main, newProfile, putFunction, register, setBrokerLocal, setEvaluationExceptionHandler, shutdown, startClient, stopClient, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_servletClassLoader

protected java.lang.ClassLoader _servletClassLoader
Constructor Detail

Servlet20Broker

protected Servlet20Broker(javax.servlet.ServletContext sc,
                          java.lang.ClassLoader cl)
                   throws InitException
Method Detail

getBroker

public static Broker getBroker(javax.servlet.Servlet s)
                        throws InitException
Throws:
InitException

getResource

public java.net.URL getResource(java.lang.String name)
Get a resource (file) from the the Broker's class loader

Overrides:
getResource in class Broker

getResourceAsStream

public java.io.InputStream getResourceAsStream(java.lang.String name)
Get a resource (file) from the Broker's class loader

Overrides:
getResourceAsStream in class Broker

classForName

public java.lang.Class classForName(java.lang.String name)
                             throws java.lang.ClassNotFoundException
Loads a class by name. Uses the servlet classloader to load the class. If the class is not found uses the Broker classForName implementation.

Overrides:
classForName in class Broker
Throws:
java.lang.ClassNotFoundException