org.apache.http.impl
Class DefaultHttpServerConnection

java.lang.Object
  extended by org.apache.http.impl.AbstractHttpConnection
      extended by org.apache.http.impl.DefaultHttpServerConnection
All Implemented Interfaces:
HttpConnection, HttpServerConnection

public class DefaultHttpServerConnection
extends AbstractHttpConnection
implements HttpServerConnection

Default implementation of a server-side HTTP connection.

Since:
4.0
Version:
$Revision: 411100 $
Author:
Oleg Kalnichevski

Field Summary
 
Fields inherited from class org.apache.http.impl.AbstractHttpConnection
datareceiver, datatransmitter, open, socket
 
Constructor Summary
DefaultHttpServerConnection()
           
 
Method Summary
 void bind(java.net.Socket socket, HttpParams params)
          Binds this connection to an underlying socket.
 void flush()
          Sends all pending buffered data over this connection.
 void receiveRequestEntity(HttpEntityEnclosingRequest request)
          Receives the next request entity available from this connection and attaches it to an existing request.
 HttpRequest receiveRequestHeader(HttpParams params)
          Receives the request line and all headers available from this connection.
protected  void receiveRequestHeaders(HttpRequest request)
           
protected  HttpRequest receiveRequestLine(HttpParams params)
           
 void sendResponseEntity(HttpResponse response)
          Sends the response entity of a response over this connection.
 void sendResponseHeader(HttpResponse response)
          Sends the response line and headers of a response over this connection.
protected  void sendResponseHeaders(HttpResponse response)
           
protected  void sendResponseStatusLine(HttpResponse response)
           
 void setEntityDeserializer(EntityDeserializer entitydeserializer)
           
 void setEntitySerializer(EntitySerializer entityserializer)
           
 void setRequestFactory(HttpRequestFactory requestfactory)
           
 
Methods inherited from class org.apache.http.impl.AbstractHttpConnection
assertNotOpen, assertOpen, close, isOpen, isStale, setReceiverFactory, setTransmitterFactory, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.http.HttpConnection
close, isOpen, isStale, shutdown
 

Constructor Detail

DefaultHttpServerConnection

public DefaultHttpServerConnection()
Method Detail

setRequestFactory

public void setRequestFactory(HttpRequestFactory requestfactory)

setEntityDeserializer

public void setEntityDeserializer(EntityDeserializer entitydeserializer)

setEntitySerializer

public void setEntitySerializer(EntitySerializer entityserializer)

bind

public void bind(java.net.Socket socket,
                 HttpParams params)
          throws java.io.IOException
Description copied from interface: HttpServerConnection
Binds this connection to an underlying socket.

Specified by:
bind in interface HttpServerConnection
Overrides:
bind in class AbstractHttpConnection
Parameters:
socket - The underlying socket.
params - the parameters in effect for this connection
Throws:
java.io.IOException

receiveRequestHeader

public HttpRequest receiveRequestHeader(HttpParams params)
                                 throws HttpException,
                                        java.io.IOException
Description copied from interface: HttpServerConnection
Receives the request line and all headers available from this connection. The caller should examine the returned request and decide if to receive a request entity as well.

Specified by:
receiveRequestHeader in interface HttpServerConnection
Parameters:
params - the parameters in effect for this connection
Returns:
a new HttpRequest object whose request line and headers are initialized.
Throws:
HttpException
java.io.IOException

receiveRequestEntity

public void receiveRequestEntity(HttpEntityEnclosingRequest request)
                          throws HttpException,
                                 java.io.IOException
Description copied from interface: HttpServerConnection
Receives the next request entity available from this connection and attaches it to an existing request.

Specified by:
receiveRequestEntity in interface HttpServerConnection
Parameters:
request - the request to attach the entity to.
Throws:
HttpException
java.io.IOException

receiveRequestLine

protected HttpRequest receiveRequestLine(HttpParams params)
                                  throws HttpException,
                                         java.io.IOException
Throws:
HttpException
java.io.IOException

receiveRequestHeaders

protected void receiveRequestHeaders(HttpRequest request)
                              throws HttpException,
                                     java.io.IOException
Throws:
HttpException
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Description copied from interface: HttpServerConnection
Sends all pending buffered data over this connection.

Specified by:
flush in interface HttpServerConnection
Throws:
java.io.IOException

sendResponseHeader

public void sendResponseHeader(HttpResponse response)
                        throws HttpException,
                               java.io.IOException
Description copied from interface: HttpServerConnection
Sends the response line and headers of a response over this connection.

Specified by:
sendResponseHeader in interface HttpServerConnection
Parameters:
response - the response whose headers to send.
Throws:
HttpException
java.io.IOException

sendResponseEntity

public void sendResponseEntity(HttpResponse response)
                        throws HttpException,
                               java.io.IOException
Description copied from interface: HttpServerConnection
Sends the response entity of a response over this connection.

Specified by:
sendResponseEntity in interface HttpServerConnection
Parameters:
response - the response whose entity to send.
Throws:
HttpException
java.io.IOException

sendResponseStatusLine

protected void sendResponseStatusLine(HttpResponse response)
                               throws HttpException,
                                      java.io.IOException
Throws:
HttpException
java.io.IOException

sendResponseHeaders

protected void sendResponseHeaders(HttpResponse response)
                            throws HttpException,
                                   java.io.IOException
Throws:
HttpException
java.io.IOException


Copyright 2005-2005-2006 Apache Software Foundation. All Rights Reserved.