// Find the resource and content
Resource resource=null;
HttpContent content=null;
Connector connector = HttpConnection.getCurrentConnection().getConnector();
ResourceCache cache=(connector instanceof NIOConnector) ?_nioCache:_bioCache;
try
{
// Try gzipped content first
if (gzip)
{
pathInContextGz=pathInContext+".gz";
resource=getResource(pathInContextGz);
if (resource==null || !resource.exists()|| resource.isDirectory())
{
gzip=false;
pathInContextGz=null;
}
else if (cache!=null)
{
content=cache.lookup(pathInContextGz,resource);
if (content!=null)
resource=content.getResource();
}
if (resource==null || !resource.exists()|| resource.isDirectory())
{
gzip=false;
pathInContextGz=null;
}
}
// find resource
if (!gzip)
{
if (cache==null)
resource=getResource(pathInContext);
else
{
content=cache.lookup(pathInContext,this);
if (content!=null)
resource=content.getResource();
else
resource=getResource(pathInContext);