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 Summary
Constructors -
Method Summary
Modifier 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.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, serviceMethods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log
-
Constructor Details
-
RemoteHttpCacheServlet
public RemoteHttpCacheServlet()
-
-
Method Details
-
init
Initializes 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 interfaceServlet- Overrides:
initin classGenericServlet- Parameters:
config-- Throws:
ServletException
-
service
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException Read the request, call the processor, write the response.- Overrides:
servicein classHttpServlet- Parameters:
request-response-- Throws:
ServletExceptionIOException
-
readRequest
Read the request from the input stream.- Parameters:
request-- Returns:
- RemoteHttpCacheRequest
-
readRequestFromStream
protected RemoteCacheRequest<Serializable,Serializable> readRequestFromStream(InputStream inputStream) throws IOException, ClassNotFoundException Reads the response from the stream and then closes it.- Parameters:
inputStream-- Returns:
- RemoteHttpCacheRequest
- Throws:
IOExceptionClassNotFoundException
-
writeResponse
protected void writeResponse(HttpServletResponse response, RemoteCacheResponse<Object> cacheResponse) Write the response to the output stream.- Parameters:
response-cacheResponse-
-
processRequest
protected 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
-
createRemoteHttpCacheService
protected <K,V> RemoteHttpCacheService<K,V> createRemoteHttpCacheService(ICompositeCacheManager cacheManager) Configures the attributes and the event logger and constructs a service.- Parameters:
cacheManager-- Returns:
- RemoteHttpCacheService
-
configureCacheEventLogger
Tries to get the event logger.- Parameters:
props-- Returns:
- ICacheEventLogger
-
configureRemoteHttpCacheServerAttributes
Configure.jcs.remotehttpcache.serverattributes.ATTRIBUTENAME=ATTRIBUTEVALUE
- Parameters:
prop-- Returns:
- RemoteCacheServerAttributesconfigureRemoteCacheServerAttributes
-
setRemoteCacheService
- Parameters:
rcs- the remoteCacheService to set
-
destroy
Release the cache manager.- Specified by:
destroyin interfaceServlet- Overrides:
destroyin classGenericServlet
-
getServletInfo
Get servlet information- Specified by:
getServletInfoin interfaceServlet- Overrides:
getServletInfoin classGenericServlet- Returns:
- basic info
-