org.apache.tuscany.sca.host.http
Class ExtensibleServletHost

java.lang.Object
  extended by org.apache.tuscany.sca.host.http.ExtensibleServletHost
All Implemented Interfaces:
ServletHost

public class ExtensibleServletHost
extends java.lang.Object
implements ServletHost

Default implementation of an extensible Servlet host.


Constructor Summary
ExtensibleServletHost(ServletHostExtensionPoint servletHosts)
           
 
Method Summary
 void addServletMapping(java.lang.String uri, Servlet servlet)
          Add a mapping for an instance of a Servlet.
 java.lang.String getContextPath()
          Returns the portion of the request URI that indicates the context of the request
 int getDefaultPort()
          Returns the default port for the server.
 RequestDispatcher getRequestDispatcher(java.lang.String uri)
          Returns a Servlet request dispatcher for the Servlet mapped to the specified URI.
 Servlet getServletMapping(java.lang.String uri)
          Returns the Servlet mapped to the given URI.
 java.net.URL getURLMapping(java.lang.String uri)
          Returns the complete URL mapped to the specified URI.
 Servlet removeServletMapping(java.lang.String uri)
          Remove a Servlet mapping.
 void setContextPath(java.lang.String path)
          Sets the portion of the request URI that indicates the context of the request
 void setDefaultPort(int port)
          Sets the default port for the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtensibleServletHost

public ExtensibleServletHost(ServletHostExtensionPoint servletHosts)
Method Detail

setDefaultPort

public void setDefaultPort(int port)
Description copied from interface: ServletHost
Sets the default port for the server.

Specified by:
setDefaultPort in interface ServletHost
Parameters:
port - the default port

getDefaultPort

public int getDefaultPort()
Description copied from interface: ServletHost
Returns the default port for the server.

Specified by:
getDefaultPort in interface ServletHost
Returns:
the default port

addServletMapping

public void addServletMapping(java.lang.String uri,
                              Servlet servlet)
                       throws ServletMappingException
Description copied from interface: ServletHost
Add a mapping for an instance of a Servlet. This requests that the Servlet container direct all requests to the designated mapping to the supplied Servlet instance.

Specified by:
addServletMapping in interface ServletHost
Parameters:
uri - the URI-mapping for the Servlet
servlet - the Servlet that should be invoked
Throws:
ServletMappingException

getServletMapping

public Servlet getServletMapping(java.lang.String uri)
                          throws ServletMappingException
Description copied from interface: ServletHost
Returns the Servlet mapped to the given URI.

Specified by:
getServletMapping in interface ServletHost
Parameters:
uri - the URI-mapping for the Servlet
Returns:
the Servlet registered with the mapping
Throws:
ServletMappingException

removeServletMapping

public Servlet removeServletMapping(java.lang.String uri)
                             throws ServletMappingException
Description copied from interface: ServletHost
Remove a Servlet mapping. This directs the Servlet container not to direct any more requests to a previously registered Servlet.

Specified by:
removeServletMapping in interface ServletHost
Parameters:
uri - the URI-mapping for the Servlet
Returns:
the Servlet that was registered to the mapping, null if nothing was registered to the mapping
Throws:
ServletMappingException

getRequestDispatcher

public RequestDispatcher getRequestDispatcher(java.lang.String uri)
                                       throws ServletMappingException
Description copied from interface: ServletHost
Returns a Servlet request dispatcher for the Servlet mapped to the specified URI.

Specified by:
getRequestDispatcher in interface ServletHost
Parameters:
uri - the URI mapped to a Servlet
Returns:
a RequestDispatcher that can be used to dispatch requests to that Servlet
Throws:
ServletMappingException

getContextPath

public java.lang.String getContextPath()
Description copied from interface: ServletHost
Returns the portion of the request URI that indicates the context of the request

Specified by:
getContextPath in interface ServletHost
Returns:
a String specifying the portion of the request URI that indicates the context of the request

getURLMapping

public java.net.URL getURLMapping(java.lang.String uri)
Description copied from interface: ServletHost
Returns the complete URL mapped to the specified URI.

Specified by:
getURLMapping in interface ServletHost
Returns:
the URL mapped to the specified URI

setContextPath

public void setContextPath(java.lang.String path)
Description copied from interface: ServletHost
Sets the portion of the request URI that indicates the context of the request

Specified by:
setContextPath in interface ServletHost
Parameters:
path - the context path