in src/experimental/org/apache/commons/jcs/auxiliary/lateral/http/server/LateralCacheServletReciever.java [58:160]
public void service( HttpServletRequest request, HttpServletResponse response )
throws ServletException, IOException
{
if ( log.isDebugEnabled() )
{
log.debug( "The LateralCacheServlet has been called.\n" );
}
ICacheElement<K, V> item = null;
try
{
// Create the ObjectInputStream with
// the Request InputStream.
ObjectInputStream ois = new ObjectInputStreamClassLoaderAware( request.getInputStream(), null );
if ( log.isDebugEnabled() )
{
log.debug( "after getting input stream and before reading it" );
}
// READ POLLOBJ
item = (ICacheElement) ois.readObject();
ois.close();
}
catch ( Exception e )
{
log.error( e );
}
if ( item == null )
{
if ( log.isDebugEnabled() )
{
log.debug( "item is null in LateralCacheServlet" );
}
}
else
{
String hashtableName = item.getCacheName();
K key = item.getKey();
Serializable val = item.getVal();
log.debug( "item read in = " + item );
log.debug( "item.getKey = " + item.getKey() );
CompositeCache cache = (CompositeCache) cacheMgr.getCache( hashtableName );
try
{
// need to set as from lateral
cache.localUpdate( item );
}
catch ( Exception e )
{
log.error( "Problem putting item in cache " + item, e );
}
}
try
{
// BEGIN RESPONSE
response.setContentType( "application/octet-stream" );
ObjectOutputStream oos = new ObjectOutputStream( response.getOutputStream() );
if ( log.isDebugEnabled() )
{
log.debug( "Opened output stream.\n" );
}
String result = "Completed transfer";
// echo a message to the client
oos.writeObject( result );
if ( log.isDebugEnabled() )
{
log.debug( "Wrote object to output stream" );
}
oos.flush();
if ( log.isDebugEnabled() )
{
log.debug( "Flushed output stream.\n" );
}
oos.close();
if ( log.isDebugEnabled() )
{
log.debug( "Closed output stream.\n" );
}
}
catch ( Exception e )
{
log.error( "Problem writing response.", e );
}
}