Methods Summary |
---|
protected abstract void | assertOpen()
|
protected org.apache.http.impl.entity.EntityDeserializer | createEntityDeserializer()
return new EntityDeserializer(new LaxContentLengthStrategy());
|
protected org.apache.http.impl.entity.EntitySerializer | createEntitySerializer()
return new EntitySerializer(new StrictContentLengthStrategy());
|
protected org.apache.http.HttpResponseFactory | createHttpResponseFactory()
return new DefaultHttpResponseFactory();
|
protected org.apache.http.io.HttpMessageWriter | createRequestWriter(org.apache.http.io.SessionOutputBuffer buffer, org.apache.http.params.HttpParams params)
// override in derived class to specify a line formatter
return new HttpRequestWriter(buffer, null, params);
|
protected org.apache.http.io.HttpMessageParser | createResponseParser(org.apache.http.io.SessionInputBuffer buffer, org.apache.http.HttpResponseFactory responseFactory, org.apache.http.params.HttpParams params)
// override in derived class to specify a line parser
return new HttpResponseParser(buffer, null, responseFactory, params);
|
protected void | doFlush()
this.outbuffer.flush();
|
public void | flush()
assertOpen();
doFlush();
|
public org.apache.http.HttpConnectionMetrics | getMetrics()
return this.metrics;
|
protected void | init(org.apache.http.io.SessionInputBuffer inbuffer, org.apache.http.io.SessionOutputBuffer outbuffer, org.apache.http.params.HttpParams params)
if (inbuffer == null) {
throw new IllegalArgumentException("Input session buffer may not be null");
}
if (outbuffer == null) {
throw new IllegalArgumentException("Output session buffer may not be null");
}
this.inbuffer = inbuffer;
this.outbuffer = outbuffer;
this.responseParser = createResponseParser(
inbuffer,
createHttpResponseFactory(),
params);
this.requestWriter = createRequestWriter(
outbuffer, params);
this.metrics = new HttpConnectionMetricsImpl(
inbuffer.getMetrics(),
outbuffer.getMetrics());
|
public boolean | isResponseAvailable(int timeout)
assertOpen();
return this.inbuffer.isDataAvailable(timeout);
|
public boolean | isStale()
if (!isOpen()) {
return true;
}
try {
this.inbuffer.isDataAvailable(1);
return false;
} catch (IOException ex) {
return true;
}
|
public void | receiveResponseEntity(org.apache.http.HttpResponse response)
if (response == null) {
throw new IllegalArgumentException("HTTP response may not be null");
}
assertOpen();
HttpEntity entity = this.entitydeserializer.deserialize(this.inbuffer, response);
response.setEntity(entity);
|
public org.apache.http.HttpResponse | receiveResponseHeader()
assertOpen();
HttpResponse response = (HttpResponse) this.responseParser.parse();
if (response.getStatusLine().getStatusCode() >= 200) {
this.metrics.incrementResponseCount();
}
return response;
|
public void | sendRequestEntity(org.apache.http.HttpEntityEnclosingRequest request)
if (request == null) {
throw new IllegalArgumentException("HTTP request may not be null");
}
assertOpen();
if (request.getEntity() == null) {
return;
}
this.entityserializer.serialize(
this.outbuffer,
request,
request.getEntity());
|
public void | sendRequestHeader(org.apache.http.HttpRequest request)
if (request == null) {
throw new IllegalArgumentException("HTTP request may not be null");
}
assertOpen();
this.requestWriter.write(request);
this.metrics.incrementRequestCount();
|