Class RemoteHttpCacheServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.commons.jcs3.auxiliary.remote.http.server.RemoteHttpCacheServlet
- All Implemented Interfaces:
- Serializable,- Servlet,- ServletConfig
This servlet simply reads and writes objects. The requests are packaged in a general wrapper. The
 processor works on the wrapper object and returns a response wrapper.
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected ICacheEventLoggerTries to get the event logger.protected RemoteHttpCacheServerAttributesConfigure.protected <K,V> RemoteHttpCacheService<K, V> createRemoteHttpCacheService(ICompositeCacheManager cacheManager) Configures the attributes and the event logger and constructs a service.voiddestroy()Release the cache manager.Get servlet informationvoidinit(ServletConfig config) Initializes the cache.protected RemoteCacheResponse<Object>Processes the request.protected RemoteCacheRequest<Serializable,Serializable> readRequest(HttpServletRequest request) Read the request from the input stream.protected RemoteCacheRequest<Serializable,Serializable> readRequestFromStream(InputStream inputStream) Reads the response from the stream and then closes it.voidservice(HttpServletRequest request, HttpServletResponse response) Read the request, call the processor, write the response.protected voidprotected voidwriteResponse(HttpServletResponse response, RemoteCacheResponse<Object> cacheResponse) Write the response to the output stream.Methods inherited from class javax.servlet.http.HttpServletdoDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, serviceMethods inherited from class javax.servlet.GenericServletgetInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log
- 
Constructor Details- 
RemoteHttpCacheServletpublic RemoteHttpCacheServlet()
 
- 
- 
Method Details- 
initInitializes the cache.This provides an easy extension point. Simply extend this servlet and override the init method to change the way the properties are loaded. - Specified by:
- initin interface- Servlet
- Overrides:
- initin class- GenericServlet
- Parameters:
- config-
- Throws:
- ServletException
 
- 
servicepublic void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException Read the request, call the processor, write the response.- Overrides:
- servicein class- HttpServlet
- Parameters:
- request-
- response-
- Throws:
- ServletException
- IOException
 
- 
readRequestRead the request from the input stream.- Parameters:
- request-
- Returns:
- RemoteHttpCacheRequest
 
- 
readRequestFromStreamprotected RemoteCacheRequest<Serializable,Serializable> readRequestFromStream(InputStream inputStream) throws IOException, ClassNotFoundException Reads the response from the stream and then closes it.- Parameters:
- inputStream-
- Returns:
- RemoteHttpCacheRequest
- Throws:
- IOException
- ClassNotFoundException
 
- 
writeResponseprotected void writeResponse(HttpServletResponse response, RemoteCacheResponse<Object> cacheResponse) Write the response to the output stream.- Parameters:
- response-
- cacheResponse-
 
- 
processRequestprotected RemoteCacheResponse<Object> processRequest(RemoteCacheRequest<Serializable, Serializable> request) Processes the request. It will call the appropriate method on the service- Parameters:
- request-
- Returns:
- RemoteHttpCacheResponse, never null
 
- 
createRemoteHttpCacheServiceprotected <K,V> RemoteHttpCacheService<K,V> createRemoteHttpCacheService(ICompositeCacheManager cacheManager) Configures the attributes and the event logger and constructs a service.- Parameters:
- cacheManager-
- Returns:
- RemoteHttpCacheService
 
- 
configureCacheEventLoggerTries to get the event logger.- Parameters:
- props-
- Returns:
- ICacheEventLogger
 
- 
configureRemoteHttpCacheServerAttributesConfigure.jcs.remotehttpcache.serverattributes.ATTRIBUTENAME=ATTRIBUTEVALUE - Parameters:
- prop-
- Returns:
- RemoteCacheServerAttributesconfigureRemoteCacheServerAttributes
 
- 
setRemoteCacheService- Parameters:
- rcs- the remoteCacheService to set
 
- 
destroyRelease the cache manager.- Specified by:
- destroyin interface- Servlet
- Overrides:
- destroyin class- GenericServlet
 
- 
getServletInfoGet servlet information- Specified by:
- getServletInfoin interface- Servlet
- Overrides:
- getServletInfoin class- GenericServlet
- Returns:
- basic info
 
 
-