net.trajano.twiff.internal.webxml
Class WebXmlAdapter

java.lang.Object
  extended by net.trajano.twiff.internal.webxml.WebXmlAdapter

public final class WebXmlAdapter
extends Object

This processes the web.xml file. It is used to get the servlet mappings.

Author:
Archimedes Trajano

Constructor Summary
WebXmlAdapter(InputStream webXml)
          Constructs the adapter using the specified web.xml location.
WebXmlAdapter(ServletConfig servletConfig)
          Constructs the adapter from the web.xml file in the servlet context used by the servlet config.
 
Method Summary
 void addServlet(String servletName, String servletClass)
           
 void addServletMapping(String servletName, String mapping)
           
 String getMappingForServlet(Class servletClass)
          This gets the first mapping used by a servlet by class.
 List<String> getMappingsForServlet(Class servletClass)
          This gets the mappings used by a servlet by class.
 List<String> getMappingsForServletName(String servletName)
           
 List<String> getServletNamesForClass(Class servletClass)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebXmlAdapter

public WebXmlAdapter(ServletConfig servletConfig)
              throws IOException,
                     SAXException
Constructs the adapter from the web.xml file in the servlet context used by the servlet config.

Parameters:
servletConfig -
Throws:
IOException
SAXException

WebXmlAdapter

public WebXmlAdapter(InputStream webXml)
              throws IOException,
                     SAXException
Constructs the adapter using the specified web.xml location.

Parameters:
webXml - web.xml input stream
Throws:
SAXException
IOException
Method Detail

addServlet

public void addServlet(String servletName,
                       String servletClass)
Parameters:
servletName -
servletClass -

addServletMapping

public void addServletMapping(String servletName,
                              String mapping)
Parameters:
servletName -
mapping -

getMappingsForServlet

public List<String> getMappingsForServlet(Class servletClass)
This gets the mappings used by a servlet by class. It will get all the mappings for any specified servlet that uses the class.

Parameters:
servletClass - name of a servlet class
Returns:
array of mappings for a servlet.

getMappingForServlet

public String getMappingForServlet(Class servletClass)
This gets the first mapping used by a servlet by class.

Parameters:
servletClass - name of a servlet class
Returns:
mapping for a servlet.

getMappingsForServletName

public List<String> getMappingsForServletName(String servletName)
Parameters:
servletName -
Returns:
array of mappings for a servlet.

getServletNamesForClass

public List<String> getServletNamesForClass(Class servletClass)
Parameters:
servletClass -
Returns:
array of servlet names.


Copyright © 2004-2005 trajano.net. All Rights Reserved.