You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2016/10/31 17:33:33 UTC
svn commit: r1767339 [13/14] - in /httpcomponents/httpcore/trunk: ./
httpcore5-ab/src/main/java/org/apache/hc/core5/http/benchmark/
httpcore5-ab/src/test/java/org/apache/hc/core5/http/benchmark/
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/boot...
Added: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ImmediateResponseExchangeHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ImmediateResponseExchangeHandler.java?rev=1767339&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ImmediateResponseExchangeHandler.java (added)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ImmediateResponseExchangeHandler.java Mon Oct 31 17:33:27 2016
@@ -0,0 +1,125 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+package org.apache.hc.core5.http.nio.support;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.List;
+
+import org.apache.hc.core5.http.EntityDetails;
+import org.apache.hc.core5.http.Header;
+import org.apache.hc.core5.http.HttpException;
+import org.apache.hc.core5.http.HttpRequest;
+import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.io.entity.ContentType;
+import org.apache.hc.core5.http.message.BasicHttpResponse;
+import org.apache.hc.core5.http.nio.AsyncResponseProducer;
+import org.apache.hc.core5.http.nio.AsyncServerExchangeHandler;
+import org.apache.hc.core5.http.nio.BasicResponseProducer;
+import org.apache.hc.core5.http.nio.CapacityChannel;
+import org.apache.hc.core5.http.nio.DataStreamChannel;
+import org.apache.hc.core5.http.nio.ExpectationChannel;
+import org.apache.hc.core5.http.nio.ResponseChannel;
+import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityProducer;
+import org.apache.hc.core5.http.protocol.HttpContext;
+import org.apache.hc.core5.util.Args;
+
+/**
+ * @since 5.0
+ */
+public final class ImmediateResponseExchangeHandler implements AsyncServerExchangeHandler {
+
+ private final AsyncResponseProducer responseProducer;
+
+ public ImmediateResponseExchangeHandler(final AsyncResponseProducer responseProducer) {
+ this.responseProducer = Args.notNull(responseProducer, "Response producer");
+ }
+
+ public ImmediateResponseExchangeHandler(final HttpResponse response, final String message) {
+ this(new BasicResponseProducer(response, new BasicAsyncEntityProducer(message, ContentType.TEXT_PLAIN)));
+ }
+
+ public ImmediateResponseExchangeHandler(final int status, final String message) {
+ this(new BasicHttpResponse(status), message);
+ }
+
+ @Override
+ public void setContext(final HttpContext context) {
+ }
+
+ @Override
+ public void handleRequest(
+ final HttpRequest request,
+ final EntityDetails entityDetails,
+ final ResponseChannel responseChannel) throws HttpException, IOException {
+ responseChannel.sendResponse(responseProducer.produceResponse(), responseProducer.getEntityDetails());
+ }
+
+ @Override
+ public void verify(
+ final HttpRequest request,
+ final EntityDetails entityDetails,
+ final ExpectationChannel expectationChannel) throws HttpException, IOException {
+ expectationChannel.sendContinue();
+ }
+
+ @Override
+ public void updateCapacity(final CapacityChannel capacityChannel) throws IOException {
+ capacityChannel.update(Integer.MAX_VALUE);
+ }
+
+ @Override
+ public int consume(final ByteBuffer src) throws IOException {
+ return Integer.MAX_VALUE;
+ }
+
+ @Override
+ public void streamEnd(final List<Header> trailers) throws HttpException, IOException {
+ }
+
+ @Override
+ public final int available() {
+ return responseProducer.available();
+ }
+
+ @Override
+ public final void produce(final DataStreamChannel channel) throws IOException {
+ responseProducer.produce(channel);
+ }
+
+ @Override
+ public final void failed(final Exception cause) {
+ responseProducer.failed(cause);
+ releaseResources();
+ }
+
+ @Override
+ public final void releaseResources() {
+ responseProducer.releaseResources();
+ }
+
+}
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ImmediateResponseExchangeHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ImmediateResponseExchangeHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ImmediateResponseExchangeHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/RequestConsumerSupplier.java (from r1765384, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/RequestChannel.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/RequestConsumerSupplier.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/RequestConsumerSupplier.java&p1=httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/RequestChannel.java&r1=1765384&r2=1767339&rev=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/RequestChannel.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/RequestConsumerSupplier.java Mon Oct 31 17:33:27 2016
@@ -24,27 +24,21 @@
* <http://www.apache.org/>.
*
*/
-
-package org.apache.hc.core5.http2.nio;
-
-import java.io.IOException;
+package org.apache.hc.core5.http.nio.support;
import org.apache.hc.core5.annotation.Contract;
import org.apache.hc.core5.annotation.ThreadingBehavior;
-import org.apache.hc.core5.http.EntityDetails;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpRequest;
+import org.apache.hc.core5.http.nio.AsyncRequestConsumer;
+import org.apache.hc.core5.http.protocol.HttpContext;
/**
- * Abstract request channel.
- * <p>
- * Implementations are expected to be thread-safe.
- *
* @since 5.0
*/
@Contract(threading = ThreadingBehavior.SAFE)
-public interface RequestChannel {
+public interface RequestConsumerSupplier<T> {
- void sendRequest(HttpRequest request, EntityDetails entityDetails) throws HttpException, IOException;
+ AsyncRequestConsumer<T> get(HttpRequest request, HttpContext context) throws HttpException;
}
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/RequestConsumerSupplier.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/RequestConsumerSupplier.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/RequestConsumerSupplier.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ResponseHandler.java (from r1765384, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/CapacityChannel.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ResponseHandler.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ResponseHandler.java&p1=httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/CapacityChannel.java&r1=1765384&r2=1767339&rev=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/CapacityChannel.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ResponseHandler.java Mon Oct 31 17:33:27 2016
@@ -24,23 +24,21 @@
* <http://www.apache.org/>.
*
*/
-package org.apache.hc.core5.http2.nio;
+package org.apache.hc.core5.http.nio.support;
import java.io.IOException;
import org.apache.hc.core5.annotation.Contract;
import org.apache.hc.core5.annotation.ThreadingBehavior;
+import org.apache.hc.core5.http.HttpException;
+import org.apache.hc.core5.http.protocol.HttpContext;
/**
- * Abstract capacity update channel.
- * <p>
- * Implementations are expected to be thread-safe.
- *
* @since 5.0
*/
@Contract(threading = ThreadingBehavior.SAFE)
-public interface CapacityChannel {
+public interface ResponseHandler<T> {
- void update(int increment) throws IOException;
+ void handle(T requestMessage, ResponseTrigger responseTrigger, HttpContext context) throws HttpException, IOException;
}
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ResponseHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ResponseHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ResponseHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ResponseTrigger.java (from r1765384, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AsyncResponseTrigger.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ResponseTrigger.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ResponseTrigger.java&p1=httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AsyncResponseTrigger.java&r1=1765384&r2=1767339&rev=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AsyncResponseTrigger.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ResponseTrigger.java Mon Oct 31 17:33:27 2016
@@ -25,7 +25,7 @@
*
*/
-package org.apache.hc.core5.http2.nio;
+package org.apache.hc.core5.http.nio.support;
import java.io.IOException;
@@ -33,6 +33,8 @@ import org.apache.hc.core5.annotation.Co
import org.apache.hc.core5.annotation.ThreadingBehavior;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpRequest;
+import org.apache.hc.core5.http.nio.AsyncPushProducer;
+import org.apache.hc.core5.http.nio.AsyncResponseProducer;
/**
* Abstract asynchronous response / response promise trigger.
@@ -40,7 +42,7 @@ import org.apache.hc.core5.http.HttpRequ
* @since 5.0
*/
@Contract(threading = ThreadingBehavior.SAFE)
-public interface AsyncResponseTrigger {
+public interface ResponseTrigger {
void submitResponse(AsyncResponseProducer responseProducer) throws HttpException, IOException;
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ResponseTrigger.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ResponseTrigger.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ResponseTrigger.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestValidateHost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestValidateHost.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestValidateHost.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestValidateHost.java Mon Oct 31 17:33:27 2016
@@ -67,6 +67,8 @@ public class RequestValidateHost impleme
final String authority = header.getValue();
if (!TextUtils.isBlank(authority)) {
request.setAuthority(authority);
+ } else {
+ throw new ProtocolException("Host header is empty");
}
} else {
final ProtocolVersion version = request.getVersion() != null ? request.getVersion() : HttpVersion.HTTP_1_1;
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseConnControl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseConnControl.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseConnControl.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseConnControl.java Mon Oct 31 17:33:27 2016
@@ -63,8 +63,7 @@ public class ResponseConnControl impleme
public void process(final HttpResponse response, final EntityDetails entity, final HttpContext context)
throws HttpException, IOException {
Args.notNull(response, "HTTP response");
-
- final HttpCoreContext corecontext = HttpCoreContext.adapt(context);
+ Args.notNull(context, "HTTP context");
// Always drop connection after certain type of responses
final int status = response.getCode();
@@ -78,29 +77,24 @@ public class ResponseConnControl impleme
response.setHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
return;
}
- final Header explicit = response.getFirstHeader(HttpHeaders.CONNECTION);
- if (explicit != null && HeaderElements.CLOSE.equalsIgnoreCase(explicit.getValue())) {
- // Connection persistence explicitly disabled
- return;
- }
- // Always drop connection for HTTP/1.0 responses and below
- // if the content body cannot be correctly delimited
- final ProtocolVersion ver = context.getProtocolVersion();
- if (entity != null) {
- if (entity.getContentLength() < 0 &&
- (!entity.isChunked() || ver.lessEquals(HttpVersion.HTTP_1_0))) {
- response.setHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
- return;
- }
- }
- // Drop connection if requested by the client or request was <= 1.0
- final HttpRequest request = corecontext.getRequest();
- if (request != null) {
- final Header header = request.getFirstHeader(HttpHeaders.CONNECTION);
- if (header != null) {
- response.setHeader(HttpHeaders.CONNECTION, header.getValue());
- } else if (ver.lessEquals(HttpVersion.HTTP_1_0)) {
+ if (!response.containsHeader(HttpHeaders.CONNECTION)) {
+ // Always drop connection for HTTP/1.0 responses and below
+ // if the content body cannot be correctly delimited
+ final ProtocolVersion ver = context.getProtocolVersion();
+ if (entity != null && entity.getContentLength() < 0 && ver.lessEquals(HttpVersion.HTTP_1_0)) {
response.setHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
+ } else {
+ final HttpCoreContext coreContext = HttpCoreContext.adapt(context);
+ final HttpRequest request = coreContext.getRequest();
+ // Drop connection if requested by the client or request was <= 1.0
+ if (request != null) {
+ final Header header = request.getFirstHeader(HttpHeaders.CONNECTION);
+ if (header != null) {
+ response.setHeader(HttpHeaders.CONNECTION, header.getValue());
+ } else if (ver.lessEquals(HttpVersion.HTTP_1_0)) {
+ response.setHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
+ }
+ }
}
}
}
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseContent.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseContent.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseContent.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseContent.java Mon Oct 31 17:33:27 2016
@@ -109,19 +109,17 @@ public class ResponseContent implements
final ProtocolVersion ver = context.getProtocolVersion();
if (entity != null) {
final long len = entity.getContentLength();
- if (entity.isChunked() && !ver.lessEquals(HttpVersion.HTTP_1_0)) {
+ if (len >= 0 && !entity.isChunked()) {
+ response.addHeader(HttpHeaders.CONTENT_LENGTH, Long.toString(entity.getContentLength()));
+ } else if (ver.greaterEquals(HttpVersion.HTTP_1_1)) {
response.addHeader(HttpHeaders.TRANSFER_ENCODING, HeaderElements.CHUNKED_ENCODING);
MessageSupport.addTrailerHeader(response, entity);
- } else if (len >= 0) {
- response.addHeader(HttpHeaders.CONTENT_LENGTH, Long.toString(entity.getContentLength()));
}
MessageSupport.addContentTypeHeader(response, entity);
MessageSupport.addContentEncodingHeader(response, entity);
} else {
final int status = response.getCode();
- if (status != HttpStatus.SC_NO_CONTENT
- && status != HttpStatus.SC_NOT_MODIFIED
- && status != HttpStatus.SC_RESET_CONTENT) {
+ if (status != HttpStatus.SC_NO_CONTENT && status != HttpStatus.SC_NOT_MODIFIED) {
response.addHeader(HttpHeaders.CONTENT_LENGTH, "0");
}
}
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/nio/AbstractNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/nio/AbstractNIOConnPool.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/nio/AbstractNIOConnPool.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/nio/AbstractNIOConnPool.java Mon Oct 31 17:33:27 2016
@@ -52,8 +52,7 @@ import org.apache.hc.core5.pool.ConnPool
import org.apache.hc.core5.pool.PoolEntry;
import org.apache.hc.core5.pool.PoolEntryCallback;
import org.apache.hc.core5.pool.PoolStats;
-import org.apache.hc.core5.reactor.ConnectingIOReactor;
-import org.apache.hc.core5.reactor.IOReactorStatus;
+import org.apache.hc.core5.reactor.ConnectionInitiator;
import org.apache.hc.core5.reactor.IOSession;
import org.apache.hc.core5.reactor.SessionRequest;
import org.apache.hc.core5.reactor.SessionRequestCallback;
@@ -73,7 +72,7 @@ import org.apache.hc.core5.util.Asserts;
public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
implements ConnPool<T, E>, ConnPoolControl<T> {
- private final ConnectingIOReactor ioreactor;
+ private final ConnectionInitiator connectionInitiator;
private final NIOConnFactory<T, C> connFactory;
private final SocketAddressResolver<T> addressResolver;
private final SessionRequestCallback sessionRequestCallback;
@@ -94,18 +93,18 @@ public abstract class AbstractNIOConnPoo
* @since 4.3
*/
public AbstractNIOConnPool(
- final ConnectingIOReactor ioreactor,
+ final ConnectionInitiator connectionInitiator,
final NIOConnFactory<T, C> connFactory,
final SocketAddressResolver<T> addressResolver,
final int defaultMaxPerRoute,
final int maxTotal) {
super();
- Args.notNull(ioreactor, "I/O reactor");
+ Args.notNull(connectionInitiator, "I/O reactor");
Args.notNull(connFactory, "Connection factory");
Args.notNull(addressResolver, "Address resolver");
Args.positive(defaultMaxPerRoute, "Max per route value");
Args.positive(maxTotal, "Max total value");
- this.ioreactor = ioreactor;
+ this.connectionInitiator = connectionInitiator;
this.connFactory = connFactory;
this.addressResolver = addressResolver;
this.sessionRequestCallback = new InternalSessionRequestCallback();
@@ -146,8 +145,7 @@ public abstract class AbstractNIOConnPoo
return this.isShutDown.get();
}
- public void shutdown(final long deadline, final TimeUnit timeUnit) throws IOException {
- Args.notNull(timeUnit, "Time unit");
+ public void shutdown() {
if (this.isShutDown.compareAndSet(false, true)) {
fireCallbacks();
this.lock.lock();
@@ -169,7 +167,6 @@ public abstract class AbstractNIOConnPoo
this.pending.clear();
this.available.clear();
this.leasingRequests.clear();
- this.ioreactor.shutdown(deadline, timeUnit);
} finally {
this.lock.unlock();
}
@@ -372,7 +369,7 @@ public abstract class AbstractNIOConnPoo
return false;
}
- final SessionRequest sessionRequest = this.ioreactor.connect(
+ final SessionRequest sessionRequest = this.connectionInitiator.connect(
remoteAddress, localAddress, route, this.sessionRequestCallback);
final int timout = request.getConnectTimeout() < Integer.MAX_VALUE ?
(int) request.getConnectTimeout() : Integer.MAX_VALUE;
@@ -459,9 +456,7 @@ public abstract class AbstractNIOConnPoo
this.pending.remove(request);
final RouteSpecificPool<T, C, E> pool = getPool(route);
pool.cancelled(request);
- if (this.ioreactor.getStatus().compareTo(IOReactorStatus.ACTIVE) <= 0) {
- processNextPendingRequest();
- }
+ processNextPendingRequest();
} finally {
this.lock.unlock();
}
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractMultiworkerIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractMultiworkerIOReactor.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractMultiworkerIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractMultiworkerIOReactor.java Mon Oct 31 17:33:27 2016
@@ -397,6 +397,9 @@ public abstract class AbstractMultiworke
* @since 5.0
*/
public void enumSessions(final IOSessionCallback callback) throws IOException {
+ if (callback == null) {
+ return;
+ }
for (BaseIOReactor dispatcher: dispatchers) {
if (dispatcher != null) {
dispatcher.enumSessions(callback);
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectingIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectingIOReactor.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectingIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectingIOReactor.java Mon Oct 31 17:33:27 2016
@@ -27,52 +27,12 @@
package org.apache.hc.core5.reactor;
-import java.net.SocketAddress;
-
/**
* ConnectingIOReactor represents an I/O reactor capable of establishing
* connections to remote hosts.
*
* @since 4.0
*/
-public interface ConnectingIOReactor extends IOReactor {
-
- /**
- * Requests a connection to a remote host.
- * <p>
- * Opening a connection to a remote host usually tends to be a time
- * consuming process and may take a while to complete. One can monitor and
- * control the process of session initialization by means of the
- * {@link SessionRequest} interface.
- * <p>
- * There are several parameters one can use to exert a greater control over
- * the process of session initialization:
- * <p>
- * A non-null local socket address parameter can be used to bind the socket
- * to a specific local address.
- * <p>
- * An attachment object can added to the new session's context upon
- * initialization. This object can be used to pass an initial processing
- * state to the protocol handler.
- * <p>
- * It is often desirable to be able to react to the completion of a session
- * request asynchronously without having to wait for it, blocking the
- * current thread of execution. One can optionally provide an implementation
- * {@link SessionRequestCallback} instance to get notified of events related
- * to session requests, such as request completion, cancellation, failure or
- * timeout.
- *
- * @param remoteAddress the socket address of the remote host.
- * @param localAddress the local socket address. Can be {@code null},
- * in which can the default local address and a random port will be used.
- * @param attachment the attachment object. Can be {@code null}.
- * @param callback interface. Can be {@code null}.
- * @return session request object.
- */
- SessionRequest connect(
- SocketAddress remoteAddress,
- SocketAddress localAddress,
- Object attachment,
- SessionRequestCallback callback);
+public interface ConnectingIOReactor extends IOReactor, ConnectionInitiator {
}
Copied: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectionInitiator.java (from r1765384, httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectingIOReactor.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectionInitiator.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectionInitiator.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectingIOReactor.java&r1=1765384&r2=1767339&rev=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectingIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectionInitiator.java Mon Oct 31 17:33:27 2016
@@ -30,12 +30,11 @@ package org.apache.hc.core5.reactor;
import java.net.SocketAddress;
/**
- * ConnectingIOReactor represents an I/O reactor capable of establishing
- * connections to remote hosts.
+ * Non-blocking connection initiator.
*
* @since 4.0
*/
-public interface ConnectingIOReactor extends IOReactor {
+public interface ConnectionInitiator {
/**
* Requests a connection to a remote host.
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java Mon Oct 31 17:33:27 2016
@@ -218,7 +218,7 @@ class IOSessionImpl implements IOSession
@Override
public boolean isClosed() {
- return this.status.get() == CLOSED;
+ return this.status.get() == CLOSED || !this.channel.isOpen();
}
@Override
@@ -321,10 +321,7 @@ class IOSessionImpl implements IOSession
@Override
public Socket getSocket() {
- if (this.channel instanceof SocketChannel) {
- return ((SocketChannel) this.channel).socket();
- }
- return null;
+ return this.channel.socket();
}
@Override
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContexts.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContexts.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContexts.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContexts.java Mon Oct 31 17:33:27 2016
@@ -46,7 +46,7 @@ import javax.net.ssl.SSLContext;
* </a>
* @since 4.4
*/
-public class SSLContexts {
+public final class SSLContexts {
private SSLContexts() {
// Do not allow utility class to be instantiated.
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/InetAddressUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/InetAddressUtils.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/InetAddressUtils.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/InetAddressUtils.java Mon Oct 31 17:33:27 2016
@@ -27,6 +27,8 @@
package org.apache.hc.core5.util;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.util.regex.Pattern;
/**
@@ -118,4 +120,18 @@ public class InetAddressUtils {
return isIPv6StdAddress(input) || isIPv6HexCompressedAddress(input);
}
+ /**
+ * Returns canonical name (fully qualified domain name) of the localhost.
+ *
+ * @since 5.0
+ */
+ public static String getCanonicalLocalHostName() {
+ try {
+ final InetAddress localHost = InetAddress.getLocalHost();
+ return localHost.getCanonicalHostName();
+ } catch (UnknownHostException ex) {
+ return "localhost";
+ }
+ }
+
}
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/URLEncodedUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/URLEncodedUtils.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/URLEncodedUtils.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/URLEncodedUtils.java Mon Oct 31 17:33:27 2016
@@ -27,10 +27,6 @@
package org.apache.hc.core5.util;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
import java.net.URI;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
@@ -41,9 +37,7 @@ import java.util.BitSet;
import java.util.Collections;
import java.util.List;
-import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.NameValuePair;
-import org.apache.hc.core5.http.entity.ContentType;
import org.apache.hc.core5.http.message.BasicNameValuePair;
import org.apache.hc.core5.http.message.ParserCursor;
import org.apache.hc.core5.http.message.TokenParser;
@@ -91,61 +85,6 @@ public class URLEncodedUtils {
}
/**
- * Returns a list of {@link NameValuePair NameValuePairs} as parsed from an {@link HttpEntity}.
- * The encoding is taken from the entity's Content-Encoding header.
- * <p>
- * This is typically used while parsing an HTTP POST.
- *
- * @param entity
- * The entity to parse
- * @return a list of {@link NameValuePair} as built from the URI's query portion.
- * @throws IOException
- * If there was an exception getting the entity's data.
- */
- public static List <NameValuePair> parse(
- final HttpEntity entity) throws IOException {
- Args.notNull(entity, "HTTP entity");
- final ContentType contentType = ContentType.get(entity);
- if (contentType == null || !contentType.getMimeType().equalsIgnoreCase(CONTENT_TYPE)) {
- return Collections.emptyList();
- }
- final long len = entity.getContentLength();
- Args.check(len <= Integer.MAX_VALUE, "HTTP entity is too large");
- final Charset charset = contentType.getCharset() != null ? contentType.getCharset() : StandardCharsets.ISO_8859_1;
- final InputStream instream = entity.getContent();
- if (instream == null) {
- return Collections.emptyList();
- }
- final CharArrayBuffer buf;
- try {
- buf = new CharArrayBuffer(len > 0 ? (int) len : 1024);
- final Reader reader = new InputStreamReader(instream, charset);
- final char[] tmp = new char[1024];
- int l;
- while((l = reader.read(tmp)) != -1) {
- buf.append(tmp, 0, l);
- }
-
- } finally {
- instream.close();
- }
- if (buf.length() == 0) {
- return Collections.emptyList();
- }
- return parse(buf, charset, QP_SEP_A);
- }
-
- /**
- * Returns true if the entity's Content-Type header is
- * {@code application/x-www-form-urlencoded}.
- */
- public static boolean isEncoded(final HttpEntity entity) {
- Args.notNull(entity, "HTTP entity");
- final ContentType contentType = ContentType.parse(entity.getContentType());
- return contentType != null && CONTENT_TYPE.equalsIgnoreCase(contentType.getMimeType());
- }
-
- /**
* Returns a list of {@link NameValuePair NameValuePairs} as parsed from the given string using the given character
* encoding. By convention, {@code '&'} and {@code ';'} are accepted as parameter separators.
*
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/VersionInfo.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/VersionInfo.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/VersionInfo.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/VersionInfo.java Mon Oct 31 17:33:27 2016
@@ -301,7 +301,7 @@ public class VersionInfo {
}
/**
- * Sets the user agent to {@code "<name>/<release> (Java/<java.version>)"}. If release is
+ * Gets software information as {@code "<name>/<release> (Java/<java.version>)"}. If release is
* {@link #UNAVAILABLE}, it will be omitted.
* <p>
* For example:
@@ -315,7 +315,7 @@ public class VersionInfo {
* the class' class loader to load from, or {@code null} for the thread context class loader
* @since 4.3
*/
- public static String getUserAgent(final String name, final String pkg, final Class<?> cls) {
+ public static String getSoftwareInfo(final String name, final String pkg, final Class<?> cls) {
// determine the release version from packaged version info
final VersionInfo vi = VersionInfo.loadVersionInfo(pkg, cls.getClassLoader());
final String release = (vi != null) ? vi.getRelease() : VersionInfo.UNAVAILABLE;
@@ -329,4 +329,4 @@ public class VersionInfo {
return String.format("%s (Java/%s)", nameAndRelease, javaVersion);
}
-} // class VersionInfo
+}
Copied: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/ReadableByteChannelMock.java (from r1765384, httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/ReadableByteChannelMock.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/ReadableByteChannelMock.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/ReadableByteChannelMock.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/ReadableByteChannelMock.java&r1=1765384&r2=1767339&rev=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/ReadableByteChannelMock.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/ReadableByteChannelMock.java Mon Oct 31 17:33:27 2016
@@ -25,7 +25,7 @@
*
*/
-package org.apache.hc.core5.http.impl.nio;
+package org.apache.hc.core5.http;
import java.io.IOException;
import java.nio.ByteBuffer;
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/ReadableByteChannelMock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/ReadableByteChannelMock.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/ReadableByteChannelMock.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/WritableByteChannelMock.java (from r1765384, httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/WritableByteChannelMock.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/WritableByteChannelMock.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/WritableByteChannelMock.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/WritableByteChannelMock.java&r1=1765384&r2=1767339&rev=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/WritableByteChannelMock.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/WritableByteChannelMock.java Mon Oct 31 17:33:27 2016
@@ -25,7 +25,7 @@
*
*/
-package org.apache.hc.core5.http.impl.nio;
+package org.apache.hc.core5.http;
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -112,7 +112,7 @@ public class WritableByteChannelMock imp
public String dump(final Charset charset) throws CharacterCodingException {
this.buf.flip();
final CharBuffer charBuffer = charset.newDecoder().decode(this.buf);
- this.buf.flip();
+ this.buf.compact();
return charBuffer.toString();
}
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/WritableByteChannelMock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/WritableByteChannelMock.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/WritableByteChannelMock.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java Mon Oct 31 17:33:27 2016
@@ -38,7 +38,7 @@ import java.net.SocketTimeoutException;
import org.apache.hc.core5.http.ContentLengthStrategy;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.ClassicHttpResponse;
-import org.apache.hc.core5.http.config.MessageConstraints;
+import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.message.BasicClassicHttpResponse;
import org.junit.Assert;
import org.junit.Before;
@@ -57,7 +57,7 @@ public class TestBHttpConnectionBase {
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- conn = new BHttpConnectionBase(1024, 1024, null, null, MessageConstraints.DEFAULT);
+ conn = new BHttpConnectionBase(1024, 1024, null, null, H1Config.DEFAULT);
}
@Test
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestChunkCoding.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestChunkCoding.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestChunkCoding.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestChunkCoding.java Mon Oct 31 17:33:27 2016
@@ -40,7 +40,7 @@ import org.apache.hc.core5.http.MessageC
import org.apache.hc.core5.http.StreamClosedException;
import org.apache.hc.core5.http.TrailerSupplier;
import org.apache.hc.core5.http.TruncatedChunkException;
-import org.apache.hc.core5.http.config.MessageConstraints;
+import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.io.SessionInputBuffer;
import org.apache.hc.core5.http.io.SessionOutputBuffer;
import org.apache.hc.core5.http.message.BasicHeader;
@@ -300,14 +300,14 @@ public class TestChunkCoding {
@Test
public void testTooLongChunkHeader() throws IOException {
final String s = "5; and some very looooong commend\r\n12345\r\n0\r\n";
- final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(16, MessageConstraints.DEFAULT);
+ final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(16, H1Config.DEFAULT);
final ByteArrayInputStream inputStream1 = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
final ChunkedInputStream in1 = new ChunkedInputStream(inbuffer1, inputStream1);
final byte[] buffer = new byte[300];
Assert.assertEquals(5, in1.read(buffer));
in1.close();
- final SessionInputBuffer inbuffer2 = new SessionInputBufferImpl(16, MessageConstraints.lineLen(10));
+ final SessionInputBuffer inbuffer2 = new SessionInputBufferImpl(16, H1Config.custom().setMaxLineLength(10).build());
final ByteArrayInputStream inputStream2 = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
final ChunkedInputStream in2 = new ChunkedInputStream(inbuffer2, inputStream2);
try {
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java Mon Oct 31 17:33:27 2016
@@ -37,10 +37,10 @@ import org.apache.hc.core5.http.ClassicH
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.LengthRequiredException;
import org.apache.hc.core5.http.NotImplementedException;
-import org.apache.hc.core5.http.config.MessageConstraints;
-import org.apache.hc.core5.http.entity.ByteArrayEntity;
-import org.apache.hc.core5.http.entity.ContentType;
-import org.apache.hc.core5.http.entity.StringEntity;
+import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.io.entity.ByteArrayEntity;
+import org.apache.hc.core5.http.io.entity.ContentType;
+import org.apache.hc.core5.http.io.entity.StringEntity;
import org.apache.hc.core5.http.impl.DefaultContentLengthStrategy;
import org.apache.hc.core5.http.message.BasicClassicHttpRequest;
import org.junit.Assert;
@@ -62,7 +62,7 @@ public class TestDefaultBHttpClientConne
MockitoAnnotations.initMocks(this);
conn = new DefaultBHttpClientConnection(1024, 1024,
null, null,
- MessageConstraints.DEFAULT,
+ H1Config.DEFAULT,
DefaultContentLengthStrategy.INSTANCE,
DefaultContentLengthStrategy.INSTANCE,
DefaultHttpRequestWriterFactory.INSTANCE,
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java Mon Oct 31 17:33:27 2016
@@ -37,9 +37,9 @@ import org.apache.hc.core5.http.ClassicH
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.NotImplementedException;
import org.apache.hc.core5.http.ProtocolException;
-import org.apache.hc.core5.http.config.MessageConstraints;
-import org.apache.hc.core5.http.entity.ContentType;
-import org.apache.hc.core5.http.entity.StringEntity;
+import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.io.entity.ContentType;
+import org.apache.hc.core5.http.io.entity.StringEntity;
import org.apache.hc.core5.http.impl.DefaultContentLengthStrategy;
import org.apache.hc.core5.http.message.BasicClassicHttpResponse;
import org.junit.Assert;
@@ -61,7 +61,7 @@ public class TestDefaultBHttpServerConne
MockitoAnnotations.initMocks(this);
conn = new DefaultBHttpServerConnection(1024, 1024,
null, null,
- MessageConstraints.DEFAULT,
+ H1Config.DEFAULT,
DefaultContentLengthStrategy.INSTANCE,
DefaultContentLengthStrategy.INSTANCE,
DefaultHttpRequestParserFactory.INSTANCE,
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestHttpService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestHttpService.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestHttpService.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestHttpService.java Mon Oct 31 17:33:27 2016
@@ -40,7 +40,7 @@ import org.apache.hc.core5.http.HttpStat
import org.apache.hc.core5.http.MethodNotSupportedException;
import org.apache.hc.core5.http.ProtocolException;
import org.apache.hc.core5.http.UnsupportedHttpVersionException;
-import org.apache.hc.core5.http.entity.InputStreamEntity;
+import org.apache.hc.core5.http.io.entity.InputStreamEntity;
import org.apache.hc.core5.http.io.HttpRequestHandler;
import org.apache.hc.core5.http.io.HttpRequestHandlerMapper;
import org.apache.hc.core5.http.io.HttpServerConnection;
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestRequestParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestRequestParser.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestRequestParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestRequestParser.java Mon Oct 31 17:33:27 2016
@@ -35,7 +35,7 @@ import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.ClassicHttpRequest;
import org.apache.hc.core5.http.MessageConstraintException;
import org.apache.hc.core5.http.UnsupportedHttpVersionException;
-import org.apache.hc.core5.http.config.MessageConstraints;
+import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.io.SessionInputBuffer;
import org.junit.Assert;
import org.junit.Test;
@@ -86,7 +86,7 @@ public class TestRequestParser {
final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
final DefaultHttpRequestParser parser = new DefaultHttpRequestParser(
- MessageConstraints.custom().setMaxEmptyLineCount(3).build());
+ H1Config.custom().setMaxEmptyLineCount(3).build());
final ClassicHttpRequest httprequest = parser.parse(inbuffer, inputStream);
Assert.assertEquals("GET", httprequest.getMethod());
@@ -108,7 +108,7 @@ public class TestRequestParser {
final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
final DefaultHttpRequestParser parser = new DefaultHttpRequestParser(
- MessageConstraints.custom().setMaxEmptyLineCount(3).build());
+ H1Config.custom().setMaxEmptyLineCount(3).build());
parser.parse(inbuffer, inputStream);
}
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestResponseParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestResponseParser.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestResponseParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestResponseParser.java Mon Oct 31 17:33:27 2016
@@ -36,7 +36,7 @@ import org.apache.hc.core5.http.ClassicH
import org.apache.hc.core5.http.MessageConstraintException;
import org.apache.hc.core5.http.NoHttpResponseException;
import org.apache.hc.core5.http.UnsupportedHttpVersionException;
-import org.apache.hc.core5.http.config.MessageConstraints;
+import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.io.SessionInputBuffer;
import org.junit.Assert;
import org.junit.Test;
@@ -87,7 +87,7 @@ public class TestResponseParser {
final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
final DefaultHttpResponseParser parser = new DefaultHttpResponseParser(
- MessageConstraints.custom().setMaxEmptyLineCount(3).build());
+ H1Config.custom().setMaxEmptyLineCount(3).build());
final ClassicHttpResponse httpresponse = parser.parse(inbuffer, inputStream);
Assert.assertEquals(200, httpresponse.getCode());
@@ -109,7 +109,7 @@ public class TestResponseParser {
final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
final DefaultHttpResponseParser parser = new DefaultHttpResponseParser(
- MessageConstraints.custom().setMaxEmptyLineCount(3).build());
+ H1Config.custom().setMaxEmptyLineCount(3).build());
parser.parse(inbuffer, inputStream);
}
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestSessionInOutBuffers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestSessionInOutBuffers.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestSessionInOutBuffers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestSessionInOutBuffers.java Mon Oct 31 17:33:27 2016
@@ -37,7 +37,7 @@ import java.nio.charset.CodingErrorActio
import java.nio.charset.StandardCharsets;
import org.apache.hc.core5.http.MessageConstraintException;
-import org.apache.hc.core5.http.config.MessageConstraints;
+import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.impl.BasicHttpTransportMetrics;
import org.apache.hc.core5.http.io.HttpTransportMetrics;
import org.apache.hc.core5.http.io.SessionInputBuffer;
@@ -398,7 +398,7 @@ public class TestSessionInOutBuffers {
final String s = "a very looooooooooooooooooooooooooooooooooooooooooong line\r\n";
final byte[] tmp = s.getBytes(StandardCharsets.US_ASCII);
// no limit
- final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(5, MessageConstraints.DEFAULT);
+ final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(5, H1Config.DEFAULT);
final InputStream inputStream1 = new ByteArrayInputStream(tmp);
final CharArrayBuffer chbuffer = new CharArrayBuffer(16);
inbuffer1.readLine(chbuffer, inputStream1);
@@ -406,7 +406,9 @@ public class TestSessionInOutBuffers {
Assert.assertEquals(60, bytesRead);
// 15 char limit
- final SessionInputBuffer inbuffer2 = new SessionInputBufferImpl(5, MessageConstraints.lineLen(15));
+ final SessionInputBuffer inbuffer2 = new SessionInputBufferImpl(5, H1Config.custom()
+ .setMaxLineLength(15)
+ .build());
final InputStream inputStream2 = new ByteArrayInputStream(tmp);
try {
chbuffer.clear();
@@ -421,7 +423,7 @@ public class TestSessionInOutBuffers {
final String s = "just a line\r\n";
final byte[] tmp = s.getBytes(StandardCharsets.US_ASCII);
// no limit
- final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(25, MessageConstraints.DEFAULT);
+ final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(25, H1Config.DEFAULT);
final InputStream inputStream1 = new ByteArrayInputStream(tmp);
final CharArrayBuffer chbuffer = new CharArrayBuffer(16);
inbuffer1.readLine(chbuffer, inputStream1);
@@ -429,7 +431,9 @@ public class TestSessionInOutBuffers {
Assert.assertEquals(13, bytesRead);
// 10 char limit
- final SessionInputBuffer inbuffer2 = new SessionInputBufferImpl(25, MessageConstraints.lineLen(10));
+ final SessionInputBuffer inbuffer2 = new SessionInputBufferImpl(25, H1Config.custom()
+ .setMaxLineLength(10)
+ .build());
final InputStream inputStream2 = new ByteArrayInputStream(tmp);
try {
chbuffer.clear();
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkDecoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkDecoder.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkDecoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkDecoder.java Mon Oct 31 17:33:27 2016
@@ -36,8 +36,9 @@ import org.apache.hc.core5.http.Connecti
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.MalformedChunkCodingException;
import org.apache.hc.core5.http.MessageConstraintException;
+import org.apache.hc.core5.http.ReadableByteChannelMock;
import org.apache.hc.core5.http.TruncatedChunkException;
-import org.apache.hc.core5.http.config.MessageConstraints;
+import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.impl.BasicHttpTransportMetrics;
import org.apache.hc.core5.http.nio.SessionInputBuffer;
import org.junit.Assert;
@@ -407,7 +408,7 @@ public class TestChunkDecoder {
new String[] {s}, StandardCharsets.US_ASCII);
final SessionInputBuffer inbuf1 = new SessionInputBufferImpl(1024, 256,
- MessageConstraints.DEFAULT, null, null);
+ H1Config.DEFAULT, null, null);
final BasicHttpTransportMetrics metrics1 = new BasicHttpTransportMetrics();
final ChunkDecoder decoder1 = new ChunkDecoder(channel1, inbuf1, metrics1);
@@ -423,7 +424,7 @@ public class TestChunkDecoder {
new String[] {s}, StandardCharsets.US_ASCII);
final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(1024, 256,
- MessageConstraints.lineLen(10), null, null);
+ H1Config.custom().setMaxLineLength(10).build(), null, null);
final BasicHttpTransportMetrics metrics2 = new BasicHttpTransportMetrics();
final ChunkDecoder decoder2 = new ChunkDecoder(channel2, inbuf2, metrics2);
@@ -444,7 +445,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel1 = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
final SessionInputBuffer inbuf1 = new SessionInputBufferImpl(1024, 256,
- MessageConstraints.DEFAULT, StandardCharsets.US_ASCII);
+ H1Config.DEFAULT, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics1 = new BasicHttpTransportMetrics();
final ChunkDecoder decoder1 = new ChunkDecoder(channel1, inbuf1, metrics1);
@@ -460,7 +461,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel2 = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(1024, 256,
- MessageConstraints.lineLen(25), StandardCharsets.US_ASCII);
+ H1Config.custom().setMaxLineLength(25).build(), StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics2 = new BasicHttpTransportMetrics();
final ChunkDecoder decoder2 = new ChunkDecoder(channel2, inbuf2, metrics2);
@@ -479,7 +480,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel1 = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
final SessionInputBuffer inbuf1 = new SessionInputBufferImpl(1024, 256,
- MessageConstraints.DEFAULT, StandardCharsets.US_ASCII);
+ H1Config.DEFAULT, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics1 = new BasicHttpTransportMetrics();
final ChunkDecoder decoder1 = new ChunkDecoder(channel1, inbuf1, metrics1);
@@ -492,7 +493,9 @@ public class TestChunkDecoder {
Assert.assertNotNull(footers);
Assert.assertEquals(1, footers.length);
- final MessageConstraints constraints = MessageConstraints.lineLen(25);
+ final H1Config constraints = H1Config.custom()
+ .setMaxLineLength(25)
+ .build();
final ReadableByteChannel channel2 = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(1024, 256,
@@ -515,7 +518,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel1 = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
final SessionInputBuffer inbuf1 = new SessionInputBufferImpl(1024, 256,
- MessageConstraints.DEFAULT, StandardCharsets.US_ASCII);
+ H1Config.DEFAULT, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics1 = new BasicHttpTransportMetrics();
final ChunkDecoder decoder1 = new ChunkDecoder(channel1, inbuf1, metrics1);
@@ -528,7 +531,7 @@ public class TestChunkDecoder {
Assert.assertNotNull(footers);
Assert.assertEquals(4, footers.length);
- final MessageConstraints constraints = MessageConstraints.custom()
+ final H1Config constraints = H1Config.custom()
.setMaxHeaderCount(3).build();
final ReadableByteChannel channel2 = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkEncoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkEncoder.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkEncoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkEncoder.java Mon Oct 31 17:33:27 2016
@@ -33,6 +33,7 @@ import java.nio.charset.StandardCharsets
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.TrailerSupplier;
+import org.apache.hc.core5.http.WritableByteChannelMock;
import org.apache.hc.core5.http.impl.BasicHttpTransportMetrics;
import org.apache.hc.core5.http.message.BasicHeader;
import org.apache.hc.core5.http.nio.SessionOutputBuffer;
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityDecoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityDecoder.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityDecoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityDecoder.java Mon Oct 31 17:33:27 2016
@@ -35,6 +35,7 @@ import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
import java.nio.charset.StandardCharsets;
+import org.apache.hc.core5.http.ReadableByteChannelMock;
import org.apache.hc.core5.http.impl.BasicHttpTransportMetrics;
import org.apache.hc.core5.http.nio.SessionInputBuffer;
import org.junit.After;
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityEncoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityEncoder.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityEncoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityEncoder.java Mon Oct 31 17:33:27 2016
@@ -34,6 +34,7 @@ import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.charset.StandardCharsets;
+import org.apache.hc.core5.http.WritableByteChannelMock;
import org.apache.hc.core5.http.impl.BasicHttpTransportMetrics;
import org.apache.hc.core5.http.nio.SessionOutputBuffer;
import org.apache.hc.core5.util.CharArrayBuffer;
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedDecoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedDecoder.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedDecoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedDecoder.java Mon Oct 31 17:33:27 2016
@@ -36,6 +36,7 @@ import java.nio.channels.ReadableByteCha
import java.nio.charset.StandardCharsets;
import org.apache.hc.core5.http.ConnectionClosedException;
+import org.apache.hc.core5.http.ReadableByteChannelMock;
import org.apache.hc.core5.http.impl.BasicHttpTransportMetrics;
import org.apache.hc.core5.http.nio.SessionInputBuffer;
import org.junit.After;
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedEncoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedEncoder.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedEncoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedEncoder.java Mon Oct 31 17:33:27 2016
@@ -34,6 +34,7 @@ import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.charset.StandardCharsets;
+import org.apache.hc.core5.http.WritableByteChannelMock;
import org.apache.hc.core5.http.impl.BasicHttpTransportMetrics;
import org.apache.hc.core5.http.nio.SessionOutputBuffer;
import org.apache.hc.core5.util.CharArrayBuffer;
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestSessionInOutBuffers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestSessionInOutBuffers.java?rev=1767339&r1=1767338&r2=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestSessionInOutBuffers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestSessionInOutBuffers.java Mon Oct 31 17:33:27 2016
@@ -44,7 +44,7 @@ import java.util.Arrays;
import java.util.Collection;
import org.apache.hc.core5.http.MessageConstraintException;
-import org.apache.hc.core5.http.config.MessageConstraints;
+import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.nio.SessionInputBuffer;
import org.apache.hc.core5.http.nio.SessionOutputBuffer;
import org.apache.hc.core5.util.ByteBufferAllocator;
@@ -139,7 +139,7 @@ public class TestSessionInOutBuffers {
final String s = "LoooooooooooooooooooooooooOOOOOOOOOOOOOOOOOOoooooooooooooooooooooong line\r\n";
final CharArrayBuffer line = new CharArrayBuffer(64);
final SessionInputBuffer inbuf1 = new SessionInputBufferImpl(128, 128,
- MessageConstraints.DEFAULT, null, this.allocator);
+ H1Config.DEFAULT, null, this.allocator);
final ReadableByteChannel channel1 = newChannel(s);
inbuf1.fill(channel1);
@@ -147,7 +147,7 @@ public class TestSessionInOutBuffers {
line.clear();
final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(128, 128,
- MessageConstraints.lineLen(10), null, this.allocator);
+ H1Config.custom().setMaxLineLength(10).build(), null, this.allocator);
final ReadableByteChannel channel2 = newChannel(s);
inbuf2.fill(channel2);
try {
@@ -162,7 +162,7 @@ public class TestSessionInOutBuffers {
final String s = "LoooooooooooooooooooooooooOOOOOOOOOOOOOOOOOOoooooooooooooooooooooong line\r\n";
final CharArrayBuffer line = new CharArrayBuffer(64);
final SessionInputBuffer inbuf1 = new SessionInputBufferImpl(32, 32,
- MessageConstraints.DEFAULT, null, this.allocator);
+ H1Config.DEFAULT, null, this.allocator);
final ReadableByteChannel channel1 = newChannel(s);
inbuf1.fill(channel1);
@@ -170,7 +170,7 @@ public class TestSessionInOutBuffers {
line.clear();
final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(32, 32,
- MessageConstraints.lineLen(10), null, this.allocator);
+ H1Config.custom().setMaxLineLength(10).build(), null, this.allocator);
final ReadableByteChannel channel2 = newChannel(s);
inbuf2.fill(channel2);
try {
Copied: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestBasicHttpEntity.java (from r1765384, httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestBasicHttpEntity.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestBasicHttpEntity.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestBasicHttpEntity.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestBasicHttpEntity.java&r1=1765384&r2=1767339&rev=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestBasicHttpEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestBasicHttpEntity.java Mon Oct 31 17:33:27 2016
@@ -25,7 +25,7 @@
*
*/
-package org.apache.hc.core5.http.entity;
+package org.apache.hc.core5.http.io.entity;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestBasicHttpEntity.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestBasicHttpEntity.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestBasicHttpEntity.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestBufferedHttpEntity.java (from r1765384, httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestBufferedHttpEntity.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestBufferedHttpEntity.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestBufferedHttpEntity.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestBufferedHttpEntity.java&r1=1765384&r2=1767339&rev=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestBufferedHttpEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestBufferedHttpEntity.java Mon Oct 31 17:33:27 2016
@@ -25,7 +25,7 @@
*
*/
-package org.apache.hc.core5.http.entity;
+package org.apache.hc.core5.http.io.entity;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestBufferedHttpEntity.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestBufferedHttpEntity.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestBufferedHttpEntity.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestByteArrayEntity.java (from r1765384, httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestByteArrayEntity.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestByteArrayEntity.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestByteArrayEntity.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestByteArrayEntity.java&r1=1765384&r2=1767339&rev=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestByteArrayEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestByteArrayEntity.java Mon Oct 31 17:33:27 2016
@@ -25,7 +25,7 @@
*
*/
-package org.apache.hc.core5.http.entity;
+package org.apache.hc.core5.http.io.entity;
import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestByteArrayEntity.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestByteArrayEntity.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestByteArrayEntity.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestByteBufferEntity.java (from r1765384, httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestByteBufferEntity.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestByteBufferEntity.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestByteBufferEntity.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestByteBufferEntity.java&r1=1765384&r2=1767339&rev=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestByteBufferEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestByteBufferEntity.java Mon Oct 31 17:33:27 2016
@@ -25,7 +25,7 @@
*
*/
-package org.apache.hc.core5.http.entity;
+package org.apache.hc.core5.http.io.entity;
import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestByteBufferEntity.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestByteBufferEntity.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestByteBufferEntity.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestContentType.java (from r1765384, httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestContentType.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestContentType.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestContentType.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestContentType.java&r1=1765384&r2=1767339&rev=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestContentType.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestContentType.java Mon Oct 31 17:33:27 2016
@@ -25,7 +25,7 @@
*
*/
-package org.apache.hc.core5.http.entity;
+package org.apache.hc.core5.http.io.entity;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestContentType.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestContentType.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestContentType.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestEntityUtils.java (from r1765384, httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/util/TestEntityUtils.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestEntityUtils.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestEntityUtils.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/util/TestEntityUtils.java&r1=1765384&r2=1767339&rev=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/util/TestEntityUtils.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestEntityUtils.java Mon Oct 31 17:33:27 2016
@@ -25,15 +25,13 @@
*
*/
-package org.apache.hc.core5.util;
+package org.apache.hc.core5.http.io.entity;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
-import org.apache.hc.core5.http.entity.BasicHttpEntity;
-import org.apache.hc.core5.http.entity.EntityUtils;
import org.junit.Assert;
import org.junit.Test;
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestEntityUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestEntityUtils.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestEntityUtils.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestFileEntity.java (from r1765384, httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestFileEntity.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestFileEntity.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestFileEntity.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestFileEntity.java&r1=1765384&r2=1767339&rev=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestFileEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestFileEntity.java Mon Oct 31 17:33:27 2016
@@ -25,7 +25,7 @@
*
*/
-package org.apache.hc.core5.http.entity;
+package org.apache.hc.core5.http.io.entity;
import java.io.ByteArrayOutputStream;
import java.io.File;
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestFileEntity.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestFileEntity.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestFileEntity.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestHttpEntityWrapper.java (from r1765384, httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestHttpEntityWrapper.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestHttpEntityWrapper.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestHttpEntityWrapper.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestHttpEntityWrapper.java&r1=1765384&r2=1767339&rev=1767339&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/entity/TestHttpEntityWrapper.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestHttpEntityWrapper.java Mon Oct 31 17:33:27 2016
@@ -25,7 +25,7 @@
*
*/
-package org.apache.hc.core5.http.entity;
+package org.apache.hc.core5.http.io.entity;
import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestHttpEntityWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestHttpEntityWrapper.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestHttpEntityWrapper.java
------------------------------------------------------------------------------
svn:mime-type = text/plain