this.socket = socket;
this.content = content;
}
public void run() {
DefaultBHttpServerConnection conn = new DefaultBHttpServerConnection(8 * 1024);
try {
conn.bind(socket);
try {
boolean keepAlive = true;
while( keepAlive && !socket.isClosed() ) {
// fully read the request, whatever it is
HttpRequest request = conn.receiveRequestHeader();
logger.log(FINE, "Received request: {0}", request);
keepAlive = isKeepAlive(request);
if (request instanceof HttpEntityEnclosingRequest) {
conn.receiveRequestEntity((HttpEntityEnclosingRequest) request);
HttpEntity entity = ((HttpEntityEnclosingRequest) request)
.getEntity();
if (entity != null) {
// consume all content to allow reuse
EntityUtils.consume(entity);