|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jetty.io.AbstractConnection
org.eclipse.jetty.server.AbstractHttpConnection
public abstract class AbstractHttpConnection
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 duraction of
a connection. Where appropriate, allocated buffers are also kept associated
with the connection via the parser and/or generator.
The connection state is held by 3 separate state machines: The request state, the response state and the continuation state. All three state machines must be driven to completion for every request, and all three can complete in any order.
The HttpConnection support protocol upgrade. If on completion of a request, the
response code is 101 (switch protocols), then the org.eclipse.jetty.io.Connection
request attribute is checked to see if there is a new Connection instance. If so,
the new connection is returned from handle()
and is used for future
handling of the underlying connection. Note that for switching protocols that
don't use 101 responses (eg CONNECT), the response should be sent and then the
status code changed to 101 before returning from the handler. Implementors
of new Connection types should be careful to extract any buffered data from
(HttpParser)http.getParser()).getHeaderBuffer() and
(HttpParser)http.getParser()).getBodyBuffer() to initialise their new connection.
Nested Class Summary | |
---|---|
class |
AbstractHttpConnection.Output
|
class |
AbstractHttpConnection.OutputWriter
|
Field Summary | |
---|---|
protected Connector |
_connector
|
protected Generator |
_generator
|
protected javax.servlet.ServletInputStream |
_in
|
protected AbstractHttpConnection.Output |
_out
|
protected Parser |
_parser
|
protected PrintWriter |
_printWriter
|
protected Request |
_request
|
protected HttpFields |
_requestFields
|
protected Response |
_response
|
protected HttpFields |
_responseFields
|
protected Server |
_server
|
protected HttpURI |
_uri
|
protected AbstractHttpConnection.OutputWriter |
_writer
|
Fields inherited from class org.eclipse.jetty.io.AbstractConnection |
---|
_endp |
Constructor Summary | |
---|---|
|
AbstractHttpConnection(Connector connector,
EndPoint endpoint,
Server server)
Constructor |
protected |
AbstractHttpConnection(Connector connector,
EndPoint endpoint,
Server server,
Parser parser,
Generator generator,
Request request)
|
Methods inherited from class org.eclipse.jetty.io.AbstractConnection |
---|
getEndPoint, getTimeStamp, onIdleExpired |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final Connector _connector
protected final Server _server
protected final HttpURI _uri
protected final Parser _parser
protected final HttpFields _requestFields
protected final Request _request
protected volatile javax.servlet.ServletInputStream _in
protected final Generator _generator
protected final HttpFields _responseFields
protected final Response _response
protected volatile AbstractHttpConnection.Output _out
protected volatile AbstractHttpConnection.OutputWriter _writer
protected volatile PrintWriter _printWriter
Constructor Detail |
---|
public AbstractHttpConnection(Connector connector, EndPoint endpoint, Server server)
protected AbstractHttpConnection(Connector connector, EndPoint endpoint, Server server, Parser parser, Generator generator, Request request)
Method Detail |
---|
public static AbstractHttpConnection getCurrentConnection()
protected static void setCurrentConnection(AbstractHttpConnection connection)
protected HttpParser newHttpParser(Buffers requestBuffers, EndPoint endpoint, HttpParser.EventHandler requestHandler)
public Parser getParser()
public int getRequests()
public Server getServer()
public Object getAssociatedObject()
public void setAssociatedObject(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)
request
-
true
if there is a connector
and it considers request
to be integral
public boolean getResolveNames()
false
(this method is not yet implemented)public Request getRequest()
public Response getResponse()
public javax.servlet.ServletInputStream getInputStream() throws IOException
If the associated response has the Expect header set to 100 Continue, then accessing the input stream indicates that the handler/servlet is ready for the request body and thus a 100 Continue response is sent.
IOException
public javax.servlet.ServletOutputStream getOutputStream()
public PrintWriter getPrintWriter(String encoding)
PrintWriter
wrapping the output stream
. The writer is created if it
does not already exist.public boolean isResponseCommitted()
public void reset()
protected void handleRequest() throws IOException
IOException
public abstract Connection handle() throws IOException
Connection
IOException
public void commitResponse(boolean last) throws IOException
IOException
public void completeResponse() throws IOException
IOException
public void flushResponse() throws IOException
IOException
public Generator getGenerator()
public boolean isIncluding()
public void include()
public void included()
public boolean isIdle()
public boolean isSuspended()
Connection.isSuspended()
public void onClose()
Connection
public boolean isExpecting100Continues()
public boolean isExpecting102Processing()
public int getMaxIdleTime()
public String toString()
toString
in class AbstractConnection
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |