Class AbstractHttpConnection

  • All Implemented Interfaces:
    Direct Known Subclasses:
    AsyncHttpConnection, BlockingHttpConnection

    public abstract class AbstractHttpConnectionextends AbstractConnection

    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 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.

    • Method Detail

      • getParser

        public Parser getParser()
        the parser used by this connection
      • getRequests

        public int getRequests()
        the number of requests handled by this connection
      • getServer

        public Server getServer()
      • getAssociatedObject

        public Object getAssociatedObject()
        Returns the associatedObject.
      • setAssociatedObject

        public void setAssociatedObject(Object associatedObject)
        associatedObject - The associatedObject to set.
      • getConnector

        public Connector getConnector()
        Returns the connector.
      • getRequestFields

        public HttpFields getRequestFields()
        Returns the requestFields.
      • getResponseFields

        public HttpFields getResponseFields()
        Returns the responseFields.
      • isConfidential

        public boolean isConfidential(Request request)
        Find out if the request supports CONFIDENTIAL security.
        request - the incoming HTTP request
        the result of calling Connector.isConfidential(Request), or false if there is no connector
      • isIntegral

        public boolean isIntegral(Request request)
        Find out if the request supports INTEGRAL security.
        request - the incoming HTTP request
        the result of calling Connector.isIntegral(Request), or false if there is no connector
      • getResolveNames

        public boolean getResolveNames()
        false (this method is not yet implemented)
      • getRequest

        public Request getRequest()
        Returns the request.
      • getResponse

        public Response getResponse()
        Returns the response.
      • getInputStream

        public javax.servlet.ServletInputStream getInputStream()                                                throws IOException
        Get the inputStream from the connection.

        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.

        The input stream for this connection. The stream will be created if it does not already exist.
        IOException - if the input stream cannot be retrieved
      • getOutputStream

        public javax.servlet.ServletOutputStream getOutputStream()
        The output stream for this connection. The stream will be created if it does not already exist.
      • getPrintWriter

        public PrintWriter getPrintWriter(String encoding)
        encoding - the PrintWriter encoding
        A PrintWriter wrapping the output stream. The writer is created if it does not already exist.
      • isResponseCommitted

        public boolean isResponseCommitted()
      • isEarlyEOF

        public boolean isEarlyEOF()
      • reset

        public void reset()
      • getGenerator

        public Generator getGenerator()
      • isIncluding

        public boolean isIncluding()
      • include

        public void include()
      • included

        public void included()
      • isIdle

        public boolean isIdle()
      • onClose

        public void onClose()
      • isExpecting100Continues

        public boolean isExpecting100Continues()
      • isExpecting102Processing

        public boolean isExpecting102Processing()
      • getMaxIdleTime

        public int getMaxIdleTime()
      • earlyEOF

        public void earlyEOF()

Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.

Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14