hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1411657 - in /httpcomponents/httpcore/trunk: httpcore-nio/src/examples/org/apache/http/examples/nio/ httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ httpcore/src/examples/org/apache/http/examples/ httpcore/src/main/java/org/ap...
Date Tue, 20 Nov 2012 13:44:13 GMT
Author: olegk
Date: Tue Nov 20 13:44:12 2012
New Revision: 1411657

URL: http://svn.apache.org/viewvc?rev=1411657&view=rev
Log:
Updated HttpCore examples

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
    httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpGet.java
    httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpPost.java
    httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpServer.java
    httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalPoolingHttpGet.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpCoreContext.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java?rev=1411657&r1=1411656&r2=1411657&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
Tue Nov 20 13:44:12 2012
@@ -31,7 +31,6 @@ import java.io.InterruptedIOException;
 import java.util.concurrent.CountDownLatch;
 
 import org.apache.http.HttpHost;
-import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.HttpResponse;
 import org.apache.http.concurrent.FutureCallback;
 import org.apache.http.config.ConnectionConfig;
@@ -45,9 +44,9 @@ import org.apache.http.nio.protocol.Http
 import org.apache.http.nio.protocol.HttpAsyncRequester;
 import org.apache.http.nio.reactor.ConnectingIOReactor;
 import org.apache.http.nio.reactor.IOEventDispatch;
-import org.apache.http.protocol.BasicHttpContext;
+import org.apache.http.protocol.HttpCoreContext;
 import org.apache.http.protocol.HttpProcessor;
-import org.apache.http.protocol.ImmutableHttpProcessor;
+import org.apache.http.protocol.HttpProcessorBuilder;
 import org.apache.http.protocol.RequestConnControl;
 import org.apache.http.protocol.RequestContent;
 import org.apache.http.protocol.RequestExpectContinue;
