View Javadoc

1   /*
2    * ====================================================================
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   * ====================================================================
20   *
21   * This software consists of voluntary contributions made by many
22   * individuals on behalf of the Apache Software Foundation.  For more
23   * information on the Apache Software Foundation, please see
24   * <http://www.apache.org/>.
25   *
26   */
27  
28  package org.apache.http.params;
29  
30  /**
31   * Defines parameter names for connections in HttpCore.
32   *
33   * @since 4.0
34   */
35  public interface CoreConnectionPNames {
36  
37      /**
38       * Defines the socket timeout (<code>SO_TIMEOUT</code>) in milliseconds,
39       * which is the timeout for waiting for data  or, put differently,
40       * a maximum period inactivity between two consecutive data packets).
41       * A timeout value of zero is interpreted as an infinite timeout.
42       * <p>
43       * This parameter expects a value of type {@link Integer}.
44       * </p>
45       * @see java.net.SocketOptions#SO_TIMEOUT
46       */
47      public static final String SO_TIMEOUT = "http.socket.timeout";
48  
49      /**
50       * Determines whether Nagle's algorithm is to be used. The Nagle's algorithm
51       * tries to conserve bandwidth by minimizing the number of segments that are
52       * sent. When applications wish to decrease network latency and increase
53       * performance, they can disable Nagle's algorithm (that is enable
54       * TCP_NODELAY). Data will be sent earlier, at the cost of an increase
55       * in bandwidth consumption.
56       * <p>
57       * This parameter expects a value of type {@link Boolean}.
58       * </p>
59       * @see java.net.SocketOptions#TCP_NODELAY
60       */
61      public static final String TCP_NODELAY = "http.tcp.nodelay";
62  
63      /**
64       * Determines the size of the internal socket buffer used to buffer data
65       * while receiving / transmitting HTTP messages.
66       * <p>
67       * This parameter expects a value of type {@link Integer}.
68       * </p>
69       */
70      public static final String SOCKET_BUFFER_SIZE = "http.socket.buffer-size";
71  
72      /**
73       * Sets SO_LINGER with the specified linger time in seconds. The maximum
74       * timeout value is platform specific. Value <code>0</code> implies that
75       * the option is disabled. Value <code>-1</code> implies that the JRE
76       * default is used. The setting only affects the socket close operation.
77       * <p>
78       * This parameter expects a value of type {@link Integer}.
79       * </p>
80       * @see java.net.SocketOptions#SO_LINGER
81       */
82      public static final String SO_LINGER = "http.socket.linger";
83  
84      /**
85       * Defines whether the socket can be bound even though a previous connection is
86       * still in a timeout state.
87       * <p>
88       * This parameter expects a value of type {@link Boolean}.
89       * </p>
90       * @see java.net.Socket#setReuseAddress(boolean)
91       *
92       * @since 4.1
93       */
94      public static final String SO_REUSEADDR = "http.socket.reuseaddr";
95  
96      /**
97       * Determines the timeout in milliseconds until a connection is established.
98       * A timeout value of zero is interpreted as an infinite timeout.
99       * <p>
100      * Please note this parameter can only be applied to connections that
101      * are bound to a particular local address.
102      * <p>
103      * This parameter expects a value of type {@link Integer}.
104      * </p>
105      */
106     public static final String CONNECTION_TIMEOUT = "http.connection.timeout";
107 
108     /**
109      * Determines whether stale connection check is to be used. The stale
110      * connection check can cause up to 30 millisecond overhead per request and
111      * should be used only when appropriate. For performance critical
112      * operations this check should be disabled.
113      * <p>
114      * This parameter expects a value of type {@link Boolean}.
115      * </p>
116      */
117     public static final String STALE_CONNECTION_CHECK = "http.connection.stalecheck";
118 
119     /**
120      * Determines the maximum line length limit. If set to a positive value,
121      * any HTTP line exceeding this limit will cause an IOException. A negative
122      * or zero value will effectively disable the check.
123      * <p>
124      * This parameter expects a value of type {@link Integer}.
125      * </p>
126      */
127     public static final String MAX_LINE_LENGTH = "http.connection.max-line-length";
128 
129     /**
130      * Determines the maximum HTTP header count allowed. If set to a positive
131      * value, the number of HTTP headers received from the data stream exceeding
132      * this limit will cause an IOException. A negative or zero value will
133      * effectively disable the check.
134      * <p>
135      * This parameter expects a value of type {@link Integer}.
136      * </p>
137      */
138     public static final String MAX_HEADER_COUNT = "http.connection.max-header-count";
139 
140     /**
141      * Defines the size limit below which data chunks should be buffered in a session I/O buffer
142      * in order to minimize native method invocations on the underlying network socket.
143      * The optimal value of this parameter can be platform specific and defines a trade-off
144      * between performance of memory copy operations and that of native method invocation.
145      * <p>
146      * This parameter expects a value of type {@link Integer}.
147      * </p>
148      *
149      * @since 4.1
150      */
151     public static final String MIN_CHUNK_LIMIT = "http.connection.min-chunk-limit";
152 
153 
154     /**
155      * Defines whether or not TCP is to send automatically a keepalive probe to the peer
156      * after an interval of inactivity (no data exchanged in either direction) between this
157      * host and the peer. The purpose of this option is to detect if the peer host crashes.
158      * <p>
159      * This parameter expects a value of type {@link Boolean}.
160      * </p>
161      * @see java.net.SocketOptions#SO_KEEPALIVE
162      * @since 4.2
163      */
164     public static final String SO_KEEPALIVE = "http.socket.keepalive";
165 
166 }