org.apache.velocity.tools.view
Class JeeConfig

java.lang.Object
  extended by org.apache.velocity.tools.view.JeeConfig

public class JeeConfig
extends java.lang.Object

Because sometimes you don't care about the difference between a servlet and a filter. Why isn't there a common interface for FilterConfig and ServletConfig already? Sheesh.

Anyway, this also adds the ability to fake everything if you don't have either a FilterConfig or a ServletConfig handy. Just subclass it and override the methods that return things you care about. Oh, and if you don't have any init-params at all, just use the constructor that just takes a ServletContext as that's the only really essential thing for creating a VelocityView.

Version:
$Id: ServletUtils.java 471244 2006-11-04 18:34:38Z henning $

Field Summary
protected  javax.servlet.ServletContext context
           
protected  javax.servlet.FilterConfig filter
           
protected  javax.servlet.ServletConfig servlet
           
 
Constructor Summary
protected JeeConfig()
          If your subclass uses this, you better make sure that getServletContext() doesn't return null!
  JeeConfig(javax.servlet.FilterConfig filter)
           
  JeeConfig(javax.servlet.ServletConfig servlet)
           
  JeeConfig(javax.servlet.ServletContext context)
           
 
Method Summary
 java.lang.String findInitParameter(java.lang.String key)
          Looks for the specified init-param in the servlet/filter config (i.e.
 java.lang.String getInitParameter(java.lang.String name)
           
 java.util.Enumeration getInitParameterNames()
           
 java.lang.String getName()
           
 javax.servlet.ServletContext getServletContext()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filter

protected javax.servlet.FilterConfig filter

servlet

protected javax.servlet.ServletConfig servlet

context

protected javax.servlet.ServletContext context
Constructor Detail

JeeConfig

protected JeeConfig()
If your subclass uses this, you better make sure that getServletContext() doesn't return null!


JeeConfig

public JeeConfig(javax.servlet.FilterConfig filter)

JeeConfig

public JeeConfig(javax.servlet.ServletConfig servlet)

JeeConfig

public JeeConfig(javax.servlet.ServletContext context)
Method Detail

getInitParameter

public java.lang.String getInitParameter(java.lang.String name)

findInitParameter

public java.lang.String findInitParameter(java.lang.String key)
Looks for the specified init-param in the servlet/filter config (i.e. calls getInitParameter(java.lang.String)). If no such init-param is found there, it checks the ServletContext's init-params for the specified parameter.


getInitParameterNames

public java.util.Enumeration getInitParameterNames()

getName

public java.lang.String getName()

getServletContext

public javax.servlet.ServletContext getServletContext()


Copyright (c) 2003-2007 Apache Software Foundation