@@ -55,19 +54,19 @@ import org.apache.http.protocol.RequestT
 import org.apache.http.protocol.RequestUserAgent;
 
 /**
- * Asynchronous HTTP/1.1 client.
+ * Minimal asynchronous HTTP/1.1 client.
  */
 public class NHttpClient {
 
     public static void main(String[] args) throws Exception {
         // Create HTTP protocol processing chain
-        HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpRequestInterceptor[]
{
+        HttpProcessor httpproc = HttpProcessorBuilder.create()
                 // Use standard client-side protocol interceptors
-                new RequestContent(),
-                new RequestTargetHost(),
-                new RequestConnControl(),
-                new RequestUserAgent("Test/1.1"),
-                new RequestExpectContinue()});
+                .add(new RequestContent())
+                .add(new RequestTargetHost())
+                .add(new RequestConnControl())
+                .add(new RequestUserAgent("Test/1.1"))
+                .add(new RequestExpectContinue()).build();
         // Create client-side HTTP protocol handler
         HttpAsyncRequestExecutor protocolHandler = new HttpAsyncRequestExecutor();
         // Create client-side I/O event dispatch
@@ -109,11 +108,12 @@ public class NHttpClient {
         final CountDownLatch latch = new CountDownLatch(targets.length);
         for (final HttpHost target: targets) {
             BasicHttpRequest request = new BasicHttpRequest("GET", "/");
+            HttpCoreContext coreContext = HttpCoreContext.create();
             requester.execute(
                     new BasicAsyncRequestProducer(target, request),
                     new BasicAsyncResponseConsumer(),
                     pool,
-                    new BasicHttpContext(),
+                    coreContext,
                     // Handle HTTP response from a callback
                     new FutureCallback<HttpResponse>() {
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java?rev=1411657&r1=1411656&r2=1411657&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
Tue Nov 20 13:44:12 2012
@@ -42,7 +42,6 @@ import javax.net.ssl.SSLContext;
 import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
-import org.apache.http.HttpResponseInterceptor;
 import org.apache.http.HttpStatus;
 import org.apache.http.MethodNotSupportedException;
 import org.apache.http.config.ConnectionConfig;
@@ -67,10 +66,10 @@ import org.apache.http.nio.protocol.Http
 import org.apache.http.nio.protocol.UriHttpAsyncRequestHandlerMapper;
 import org.apache.http.nio.reactor.IOEventDispatch;
 import org.apache.http.nio.reactor.ListeningIOReactor;
-import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
+import org.apache.http.protocol.HttpCoreContext;
 import org.apache.http.protocol.HttpProcessor;
-import org.apache.http.protocol.ImmutableHttpProcessor;
+import org.apache.http.protocol.HttpProcessorBuilder;
 import org.apache.http.protocol.ResponseConnControl;
 import org.apache.http.protocol.ResponseContent;
 import org.apache.http.protocol.ResponseDate;
@@ -95,13 +94,11 @@ public class NHttpServer {
         }
 
         // Create HTTP protocol processing chain
-        HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpResponseInterceptor[]
{
-                // Use standard server-side protocol interceptors
-                new ResponseDate(),
-                new ResponseServer(),
-                new ResponseContent(),
-                new ResponseConnControl()
-        });
+        HttpProcessor httpproc = HttpProcessorBuilder.create()
+                .add(new ResponseDate())
+                .add(new ResponseServer("Test/1.1"))
+                .add(new ResponseContent())
+                .add(new ResponseConnControl()).build();
         // Create request handler registry
         UriHttpAsyncRequestHandlerMapper reqistry = new UriHttpAsyncRequestHandlerMapper();
         // Register the default handler for all URIs
@@ -199,6 +196,8 @@ public class NHttpServer {
                 final HttpResponse response,
                 final HttpContext context) throws HttpException, IOException {
 
+            HttpCoreContext coreContext = HttpCoreContext.adapt(context);
+
             String method = request.getRequestLine().getMethod().toUpperCase(Locale.ENGLISH);
             if (!method.equals("GET") && !method.equals("HEAD") && !method.equals("POST"))
{
                 throw new MethodNotSupportedException(method + " method not supported");
@@ -226,8 +225,7 @@ public class NHttpServer {
                 System.out.println("Cannot read file " + file.getPath());
 
             } else {
-                NHttpConnection conn = (NHttpConnection) context.getAttribute(
-                        ExecutionContext.HTTP_CONNECTION);
+                NHttpConnection conn = coreContext.getConnection(NHttpConnection.class);
                 response.setStatusCode(HttpStatus.SC_OK);
                 NFileEntity body = new NFileEntity(file, ContentType.create("text/html"));
                 response.setEntity(body);

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java?rev=1411657&r1=1411656&r2=1411657&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
Tue Nov 20 13:44:12 2012
@@ -39,7 +39,6 @@ import java.nio.channels.Selector;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-import java.util.Set;
 import java.util.concurrent.ThreadFactory;
 
 import org.apache.http.annotation.ThreadSafe;

Modified: httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpGet.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpGet.java?rev=1411657&r1=1411656&r2=1411657&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpGet.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpGet.java
Tue Nov 20 13:44:12 2012
@@ -31,15 +31,14 @@ import java.net.Socket;
 
 import org.apache.http.ConnectionReuseStrategy;
 import org.apache.http.HttpHost;
-import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.HttpResponse;
 import org.apache.http.impl.DefaultBHttpClientConnection;
 import org.apache.http.impl.DefaultConnectionReuseStrategy;
 import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.protocol.HttpCoreContext;
 import org.apache.http.protocol.HttpProcessor;
+import org.apache.http.protocol.HttpProcessorBuilder;
 import org.apache.http.protocol.HttpRequestExecutor;
-import org.apache.http.protocol.ImmutableHttpProcessor;
 import org.apache.http.protocol.RequestConnControl;
 import org.apache.http.protocol.RequestContent;
 import org.apache.http.protocol.RequestExpectContinue;
@@ -56,21 +55,19 @@ import org.apache.http.util.EntityUtils;
 public class ElementalHttpGet {
 
     public static void main(String[] args) throws Exception {
-        HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpRequestInterceptor[]
{
-                // Required protocol interceptors
-                new RequestContent(),
-                new RequestTargetHost(),
-                // Recommended protocol interceptors
-                new RequestConnControl(),
-                new RequestUserAgent("Test/1.1"),
-                new RequestExpectContinue()});
+        HttpProcessor httpproc = HttpProcessorBuilder.create()
+            .add(new RequestContent())
+            .add(new RequestTargetHost())
+            .add(new RequestConnControl())
+            .add(new RequestUserAgent("Test/1.1"))
+            .add(new RequestExpectContinue()).build();
 
         HttpRequestExecutor httpexecutor = new HttpRequestExecutor();
 
-        HttpCoreContext context = new HttpCoreContext();
+        HttpCoreContext coreContext = HttpCoreContext.create();
         HttpHost host = new HttpHost("localhost", 8080);
-        context.setTargetHost(host);
-        context.setExpectContinue();
+        coreContext.setTargetHost(host);
+        coreContext.setExpectContinue();
 
         DefaultBHttpClientConnection conn = new DefaultBHttpClientConnection(8 * 1024);
         ConnectionReuseStrategy connStrategy = DefaultConnectionReuseStrategy.INSTANCE;
@@ -90,14 +87,14 @@ public class ElementalHttpGet {
                 BasicHttpRequest request = new BasicHttpRequest("GET", targets[i]);
                 System.out.println(">> Request URI: " + request.getRequestLine().getUri());
 
-                httpexecutor.preProcess(request, httpproc, context);
-                HttpResponse response = httpexecutor.execute(request, conn, context);
-                httpexecutor.postProcess(response, httpproc, context);
+                httpexecutor.preProcess(request, httpproc, coreContext);
+                HttpResponse response = httpexecutor.execute(request, conn, coreContext);
+                httpexecutor.postProcess(response, httpproc, coreContext);
 
                 System.out.println("<< Response: " + response.getStatusLine());
                 System.out.println(EntityUtils.toString(response.getEntity()));
                 System.out.println("==============");
-                if (!connStrategy.keepAlive(response, context)) {
+                if (!connStrategy.keepAlive(response, coreContext)) {
                     conn.close();
                 } else {
                     System.out.println("Connection kept alive...");

Modified: httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpPost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpPost.java?rev=1411657&r1=1411656&r2=1411657&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpPost.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpPost.java
Tue Nov 20 13:44:12 2012
@@ -33,7 +33,6 @@ import java.net.Socket;
 import org.apache.http.ConnectionReuseStrategy;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpHost;
-import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.HttpResponse;
 import org.apache.http.entity.ByteArrayEntity;
 import org.apache.http.entity.InputStreamEntity;
@@ -43,8 +42,8 @@ import org.apache.http.impl.DefaultConne
 import org.apache.http.message.BasicHttpEntityEnclosingRequest;
 import org.apache.http.protocol.HttpCoreContext;
 import org.apache.http.protocol.HttpProcessor;
+import org.apache.http.protocol.HttpProcessorBuilder;
 import org.apache.http.protocol.HttpRequestExecutor;
-import org.apache.http.protocol.ImmutableHttpProcessor;
 import org.apache.http.protocol.RequestConnControl;
 import org.apache.http.protocol.RequestContent;
 import org.apache.http.protocol.RequestExpectContinue;
@@ -61,21 +60,19 @@ import org.apache.http.util.EntityUtils;
 public class ElementalHttpPost {
 
     public static void main(String[] args) throws Exception {
-        HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpRequestInterceptor[]
{
-                // Required protocol interceptors
-                new RequestContent(),
-                new RequestTargetHost(),
-                // Recommended protocol interceptors
-                new RequestConnControl(),
-                new RequestUserAgent("Test/1.1"),
-                new RequestExpectContinue()});
+        HttpProcessor httpproc = HttpProcessorBuilder.create()
+            .add(new RequestContent())
+            .add(new RequestTargetHost())
+            .add(new RequestConnControl())
+            .add(new RequestUserAgent("Test/1.1"))
+            .add(new RequestExpectContinue()).build();
 
         HttpRequestExecutor httpexecutor = new HttpRequestExecutor();
 
-        HttpCoreContext context = new HttpCoreContext();
+        HttpCoreContext coreContext = HttpCoreContext.create();
         HttpHost host = new HttpHost("localhost", 8080);
-        context.setTargetHost(host);
-        context.setExpectContinue();
+        coreContext.setTargetHost(host);
+        coreContext.setExpectContinue();
 
         DefaultBHttpClientConnection conn = new DefaultBHttpClientConnection(8 * 1024);
         ConnectionReuseStrategy connStrategy = DefaultConnectionReuseStrategy.INSTANCE;
@@ -103,14 +100,14 @@ public class ElementalHttpPost {
                 request.setEntity(requestBodies[i]);
                 System.out.println(">> Request URI: " + request.getRequestLine().getUri());
 
-                httpexecutor.preProcess(request, httpproc, context);
-                HttpResponse response = httpexecutor.execute(request, conn, context);
-                httpexecutor.postProcess(response, httpproc, context);
+                httpexecutor.preProcess(request, httpproc, coreContext);
+                HttpResponse response = httpexecutor.execute(request, conn, coreContext);
+                httpexecutor.postProcess(response, httpproc, coreContext);
 
                 System.out.println("<< Response: " + response.getStatusLine());
                 System.out.println(EntityUtils.toString(response.getEntity()));
                 System.out.println("==============");
-                if (!connStrategy.keepAlive(response, context)) {
+                if (!connStrategy.keepAlive(response, coreContext)) {
                     conn.close();
                 } else {
                     System.out.println("Connection kept alive...");

Modified: httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpServer.java?rev=1411657&r1=1411656&r2=1411657&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpServer.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpServer.java
Tue Nov 20 13:44:12 2012
@@ -42,7 +42,6 @@ import org.apache.http.HttpEntityEnclosi
 import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
-import org.apache.http.HttpResponseInterceptor;
 import org.apache.http.HttpServerConnection;
 import org.apache.http.HttpStatus;
 import org.apache.http.MethodNotSupportedException;
@@ -53,9 +52,9 @@ import org.apache.http.impl.DefaultBHttp
 import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpProcessor;
+import org.apache.http.protocol.HttpProcessorBuilder;
 import org.apache.http.protocol.HttpRequestHandler;
 import org.apache.http.protocol.HttpService;
-import org.apache.http.protocol.ImmutableHttpProcessor;
 import org.apache.http.protocol.ResponseConnControl;
 import org.apache.http.protocol.ResponseContent;
 import org.apache.http.protocol.ResponseDate;
@@ -149,12 +148,11 @@ public class ElementalHttpServer {
             this.serversocket = new ServerSocket(port);
 
             // Set up the HTTP protocol processor
-            HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpResponseInterceptor[]
{
-                    new ResponseDate(),
-                    new ResponseServer("Test/1.1"),
-                    new ResponseContent(),
-                    new ResponseConnControl()
-            });
+            HttpProcessor httpproc = HttpProcessorBuilder.create()
+                .add(new ResponseDate())
+                .add(new ResponseServer("Test/1.1"))
+                .add(new ResponseContent())
+                .add(new ResponseConnControl()).build();
 
             // Set up request handlers
             UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper();

Modified: httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalPoolingHttpGet.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalPoolingHttpGet.java?rev=1411657&r1=1411656&r2=1411657&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalPoolingHttpGet.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalPoolingHttpGet.java
Tue Nov 20 13:44:12 2012
@@ -34,7 +34,6 @@ import org.apache.http.ConnectionReuseSt
 import org.apache.http.HttpClientConnection;
 import org.apache.http.HttpException;
 import org.apache.http.HttpHost;
-import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.HttpResponse;
 import org.apache.http.impl.DefaultConnectionReuseStrategy;
 import org.apache.http.impl.pool.BasicConnFactory;
@@ -43,8 +42,8 @@ import org.apache.http.impl.pool.BasicPo
 import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.protocol.HttpCoreContext;
 import org.apache.http.protocol.HttpProcessor;
+import org.apache.http.protocol.HttpProcessorBuilder;
 import org.apache.http.protocol.HttpRequestExecutor;
-import org.apache.http.protocol.ImmutableHttpProcessor;
 import org.apache.http.protocol.RequestConnControl;
 import org.apache.http.protocol.RequestContent;
 import org.apache.http.protocol.RequestExpectContinue;
@@ -62,14 +61,12 @@ import org.apache.http.util.EntityUtils;
 public class ElementalPoolingHttpGet {
 
     public static void main(String[] args) throws Exception {
-        final HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpRequestInterceptor[]
{
-                // Required protocol interceptors
-                new RequestContent(),
-                new RequestTargetHost(),
-                // Recommended protocol interceptors
-                new RequestConnControl(),
-                new RequestUserAgent("Test/1.1"),
-                new RequestExpectContinue()});
+        final HttpProcessor httpproc = HttpProcessorBuilder.create()
+            .add(new RequestContent())
+            .add(new RequestTargetHost())
+            .add(new RequestConnControl())
+            .add(new RequestUserAgent("Test/1.1"))
+            .add(new RequestExpectContinue()).build();
 
         final HttpRequestExecutor httpexecutor = new HttpRequestExecutor();
 
@@ -101,21 +98,21 @@ public class ElementalPoolingHttpGet {
                     BasicPoolEntry entry = future.get();
                     try {
                         HttpClientConnection conn = entry.getConnection();
-                        HttpCoreContext context = new HttpCoreContext();
-                        context.setTargetHost(this.target);
+                        HttpCoreContext coreContext = HttpCoreContext.create();
+                        coreContext.setTargetHost(this.target);
 
                         BasicHttpRequest request = new BasicHttpRequest("GET", "/");
                         System.out.println(">> Request URI: " + request.getRequestLine().getUri());
 
-                        httpexecutor.preProcess(request, httpproc, context);
-                        HttpResponse response = httpexecutor.execute(request, conn, context);
-                        httpexecutor.postProcess(response, httpproc, context);
+                        httpexecutor.preProcess(request, httpproc, coreContext);
+                        HttpResponse response = httpexecutor.execute(request, conn, coreContext);
+                        httpexecutor.postProcess(response, httpproc, coreContext);
 
                         System.out.println("<< Response: " + response.getStatusLine());
                         System.out.println(EntityUtils.toString(response.getEntity()));
 
                         ConnectionReuseStrategy connStrategy = DefaultConnectionReuseStrategy.INSTANCE;
-                        reusable = connStrategy.keepAlive(response, context);
+                        reusable = connStrategy.keepAlive(response, coreContext);
                     } catch (IOException ex) {
                         throw ex;
                     } catch (HttpException ex) {

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpCoreContext.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpCoreContext.java?rev=1411657&r1=1411656&r2=1411657&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpCoreContext.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpCoreContext.java
Tue Nov 20 13:44:12 2012
@@ -43,6 +43,10 @@ import org.apache.http.util.Args;
 @NotThreadSafe
 public class HttpCoreContext implements HttpContext, ExecutionContext {
 
+    public static HttpCoreContext create() {
+        return new HttpCoreContext(new BasicHttpContext());
+    }
+
     public static HttpCoreContext adapt(final HttpContext context) {
         Args.notNull(context, "HTTP context");
         if (context instanceof HttpCoreContext) {

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java?rev=1411657&r1=1411656&r2=1411657&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java
Tue Nov 20 13:44:12 2012
@@ -157,4 +157,9 @@ public class UriPatternMatcher<T> {
         }
     }
 
+    @Override
+    public String toString() {
+        return this.map.toString();
+    }
+
 }



Mime
View raw message