org.apache.jcs.admin.servlet
Class JCSAdminServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.velocity.servlet.VelocityServlet
org.apache.jcs.admin.servlet.JCSAdminServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- public class JCSAdminServlet
- extends org.apache.velocity.servlet.VelocityServlet
A servlet which provides HTTP access to JCS. Allows a summary of regions
to be viewed, and removeAll to be run on individual regions or all regions.
Also provides the ability to remove items (any number of key arguments can
be provided with action 'remove'). Should be initialized with a properties
file that provides at least a classpath resource loader. Since this extends
VelocityServlet, which uses the singleton model for velocity, it will share
configuration with any other Velocity in the same JVM.
Initialization in a webapp will look something like this:
[servlet]
[servlet-name]JCSAdminServlet[/servlet-name]
[servlet-class]org.apache.jcs.admin.servlet.JCSAdminServlet[/servlet-class]
[init-param]
[param-name]properties[/param-name]
[param-value]WEB-INF/conf/JCSAdminServlet.velocity.properties[/param-value]
[/init-param]
[/servlet]
FIXME: It would be nice to use the VelocityEngine model so this can be truly
standalone. Right now if you run it in the same container as, say,
turbine, turbine must be run first to ensure it's config takes
precedence.
- Version:
- $Id: JCSAdminServlet.java,v 1.8 2003/08/22 11:57:18 mpoeschl Exp $
- Author:
- James Taylor
- See Also:
- Serialized Form
Fields inherited from class org.apache.velocity.servlet.VelocityServlet |
CONTENT_TYPE, DEFAULT_CONTENT_TYPE, DEFAULT_OUTPUT_ENCODING, INIT_PROPS_KEY, REQUEST, RESPONSE |
Fields inherited from class javax.servlet.http.HttpServlet |
|
Fields inherited from class javax.servlet.GenericServlet |
|
Method Summary |
private java.util.LinkedList |
buildCacheInfo()
|
private java.util.LinkedList |
buildElementInfo(java.lang.String cacheName)
|
private void |
clearAllRegions()
|
private void |
clearRegion(java.lang.String cacheName)
|
int |
getByteCount(CompositeCache cache)
|
protected org.apache.velocity.Template |
handleRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.apache.velocity.context.Context context)
|
private void |
removeItem(java.lang.String cacheName,
java.lang.String key)
|
Methods inherited from class org.apache.velocity.servlet.VelocityServlet |
createContext, doGet, doPost, doRequest, error, getTemplate, getTemplate, handleRequest, init, initVelocity, loadConfiguration, mergeTemplate, requestCleanup, setContentType |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, 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 |
DEFAULT_TEMPLATE_NAME
private static final java.lang.String DEFAULT_TEMPLATE_NAME
- See Also:
- Constant Field Values
REGION_DETAIL_TEMPLATE_NAME
private static final java.lang.String REGION_DETAIL_TEMPLATE_NAME
- See Also:
- Constant Field Values
CACHE_NAME_PARAM
private static final java.lang.String CACHE_NAME_PARAM
- See Also:
- Constant Field Values
ACTION_PARAM
private static final java.lang.String ACTION_PARAM
- See Also:
- Constant Field Values
KEY_PARAM
private static final java.lang.String KEY_PARAM
- See Also:
- Constant Field Values
SILENT_PARAM
private static final java.lang.String SILENT_PARAM
- See Also:
- Constant Field Values
CLEAR_ALL_REGIONS_ACTION
private static final java.lang.String CLEAR_ALL_REGIONS_ACTION
- See Also:
- Constant Field Values
CLEAR_REGION_ACTION
private static final java.lang.String CLEAR_REGION_ACTION
- See Also:
- Constant Field Values
REMOVE_ACTION
private static final java.lang.String REMOVE_ACTION
- See Also:
- Constant Field Values
DETAIL_ACTION
private static final java.lang.String DETAIL_ACTION
- See Also:
- Constant Field Values
cacheHub
private CompositeCacheManager cacheHub
JCSAdminServlet
public JCSAdminServlet()
handleRequest
protected org.apache.velocity.Template handleRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.apache.velocity.context.Context context)
throws java.lang.Exception
- Throws:
java.lang.Exception
- See Also:
VelocityServlet.handleRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.velocity.context.Context)
buildElementInfo
private java.util.LinkedList buildElementInfo(java.lang.String cacheName)
throws java.lang.Exception
- Throws:
java.lang.Exception
buildCacheInfo
private java.util.LinkedList buildCacheInfo()
throws java.lang.Exception
- Throws:
java.lang.Exception
getByteCount
public int getByteCount(CompositeCache cache)
throws java.lang.Exception
- Throws:
java.lang.Exception
clearAllRegions
private void clearAllRegions()
throws java.io.IOException
- Throws:
java.io.IOException
clearRegion
private void clearRegion(java.lang.String cacheName)
throws java.io.IOException
- Throws:
java.io.IOException
removeItem
private void removeItem(java.lang.String cacheName,
java.lang.String key)
throws java.io.IOException
- Throws:
java.io.IOException