public class ServletConfigurator
extends javax.servlet.http.HttpServlet
Allows you to configure Proxool using a servlet. There are three different ways: The init parameters can either directly configure Proxool (in a similar fashion to the PropertyConfigurator) or they can point to separate XML or property files. For example:
1. XML file delegates to JAXPConfigurator passing
in the filename. If the filename is not absolute then it is prepended
with the application directory.
<servlet>
<servlet-name>ServletConfigurator</servlet-name>
<servlet-class>org.logicalcobwebs.proxool.configuration.ServletConfigurator</servlet-class>
<init-param>
<param-name>xmlFile</param-name>
<param-value>WEB-INF/proxool.xml</param-value>
</init-param>
</servlet>
2. Property file delegates to PropertyConfigurator
passing in the filename. If the filename is not absolute then it is prepended
with the application directory.
<servlet>
<servlet-name>ServletConfigurator</servlet-name>
<servlet-class>org.logicalcobwebs.proxool.configuration.ServletConfigurator</servlet-class>
<init-param>
<param-name>propertyFile</param-name>
<param-value>WEB-INF/proxool.properties</param-value>
</init-param>
</servlet>
3. Init parameters delegates to PropertyConfigurator
by passing in a new Properties object based on the servlet's init
parameters.
<servlet>
<servlet-name>ServletConfigurator</servlet-name>
<servlet-class>org.logicalcobwebs.proxool.configuration.ServletConfigurator</servlet-class>
<init-param>
<param-name>jdbc-0.proxool.alias</param-name>
<param-value>test</param-value>
</init-param>
<init-param>
<param-name>jdbc-0.proxool.driver-url</param-name>
<param-value>jdbc:hsqldb:.</param-value>
</init-param>
<init-param>
<param-name>jdbc-0.proxool.driver-class</param-name>
<param-value>org.hsqldb.jdbcDriver</param-value>
</init-param>
</servlet>
It will also automatically shutdown Proxool. See
destroy().
| 构造器和说明 |
|---|
ServletConfigurator() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
destroy()
Shuts down Proxool by removing all connection pools.
|
void |
init(javax.servlet.ServletConfig servletConfig) |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, servicepublic void init(javax.servlet.ServletConfig servletConfig)
throws javax.servlet.ServletException
init 在接口中 javax.servlet.Servletinit 在类中 javax.servlet.GenericServletjavax.servlet.ServletExceptionpublic void destroy()
<init-param> <param-name>autoShutdown</param-name> <param-value>false</param-value> </init-param>
destroy 在接口中 javax.servlet.Servletdestroy 在类中 javax.servlet.GenericServletCopyright © 2024. All rights reserved.