96 changes: 48 additions & 48 deletions httpcore/src/main/java/org/apache/http/HttpStatus.java
Expand Up @@ -43,90 +43,90 @@ public interface HttpStatus {
// --- 1xx Informational ---

/** {@code 100 Continue} (HTTP/1.1 - RFC 2616) */
public static final int SC_CONTINUE = 100;
int SC_CONTINUE = 100;
/** {@code 101 Switching Protocols} (HTTP/1.1 - RFC 2616)*/
public static final int SC_SWITCHING_PROTOCOLS = 101;
int SC_SWITCHING_PROTOCOLS = 101;
/** {@code 102 Processing} (WebDAV - RFC 2518) */
public static final int SC_PROCESSING = 102;
int SC_PROCESSING = 102;

// --- 2xx Success ---

/** {@code 200 OK} (HTTP/1.0 - RFC 1945) */
public static final int SC_OK = 200;
int SC_OK = 200;
/** {@code 201 Created} (HTTP/1.0 - RFC 1945) */
public static final int SC_CREATED = 201;
int SC_CREATED = 201;
/** {@code 202 Accepted} (HTTP/1.0 - RFC 1945) */
public static final int SC_ACCEPTED = 202;
int SC_ACCEPTED = 202;
/** {@code 203 Non Authoritative Information} (HTTP/1.1 - RFC 2616) */
public static final int SC_NON_AUTHORITATIVE_INFORMATION = 203;
int SC_NON_AUTHORITATIVE_INFORMATION = 203;
/** {@code 204 No Content} (HTTP/1.0 - RFC 1945) */
public static final int SC_NO_CONTENT = 204;
int SC_NO_CONTENT = 204;
/** {@code 205 Reset Content} (HTTP/1.1 - RFC 2616) */
public static final int SC_RESET_CONTENT = 205;
int SC_RESET_CONTENT = 205;
/** {@code 206 Partial Content} (HTTP/1.1 - RFC 2616) */
public static final int SC_PARTIAL_CONTENT = 206;
int SC_PARTIAL_CONTENT = 206;
/**
* {@code 207 Multi-Status} (WebDAV - RFC 2518)
* or
* {@code 207 Partial Update OK} (HTTP/1.1 - draft-ietf-http-v11-spec-rev-01?)
*/
public static final int SC_MULTI_STATUS = 207;
int SC_MULTI_STATUS = 207;

// --- 3xx Redirection ---

/** {@code 300 Mutliple Choices} (HTTP/1.1 - RFC 2616) */
public static final int SC_MULTIPLE_CHOICES = 300;
int SC_MULTIPLE_CHOICES = 300;
/** {@code 301 Moved Permanently} (HTTP/1.0 - RFC 1945) */
public static final int SC_MOVED_PERMANENTLY = 301;
int SC_MOVED_PERMANENTLY = 301;
/** {@code 302 Moved Temporarily} (Sometimes {@code Found}) (HTTP/1.0 - RFC 1945) */
public static final int SC_MOVED_TEMPORARILY = 302;
int SC_MOVED_TEMPORARILY = 302;
/** {@code 303 See Other} (HTTP/1.1 - RFC 2616) */
public static final int SC_SEE_OTHER = 303;
int SC_SEE_OTHER = 303;
/** {@code 304 Not Modified} (HTTP/1.0 - RFC 1945) */
public static final int SC_NOT_MODIFIED = 304;
int SC_NOT_MODIFIED = 304;
/** {@code 305 Use Proxy} (HTTP/1.1 - RFC 2616) */
public static final int SC_USE_PROXY = 305;
int SC_USE_PROXY = 305;
/** {@code 307 Temporary Redirect} (HTTP/1.1 - RFC 2616) */
public static final int SC_TEMPORARY_REDIRECT = 307;
int SC_TEMPORARY_REDIRECT = 307;

// --- 4xx Client Error ---

/** {@code 400 Bad Request} (HTTP/1.1 - RFC 2616) */
public static final int SC_BAD_REQUEST = 400;
int SC_BAD_REQUEST = 400;
/** {@code 401 Unauthorized} (HTTP/1.0 - RFC 1945) */
public static final int SC_UNAUTHORIZED = 401;
int SC_UNAUTHORIZED = 401;
/** {@code 402 Payment Required} (HTTP/1.1 - RFC 2616) */
public static final int SC_PAYMENT_REQUIRED = 402;
int SC_PAYMENT_REQUIRED = 402;
/** {@code 403 Forbidden} (HTTP/1.0 - RFC 1945) */
public static final int SC_FORBIDDEN = 403;
int SC_FORBIDDEN = 403;
/** {@code 404 Not Found} (HTTP/1.0 - RFC 1945) */
public static final int SC_NOT_FOUND = 404;
int SC_NOT_FOUND = 404;
/** {@code 405 Method Not Allowed} (HTTP/1.1 - RFC 2616) */
public static final int SC_METHOD_NOT_ALLOWED = 405;
int SC_METHOD_NOT_ALLOWED = 405;
/** {@code 406 Not Acceptable} (HTTP/1.1 - RFC 2616) */
public static final int SC_NOT_ACCEPTABLE = 406;
int SC_NOT_ACCEPTABLE = 406;
/** {@code 407 Proxy Authentication Required} (HTTP/1.1 - RFC 2616)*/
public static final int SC_PROXY_AUTHENTICATION_REQUIRED = 407;
int SC_PROXY_AUTHENTICATION_REQUIRED = 407;
/** {@code 408 Request Timeout} (HTTP/1.1 - RFC 2616) */
public static final int SC_REQUEST_TIMEOUT = 408;
int SC_REQUEST_TIMEOUT = 408;
/** {@code 409 Conflict} (HTTP/1.1 - RFC 2616) */
public static final int SC_CONFLICT = 409;
int SC_CONFLICT = 409;
/** {@code 410 Gone} (HTTP/1.1 - RFC 2616) */
public static final int SC_GONE = 410;
int SC_GONE = 410;
/** {@code 411 Length Required} (HTTP/1.1 - RFC 2616) */
public static final int SC_LENGTH_REQUIRED = 411;
int SC_LENGTH_REQUIRED = 411;
/** {@code 412 Precondition Failed} (HTTP/1.1 - RFC 2616) */
public static final int SC_PRECONDITION_FAILED = 412;
int SC_PRECONDITION_FAILED = 412;
/** {@code 413 Request Entity Too Large} (HTTP/1.1 - RFC 2616) */
public static final int SC_REQUEST_TOO_LONG = 413;
int SC_REQUEST_TOO_LONG = 413;
/** {@code 414 Request-URI Too Long} (HTTP/1.1 - RFC 2616) */
public static final int SC_REQUEST_URI_TOO_LONG = 414;
int SC_REQUEST_URI_TOO_LONG = 414;
/** {@code 415 Unsupported Media Type} (HTTP/1.1 - RFC 2616) */
public static final int SC_UNSUPPORTED_MEDIA_TYPE = 415;
int SC_UNSUPPORTED_MEDIA_TYPE = 415;
/** {@code 416 Requested Range Not Satisfiable} (HTTP/1.1 - RFC 2616) */
public static final int SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
int SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
/** {@code 417 Expectation Failed} (HTTP/1.1 - RFC 2616) */
public static final int SC_EXPECTATION_FAILED = 417;
int SC_EXPECTATION_FAILED = 417;

/**
* Static constant for a 418 error.
Expand All @@ -143,36 +143,36 @@ public interface HttpStatus {
* or {@code 419 Proxy Reauthentication Required}
* (HTTP/1.1 drafts?)
*/
public static final int SC_INSUFFICIENT_SPACE_ON_RESOURCE = 419;
int SC_INSUFFICIENT_SPACE_ON_RESOURCE = 419;
/**
* Static constant for a 420 error.
* {@code 420 Method Failure}
* (WebDAV - draft-ietf-webdav-protocol-05?)
*/
public static final int SC_METHOD_FAILURE = 420;
int SC_METHOD_FAILURE = 420;
/** {@code 422 Unprocessable Entity} (WebDAV - RFC 2518) */
public static final int SC_UNPROCESSABLE_ENTITY = 422;
int SC_UNPROCESSABLE_ENTITY = 422;
/** {@code 423 Locked} (WebDAV - RFC 2518) */
public static final int SC_LOCKED = 423;
int SC_LOCKED = 423;
/** {@code 424 Failed Dependency} (WebDAV - RFC 2518) */
public static final int SC_FAILED_DEPENDENCY = 424;
int SC_FAILED_DEPENDENCY = 424;

// --- 5xx Server Error ---

/** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */
public static final int SC_INTERNAL_SERVER_ERROR = 500;
int SC_INTERNAL_SERVER_ERROR = 500;
/** {@code 501 Not Implemented} (HTTP/1.0 - RFC 1945) */
public static final int SC_NOT_IMPLEMENTED = 501;
int SC_NOT_IMPLEMENTED = 501;
/** {@code 502 Bad Gateway} (HTTP/1.0 - RFC 1945) */
public static final int SC_BAD_GATEWAY = 502;
int SC_BAD_GATEWAY = 502;
/** {@code 503 Service Unavailable} (HTTP/1.0 - RFC 1945) */
public static final int SC_SERVICE_UNAVAILABLE = 503;
int SC_SERVICE_UNAVAILABLE = 503;
/** {@code 504 Gateway Timeout} (HTTP/1.1 - RFC 2616) */
public static final int SC_GATEWAY_TIMEOUT = 504;
int SC_GATEWAY_TIMEOUT = 504;
/** {@code 505 HTTP Version Not Supported} (HTTP/1.1 - RFC 2616) */
public static final int SC_HTTP_VERSION_NOT_SUPPORTED = 505;
int SC_HTTP_VERSION_NOT_SUPPORTED = 505;

/** {@code 507 Insufficient Storage} (WebDAV - RFC 2518) */
public static final int SC_INSUFFICIENT_STORAGE = 507;
int SC_INSUFFICIENT_STORAGE = 507;

}
Expand Up @@ -38,8 +38,8 @@
*/
public interface ContentLengthStrategy {

public static final int IDENTITY = -1;
public static final int CHUNKED = -2;
int IDENTITY = -1;
int CHUNKED = -2;

/**
* Returns length of the given message in bytes. The returned value
Expand Down
Expand Up @@ -370,7 +370,7 @@ public static ContentType getLenient(final HttpEntity entity) {
return create(elements[0], false);
}
} catch (final ParseException ex) {
return null;
// ignore
}
}
return null;
Expand Down
Expand Up @@ -289,7 +289,7 @@ public int getSocketTimeout() {
try {
return socket.getSoTimeout();
} catch (final SocketException ignore) {
return -1;
// ignore
}
}
return -1;
Expand Down
Expand Up @@ -48,7 +48,7 @@ public interface CoreConnectionPNames {
* </p>
* @see java.net.SocketOptions#SO_TIMEOUT
*/
public static final String SO_TIMEOUT = "http.socket.timeout";
String SO_TIMEOUT = "http.socket.timeout";

/**
* Determines whether Nagle's algorithm is to be used. The Nagle's algorithm
Expand All @@ -62,7 +62,7 @@ public interface CoreConnectionPNames {
* </p>
* @see java.net.SocketOptions#TCP_NODELAY
*/
public static final String TCP_NODELAY = "http.tcp.nodelay";
String TCP_NODELAY = "http.tcp.nodelay";

/**
* Determines the size of the internal socket buffer used to buffer data
Expand All @@ -71,7 +71,7 @@ public interface CoreConnectionPNames {
* This parameter expects a value of type {@link Integer}.
* </p>
*/
public static final String SOCKET_BUFFER_SIZE = "http.socket.buffer-size";
String SOCKET_BUFFER_SIZE = "http.socket.buffer-size";

/**
* Sets SO_LINGER with the specified linger time in seconds. The maximum
Expand All @@ -83,7 +83,7 @@ public interface CoreConnectionPNames {
* </p>
* @see java.net.SocketOptions#SO_LINGER
*/
public static final String SO_LINGER = "http.socket.linger";
String SO_LINGER = "http.socket.linger";

/**
* Defines whether the socket can be bound even though a previous connection is
Expand All @@ -95,7 +95,7 @@ public interface CoreConnectionPNames {
*
* @since 4.1
*/
public static final String SO_REUSEADDR = "http.socket.reuseaddr";
String SO_REUSEADDR = "http.socket.reuseaddr";

/**
* Determines the timeout in milliseconds until a connection is established.
Expand All @@ -107,7 +107,7 @@ public interface CoreConnectionPNames {
* This parameter expects a value of type {@link Integer}.
* </p>
*/
public static final String CONNECTION_TIMEOUT = "http.connection.timeout";
String CONNECTION_TIMEOUT = "http.connection.timeout";

/**
* Determines whether stale connection check is to be used. The stale
Expand All @@ -118,7 +118,7 @@ public interface CoreConnectionPNames {
* This parameter expects a value of type {@link Boolean}.
* </p>
*/
public static final String STALE_CONNECTION_CHECK = "http.connection.stalecheck";
String STALE_CONNECTION_CHECK = "http.connection.stalecheck";

/**
* Determines the maximum line length limit. If set to a positive value,
Expand All @@ -128,7 +128,7 @@ public interface CoreConnectionPNames {
* This parameter expects a value of type {@link Integer}.
* </p>
*/
public static final String MAX_LINE_LENGTH = "http.connection.max-line-length";
String MAX_LINE_LENGTH = "http.connection.max-line-length";

/**
* Determines the maximum HTTP header count allowed. If set to a positive
Expand All @@ -139,7 +139,7 @@ public interface CoreConnectionPNames {
* This parameter expects a value of type {@link Integer}.
* </p>
*/
public static final String MAX_HEADER_COUNT = "http.connection.max-header-count";
String MAX_HEADER_COUNT = "http.connection.max-header-count";

/**
* Defines the size limit below which data chunks should be buffered in a session I/O buffer
Expand All @@ -152,7 +152,7 @@ public interface CoreConnectionPNames {
*
* @since 4.1
*/
public static final String MIN_CHUNK_LIMIT = "http.connection.min-chunk-limit";
String MIN_CHUNK_LIMIT = "http.connection.min-chunk-limit";


/**
Expand All @@ -165,6 +165,6 @@ public interface CoreConnectionPNames {
* @see java.net.SocketOptions#SO_KEEPALIVE
* @since 4.2
*/
public static final String SO_KEEPALIVE = "http.socket.keepalive";
String SO_KEEPALIVE = "http.socket.keepalive";

}
Expand Up @@ -44,39 +44,39 @@ public interface CoreProtocolPNames {
* This parameter expects a value of type {@link org.apache.http.ProtocolVersion}.
* </p>
*/
public static final String PROTOCOL_VERSION = "http.protocol.version";
String PROTOCOL_VERSION = "http.protocol.version";

/**
* Defines the charset to be used for encoding HTTP protocol elements.
* <p>
* This parameter expects a value of type {@link String}.
* </p>
*/
public static final String HTTP_ELEMENT_CHARSET = "http.protocol.element-charset";
String HTTP_ELEMENT_CHARSET = "http.protocol.element-charset";

/**
* Defines the charset to be used per default for encoding content body.
* <p>
* This parameter expects a value of type {@link String}.
* </p>
*/
public static final String HTTP_CONTENT_CHARSET = "http.protocol.content-charset";
String HTTP_CONTENT_CHARSET = "http.protocol.content-charset";

/**
* Defines the content of the {@code User-Agent} header.
* <p>
* This parameter expects a value of type {@link String}.
* </p>
*/
public static final String USER_AGENT = "http.useragent";
String USER_AGENT = "http.useragent";

/**
* Defines the content of the {@code Server} header.
* <p>
* This parameter expects a value of type {@link String}.
* </p>
*/
public static final String ORIGIN_SERVER = "http.origin-server";
String ORIGIN_SERVER = "http.origin-server";

/**
* Defines whether responses with an invalid {@code Transfer-Encoding}
Expand All @@ -85,7 +85,7 @@ public interface CoreProtocolPNames {
* This parameter expects a value of type {@link Boolean}.
* </p>
*/
public static final String STRICT_TRANSFER_ENCODING = "http.protocol.strict-transfer-encoding";
String STRICT_TRANSFER_ENCODING = "http.protocol.strict-transfer-encoding";

/**
* <p>
Expand All @@ -112,7 +112,7 @@ public interface CoreProtocolPNames {
*
* This parameter expects a value of type {@link Boolean}.
*/
public static final String USE_EXPECT_CONTINUE = "http.protocol.expect-continue";
String USE_EXPECT_CONTINUE = "http.protocol.expect-continue";

/**
* <p>
Expand All @@ -122,7 +122,7 @@ public interface CoreProtocolPNames {
*
* This parameter expects a value of type {@link Integer}.
*/
public static final String WAIT_FOR_CONTINUE = "http.protocol.wait-for-continue";
String WAIT_FOR_CONTINUE = "http.protocol.wait-for-continue";

/**
* <p>
Expand All @@ -134,7 +134,7 @@ public interface CoreProtocolPNames {
*
* @since 4.2
*/
public static final String HTTP_MALFORMED_INPUT_ACTION = "http.malformed.input.action";
String HTTP_MALFORMED_INPUT_ACTION = "http.malformed.input.action";

/**
* <p>
Expand All @@ -147,6 +147,6 @@ public interface CoreProtocolPNames {
*
* @since 4.2
*/
public static final String HTTP_UNMAPPABLE_INPUT_ACTION = "http.unmappable.input.action";
String HTTP_UNMAPPABLE_INPUT_ACTION = "http.unmappable.input.action";

}
Expand Up @@ -318,13 +318,13 @@ private E getPoolEntryBlocking(
}
this.lock.lock();
try {
final RouteSpecificPool<T, C, E> pool = getPool(route);
E entry;
for (;;) {
Asserts.check(!this.isShutDown, "Connection pool shut down");
if (future.isCancelled()) {
throw new ExecutionException(operationAborted());
}
final RouteSpecificPool<T, C, E> pool = getPool(route);
for (;;) {
entry = pool.getFree(state);
if (entry == null) {
Expand Down
Expand Up @@ -48,7 +48,7 @@
public interface HttpContext {

/** The prefix reserved for use by HTTP components. "http." */
public static final String RESERVED_PREFIX = "http.";
String RESERVED_PREFIX = "http.";

/**
* Obtains attribute with the given name.
Expand Down
Expand Up @@ -46,6 +46,7 @@
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
Expand Down Expand Up @@ -232,9 +233,7 @@ public SSLContextBuilder loadTrustMaterial(
}
}
}
for (final TrustManager tm : tms) {
this.trustManagers.add(tm);
}
Collections.addAll(this.trustManagers, tms);
}
return this;
}
Expand Down Expand Up @@ -310,9 +309,7 @@ public SSLContextBuilder loadKeyMaterial(
}
}
}
for (final KeyManager km : kms) {
keyManagers.add(km);
}
Collections.addAll(keyManagers, kms);
}
return this;
}
Expand Down
Expand Up @@ -845,11 +845,10 @@ public void handle(
post.setEntity(null);

this.client = new HttpClient(new ImmutableHttpProcessor(
new HttpRequestInterceptor[] {
new RequestTargetHost(),
new RequestConnControl(),
new RequestUserAgent(),
new RequestExpectContinue(true) }));
new RequestTargetHost(),
new RequestConnControl(),
new RequestUserAgent(),
new RequestExpectContinue(true)));

final HttpResponse response = this.client.execute(post, host, conn);
Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
Expand Down Expand Up @@ -898,21 +897,16 @@ public void handle(
post.setEntity(null);

this.client = new HttpClient(new ImmutableHttpProcessor(
new HttpRequestInterceptor[] {
new HttpRequestInterceptor() {

@Override
public void process(
final HttpRequest request,
final HttpContext context) throws HttpException, IOException {
request.addHeader(HTTP.TRANSFER_ENCODING, "identity");
}

},
new RequestTargetHost(),
new RequestConnControl(),
new RequestUserAgent(),
new RequestExpectContinue(true) }));
new HttpRequestInterceptor() {

@Override
public void process(
final HttpRequest request,
final HttpContext context) throws HttpException, IOException {
request.addHeader(HTTP.TRANSFER_ENCODING, "identity");
}

}, new RequestTargetHost(), new RequestConnControl(), new RequestUserAgent(), new RequestExpectContinue(true)));

final HttpResponse response = this.client.execute(post, host, conn);
Assert.assertEquals(HttpStatus.SC_BAD_REQUEST, response.getStatusLine().getStatusCode());
Expand Down
Expand Up @@ -43,7 +43,7 @@ public class TestConnPool {

private static final int GRACE_PERIOD = 10000;

static interface LocalConnFactory extends ConnFactory<String, HttpConnection> {
interface LocalConnFactory extends ConnFactory<String, HttpConnection> {
}

static class LocalPoolEntry extends PoolEntry<String, HttpConnection> {
Expand Down
Expand Up @@ -562,7 +562,7 @@ public void testSSLHandshakeClientAuthenticatedPrivateKeyStrategy() throws Excep
final PrivateKeyStrategy privateKeyStrategy = new PrivateKeyStrategy() {
@Override
public String chooseAlias(final Map<String, PrivateKeyDetails> aliases, final Socket socket) {
return aliases.keySet().contains("client2") ? "client2" : null;
return aliases.containsKey("client2") ? "client2" : null;
}
};

Expand Down
18 changes: 9 additions & 9 deletions pom.xml
Expand Up @@ -33,7 +33,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>httpcomponents-core</artifactId>
<name>Apache HttpComponents Core</name>
<version>4.4.13-SNAPSHOT</version>
<version>4.4.14</version>
<description>Apache HttpComponents Core is a library of components for building HTTP enabled services</description>
<url>http://hc.apache.org/httpcomponents-core-ga</url>
<inceptionYear>2005</inceptionYear>
Expand Down Expand Up @@ -61,7 +61,7 @@
<connection>scm:git:https://git-wip-us.apache.org/repos/asf/httpcomponents-core.git</connection>
<developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/httpcomponents-core.git</developerConnection>
<url>https://github.com/apache/httpcomponents-core/tree/${project.scm.tag}</url>
<tag>4.4.13-SNAPSHOT</tag>
<tag>4.4.14</tag>
</scm>

<modules>
Expand Down Expand Up @@ -201,18 +201,18 @@
<postProcess>
<copy todir="target/site/tutorial/html" failonerror="false">
<fileset dir="target/docbkx/html/index">
<include name="**/*.html" />
<include name="**/*.html"/>
</fileset>
</copy>
<copy todir="target/site/tutorial/html" failonerror="false">
<fileset dir="src/docbkx/resources">
<include name="**/*.css" />
<include name="**/*.png" />
<include name="**/*.gif" />
<include name="**/*.jpg" />
<include name="**/*.css"/>
<include name="**/*.png"/>
<include name="**/*.gif"/>
<include name="**/*.jpg"/>
</fileset>
</copy>
<copy file="target/docbkx/pdf/index.pdf" tofile="target/site/tutorial/pdf/httpcore-tutorial.pdf" failonerror="false" />
<copy file="target/docbkx/pdf/index.pdf" tofile="target/site/tutorial/pdf/httpcore-tutorial.pdf" failonerror="false"/>
</postProcess>
</configuration>
</plugin>
Expand Down Expand Up @@ -360,4 +360,4 @@
</plugins>
</reporting>

</project>
</project>