// use the response from the cache
result = (byte[])object;
}
// stream the content
XMLDeserializer deserializer = null;
try {
deserializer = (XMLDeserializer)this.manager.lookup( XMLDeserializer.ROLE );
deserializer.setConsumer(handler);
deserializer.deserialize(result);
} catch (ComponentException ce) {
throw new SAXException("Unable to lookup xml deserializer.", ce);
} finally {
this.manager.release( deserializer );
}
return;
} else {
// we are not processing parallel
// first: test for a cached response
IncludeCacheStorageProxy storage = session.getCacheStorageProxy();
CachedResponse response = (CachedResponse)storage.get(uri);
if ( null != response) {
SourceValidity[] validities = response.getValidityObjects();
// if purging is turned off and either the cached response is valid or
// we are loading preemptive, then use the cached response
if ( !session.isPurging()
&& (session.isPreemptive() || validities[0].isValid() == SourceValidity.VALID)) {
// stream the content
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("Streaming from cached response.");
}
XMLDeserializer deserializer = null;
try {
deserializer = (XMLDeserializer)this.manager.lookup( XMLDeserializer.ROLE );
deserializer.setConsumer(handler);
deserializer.deserialize(response.getResponse());
} catch (ComponentException ce) {
throw new SAXException("Unable to lookup xml deserializer.", ce);
} finally {
this.manager.release( deserializer );
}