public class HttpConnection extends java.lang.Object implements Connection
A HttpConnection represents the connection of a HTTP client to the server and
is created by an instance of a Connector
. It's prime function is to
associate Request
and Response
instances with a
EndPoint
.
A connection is also the prime mechanism used by jetty to recycle objects
without pooling. The Request
,Response
, HttpParser
,
HttpGenerator
and HttpFields
instances are all recycled for
the duration of a connection. Where appropriate, allocated buffers are also
kept associated with the connection via the parser and/or generator.
Modifier and Type | Class and Description |
---|---|
class |
HttpConnection.Output |
class |
HttpConnection.OutputWriter |
Modifier and Type | Field and Description |
---|---|
protected Connector |
_connector |
protected EndPoint |
_endp |
protected Generator |
_generator |
protected ServletInputStream |
_in |
protected HttpConnection.Output |
_out |
protected Parser |
_parser |
protected java.io.PrintWriter |
_printWriter |
protected Request |
_request |
protected HttpFields |
_requestFields |
protected Response |
_response |
protected HttpFields |
_responseFields |
protected Server |
_server |
protected HttpURI |
_uri |
protected HttpConnection.OutputWriter |
_writer |
Modifier | Constructor and Description |
---|---|
|
HttpConnection(Connector connector,
EndPoint endpoint,
Server server)
Constructor
|
protected |
HttpConnection(Connector connector,
EndPoint endpoint,
Server server,
Parser parser,
Generator generator,
Request request) |
protected final Connector _connector
protected final EndPoint _endp
protected final Server _server
protected final HttpURI _uri
protected final Parser _parser
protected final HttpFields _requestFields
protected final Request _request
protected ServletInputStream _in
protected final Generator _generator
protected final HttpFields _responseFields
protected final Response _response
protected HttpConnection.Output _out
protected HttpConnection.OutputWriter _writer
protected java.io.PrintWriter _printWriter
public HttpConnection(Connector connector, EndPoint endpoint, Server server)
public static HttpConnection getCurrentConnection()
protected static void setCurrentConnection(HttpConnection connection)
public void destroy()
public Parser getParser()
public int getRequests()
public long getTimeStamp()
public java.lang.Object getAssociatedObject()
public void setAssociatedObject(java.lang.Object associatedObject)
associatedObject
- The associatedObject to set.public Connector getConnector()
public HttpFields getRequestFields()
public HttpFields getResponseFields()
public boolean isConfidential(Request request)
getConnector()
.
isCondidential
(request), or false if there is no connector.public boolean isIntegral(Request request)
public boolean getResolveNames()
false
(this method is not yet implemented)public Request getRequest()
public Response getResponse()
public ServletInputStream getInputStream()
public ServletOutputStream getOutputStream()
public java.io.PrintWriter getPrintWriter(java.lang.String encoding)
PrintWriter
wrapping the output
stream
. The writer is created if it does not already exist.public boolean isResponseCommitted()
public void handle() throws java.io.IOException
handle
in interface Connection
java.io.IOException
public void reset(boolean returnBuffers)
protected void handleRequest() throws java.io.IOException
java.io.IOException
public void commitResponse(boolean last) throws java.io.IOException
java.io.IOException
public void completeResponse() throws java.io.IOException
java.io.IOException
public void flushResponse() throws java.io.IOException
java.io.IOException
public Generator getGenerator()
public boolean isIncluding()
public void include()
public void included()
public boolean isIdle()
isIdle
in interface Connection
Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.