Class ConnectionServlet

  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.apache.commons.scaffold.http.ResourceServlet
              extended by org.apache.commons.scaffold.http.ConnectionServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:

public class ConnectionServlet
extends ResourceServlet

Initialize a ConnectionAdaptor for this application.

The servlet itself is not involved in managing the connection. The ConnectionAdaptor is a standalone object. This servlet simply provides a means to initialize and load a ConnectionAdaptor for use by your application.

This servlet can be configured to use an alternate adaptor or adaptor key using initialization parameters:

adaptor The default adaptor is org.apache.scaffold.sql.ConnectionAdaptor. Any sublcass of ConnectionAdaptor can be specified instead.

adaptor.key The default adaptor key is DATA_SOURCE. Another key can be specified instead. This is the attribute to use when looking up the datasource in JNDI, the servlet context, or whatever.

To use the Struts generic connection pool, specify the adaptor as org.apache.scaffold.sql.ServletAdaptor and the adaptor.key as org.apache.struts.action.DATA_SOURCE

To use the Resin connection pool, specify the res-ref-name in the Resin conf as the adaptor.key.

To use Poolman without JNDI, use the Poolman adaptor in the sql package, and specify the dbName from the poolman.xml as the adaptor.key

Ted Husted, Steve Raeburn
See Also:
org.apache.scaffold.sql.ConnectionAdaptor, org.apache.scaffold.sql.Servletdaptor, org.apache.scaffold.sql.PoolmanAdaptor, Serialized Form

Constructor Summary
Method Summary
protected  void initDefault()
          Initialize the ConnectionAdaptor for this application.
Methods inherited from class org.apache.commons.scaffold.http.ResourceServlet
destroy, destroyCustom, destroyDefault, getInitInt, getInitParameters, getInitString, getProperties, init, initCustom, loadProperties, reload, setProperties
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public ConnectionServlet()
Method Detail


protected void initDefault()
                    throws IOException,
Initialize the ConnectionAdaptor for this application.

An alternate ConnectionAdaptor can be specified in the servlet config by specifying the class type as the adaptor initialization parameter.

initDefault in class ResourceServlet
IOException - if an input/output error is encountered
javax.servlet.ServletException - if we cannot initialize these resources

Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.