## org.apache.felix.httplite.server
Class Connection

    java.lang.Object
      org.apache.felix.httplite.server.Connection

    public class Connection

extends java.lang.Object

This class represents an accepted connection between the server and a client. It supports persistent connections for both HTTP 1.0 and 1.1 clients. A given persistent connection is limited in the number of consecutive requests it is allowed to make before having its connection closed as well as after a period of inactivity.

Field Summary
`static int` `DEFAULT_CONNECTION_REQUESTLIMIT` Requests per request
`static int` `DEFAULT_CONNECTION_TIMEOUT` Connection timeout

Constructor Summary
`Connection(java.net.Socket socket, int timeout, int requestLimit, ServiceRegistrationResolver resolver, Logger logger)` Constructs a connection with the specified inactivity timeout and request limit.
`Connection(java.net.Socket socket, ServiceRegistrationResolver resolver, Logger logger)` Constructs a connection with a default inactivity timeout and request limit.

Method Summary
`void` `process()` Performs the actual servicing of the connection and its subsequent requests.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_CONNECTION_TIMEOUT

    public static final int DEFAULT_CONNECTION_TIMEOUT

  Connection timeout

  See Also:
    Constant Field Values

### DEFAULT_CONNECTION_REQUESTLIMIT

    public static final int DEFAULT_CONNECTION_REQUESTLIMIT

  Requests per request

  See Also:
    Constant Field Values

Constructor Detail

### Connection

    public Connection(java.net.Socket socket,
                      ServiceRegistrationResolver resolver,
                      Logger logger)
               throws java.io.IOException

  Constructs a connection with a default inactivity timeout and request limit.

  Parameters:
    `socket` - Socket connection
    `resolver` - a resolver to get http request/response and handler.
    `logger` - Logger
  Throws:
    `java.io.IOException` - If any I/O error occurs.

### Connection

    public Connection(java.net.Socket socket,
                      int timeout,
                      int requestLimit,
                      ServiceRegistrationResolver resolver,
                      Logger logger)
               throws java.io.IOException

  Constructs a connection with the specified inactivity timeout and request limit.

  Parameters:
    `socket` - The client socket.
    `timeout` - The inactivity timeout of the connection in milliseconds.
    `requestLimit` - The maximum number of consecutive requests.
    `resolver` - resolves a request URI to a client or servlet registration via the HTTP Service.
    `logger` - logger instance.
  Throws:
    `java.io.IOException` - If any I/O error occurs.

Method Detail

### process

    public void process()
                 throws java.io.IOException,
                        javax.servlet.ServletException

  Performs the actual servicing of the connection and its subsequent requests. This method will be called by threads in the thread pool. This method typically exits when the connection is closed due to either an explicit connection close, the inactivity timeout expires, the maximum request limit was reached, or an I/O error occurred. When this method returns, the associated socket will be closed, regardless of whether or not an expection was thrown.

  Throws:
    `java.net.SocketTimeoutException` - If the inactivity timeout expired while trying to read from the socket.
    `java.io.IOException` - If any I/O error occurs.
    `javax.servlet.ServletException` - on servlet errors

Copyright © 2006-2012 The Apache Software Foundation. All Rights Reserved.