task.setOutputBB(protocolInfo.outputBB);
task.doTask();
protocolInfo.inputBB = task.getBuffer();
protocolInfo.bytesRead = task.getBuffer().position();
protocolInfo.byteBuffer = task.getBuffer();
Endpoint remoteHost = task.getEndpoint();
/**
* Possible conditions
* 1. Endpoint is null and the layer execution
* completed (without any layer returning false).
* In this case pass it on to the local container.
* 2. Endpoint is null and one of the layers failed
* and set a response code != 200, then we send back
* an error response through the handler.
* 3. Endpoint is not null and is a local one then pass
* it on to container.
* 4. Endpoint is not null and is a remote one, then proxy
* it.
* Assumption: If a layer fails (returns false), then it
* will set a proper http status code in response
*/
if (remoteHost == null) {
if (task.getResponse().getStatus() == 200) {
if(_logger.isLoggable(Level.FINE)){
_logger.log(Level.FINE, "clb.proxy.request_endpoint_null_200");
}
task.recycle();
objManager.offerTask(task, protocolInfo.isSecure);
return false;
} else {
if(_logger.isLoggable(Level.FINE)){
_logger.log(Level.FINE, "clb.proxy.request_endpoint_null");
}
}
} else if (remoteHost.isLocal()) {
if(_logger.isLoggable(Level.FINE)){
_logger.log(Level.FINE, "clb.proxy.request_local");
}
task.recycle();
objManager.offerTask(task, protocolInfo.isSecure);