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.HttpRequestFactory | createHttpRequestFactory()
return new DefaultHttpRequestFactory();
|
protected org.apache.http.io.HttpMessageParser | createRequestParser(org.apache.http.io.SessionInputBuffer buffer, org.apache.http.HttpRequestFactory requestFactory, org.apache.http.params.HttpParams params)
// override in derived class to specify a line parser
return new HttpRequestParser(buffer, null, requestFactory, params);
|
protected org.apache.http.io.HttpMessageWriter | createResponseWriter(org.apache.http.io.SessionOutputBuffer buffer, org.apache.http.params.HttpParams params)
// override in derived class to specify a line formatter
return new HttpResponseWriter(buffer, null, 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.requestParser = createRequestParser(
inbuffer,
createHttpRequestFactory(),
params);
this.responseWriter = createResponseWriter(
outbuffer, params);
this.metrics = new HttpConnectionMetricsImpl(
inbuffer.getMetrics(),
outbuffer.getMetrics());
|
public boolean | isStale()
assertOpen();
try {
this.inbuffer.isDataAvailable(1);
return false;
} catch (IOException ex) {
return true;
}
|
public void | receiveRequestEntity(org.apache.http.HttpEntityEnclosingRequest request)
if (request == null) {
throw new IllegalArgumentException("HTTP request may not be null");
}
assertOpen();
HttpEntity entity = this.entitydeserializer.deserialize(this.inbuffer, request);
request.setEntity(entity);
|
public org.apache.http.HttpRequest | receiveRequestHeader()
assertOpen();
HttpRequest request = (HttpRequest) this.requestParser.parse();
this.metrics.incrementRequestCount();
return request;
|
public void | sendResponseEntity(org.apache.http.HttpResponse response)
if (response.getEntity() == null) {
return;
}
this.entityserializer.serialize(
this.outbuffer,
response,
response.getEntity());
|
public void | sendResponseHeader(org.apache.http.HttpResponse response)
if (response == null) {
throw new IllegalArgumentException("HTTP response may not be null");
}
assertOpen();
this.responseWriter.write(response);
if (response.getStatusLine().getStatusCode() >= 200) {
this.metrics.incrementResponseCount();
}
|