com.codestudio.bean.velocity
Class PoolManVelocityServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--org.apache.velocity.servlet.VelocityServlet
                    |
                    +--com.codestudio.bean.velocity.PoolManVelocityServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class PoolManVelocityServlet
extends org.apache.velocity.servlet.VelocityServlet

A simple VelocityServlet extension for creating a web application using the poolman-velocity.vm XML template.

Author:
PS Neville
See Also:
Serialized Form

Field Summary
static java.lang.String ALL_DB_NAMES
           
static java.lang.String AVAIL_CONS
           
static java.lang.String CURRENT_DATABASE
           
static java.lang.String DB_DRIVER
           
static java.lang.String DB_URL
           
static java.lang.String DB_USER
           
static java.lang.String ERRORS
           
static java.lang.String HEADER_COLS
           
static java.lang.String QUERY_COUNT
           
static java.lang.String QUERY_DURATION
           
static java.lang.String RESULTS_ROWS
           
static java.lang.String SQL_QUERY
           
static java.lang.String TOTAL_CONS
           
static java.lang.String UNAVAIL_CONS
           
static java.lang.String USING_CACHE
           
 
Fields inherited from class org.apache.velocity.servlet.VelocityServlet
CONTENT_TYPE, DEFAULT_CONTENT_TYPE, DEFAULT_OUTPUT_ENCODING, INIT_PROPS_KEY, REQUEST, RESPONSE
 
Constructor Summary
PoolManVelocityServlet()
           
 
Method Summary
protected  void executeSQL(org.apache.velocity.context.Context ctx)
          Execute a generic sql statement without knowing much about it or its destination.
 org.apache.velocity.Template handleRequest(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, org.apache.velocity.context.Context ctx)
          The servlet entry point.
protected  boolean inspectRequest(org.apache.velocity.context.Context ctx, javax.servlet.http.HttpServletRequest req)
          Handle request parameters and make a decision (boolean) about whether a SQL invocation should occur.
protected  java.util.Properties loadConfiguration(javax.servlet.ServletConfig config)
          A simplistic load method used to prepare Velocity.
 
Methods inherited from class org.apache.velocity.servlet.VelocityServlet
createContext, doGet, doPost, doRequest, error, getTemplate, getTemplate, handleRequest, init, mergeTemplate, requestCleanup, setContentType
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, 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
 

Field Detail

SQL_QUERY

public static final java.lang.String SQL_QUERY

CURRENT_DATABASE

public static final java.lang.String CURRENT_DATABASE

ALL_DB_NAMES

public static final java.lang.String ALL_DB_NAMES

HEADER_COLS

public static final java.lang.String HEADER_COLS

RESULTS_ROWS

public static final java.lang.String RESULTS_ROWS

ERRORS

public static final java.lang.String ERRORS

QUERY_COUNT

public static final java.lang.String QUERY_COUNT

QUERY_DURATION

public static final java.lang.String QUERY_DURATION

USING_CACHE

public static final java.lang.String USING_CACHE

DB_URL

public static final java.lang.String DB_URL

DB_DRIVER

public static final java.lang.String DB_DRIVER

DB_USER

public static final java.lang.String DB_USER

TOTAL_CONS

public static final java.lang.String TOTAL_CONS

AVAIL_CONS

public static final java.lang.String AVAIL_CONS

UNAVAIL_CONS

public static final java.lang.String UNAVAIL_CONS
Constructor Detail

PoolManVelocityServlet

public PoolManVelocityServlet()
Method Detail

loadConfiguration

protected java.util.Properties loadConfiguration(javax.servlet.ServletConfig config)
                                          throws java.io.IOException,
                                                 java.io.FileNotFoundException
A simplistic load method used to prepare Velocity.
Overrides:
loadConfiguration in class org.apache.velocity.servlet.VelocityServlet

handleRequest

public org.apache.velocity.Template handleRequest(javax.servlet.http.HttpServletRequest req,
                                                  javax.servlet.http.HttpServletResponse res,
                                                  org.apache.velocity.context.Context ctx)
The servlet entry point. It passes control off to a method that will introspect the Context and the request for the sake of transforming the Context and template.
Overrides:
handleRequest in class org.apache.velocity.servlet.VelocityServlet

inspectRequest

protected boolean inspectRequest(org.apache.velocity.context.Context ctx,
                                 javax.servlet.http.HttpServletRequest req)
Handle request parameters and make a decision (boolean) about whether a SQL invocation should occur.

executeSQL

protected void executeSQL(org.apache.velocity.context.Context ctx)
                   throws java.sql.SQLException
Execute a generic sql statement without knowing much about it or its destination. A real-world query would be less generic, making the code simpler than this example.


Copyright © 1999-2001 The Code Studio. All Rights Reserved.