hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r741603 - in /httpcomponents/httpcore/trunk: module-main/src/examples/org/apache/http/examples/ module-main/src/main/resources/org/apache/http/ module-nio/src/examples/org/apache/http/examples/nio/
Date Fri, 06 Feb 2009 15:57:11 GMT
Author: olegk
Date: Fri Feb  6 15:57:10 2009
New Revision: 741603

URL: http://svn.apache.org/viewvc?rev=741603&view=rev
Log:
Added elemental reverse proxy sample; added disclaimers to all samples

Added:
    httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalReverseProxy.java
Modified:
    httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpGet.java
    httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpPost.java
    httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpServer.java
    httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/PrintVersionInfo.java
    httpcomponents/httpcore/trunk/module-main/src/main/resources/org/apache/http/version.properties
    httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
    httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
    httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
    httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLClient.java
    httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java
    httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java

Modified: httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpGet.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpGet.java?rev=741603&r1=741602&r2=741603&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpGet.java
(original)
+++ httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpGet.java
Fri Feb  6 15:57:10 2009
@@ -57,6 +57,9 @@
 
 /**
  * Elemental example for executing a GET request.
+ * <p>
+ * Please note the purpose of this application is demonstrate the usage of HttpCore APIs.
+ * It is NOT intended to demonstrate the most efficient way of building an HTTP client. 
  *
  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
  *
@@ -109,7 +112,6 @@
                 BasicHttpRequest request = new BasicHttpRequest("GET", targets[i]);
                 System.out.println(">> Request URI: " + request.getRequestLine().getUri());
                 
-                context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
                 request.setParams(params);
                 httpexecutor.preProcess(request, httpproc, context);
                 HttpResponse response = httpexecutor.execute(request, conn, context);

Modified: httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpPost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpPost.java?rev=741603&r1=741602&r2=741603&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpPost.java
(original)
+++ httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpPost.java
Fri Feb  6 15:57:10 2009
@@ -62,6 +62,9 @@
 
 /**
  * Elemental example for executing a POST request.
+ * <p>
+ * Please note the purpose of this application is demonstrate the usage of HttpCore APIs.
+ * It is NOT intended to demonstrate the most efficient way of building an HTTP client. 
  *
  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
  *
@@ -123,7 +126,6 @@
                 request.setEntity(requestBodies[i]);
                 System.out.println(">> Request URI: " + request.getRequestLine().getUri());
 
-                context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
                 request.setParams(params);
                 httpexecutor.preProcess(request, httpproc, context);
                 HttpResponse response = httpexecutor.execute(request, conn, context);

Modified: httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpServer.java?rev=741603&r1=741602&r2=741603&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpServer.java
(original)
+++ httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpServer.java
Fri Feb  6 15:57:10 2009
@@ -74,6 +74,9 @@
 
 /**
  * Basic, yet fully functional and spec compliant, HTTP/1.1 file server.
+ * <p>
+ * Please note the purpose of this application is demonstrate the usage of HttpCore APIs.
+ * It is NOT intended to demonstrate the most efficient way of building an HTTP file server.

  * 
  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
  *

Added: httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalReverseProxy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalReverseProxy.java?rev=741603&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalReverseProxy.java
(added)
+++ httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalReverseProxy.java
Fri Feb  6 15:57:10 2009
@@ -0,0 +1,322 @@
+/*
+ * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpServer.java
$
+ * $Revision: 702589 $
+ * $Date: 2008-10-07 21:13:28 +0200 (Tue, 07 Oct 2008) $
+ *
+ * ====================================================================
+ * 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.http.examples;
+
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+import org.apache.http.ConnectionClosedException;
+import org.apache.http.ConnectionReuseStrategy;
+import org.apache.http.HttpClientConnection;
+import org.apache.http.HttpException;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpServerConnection;
+import org.apache.http.impl.DefaultConnectionReuseStrategy;
+import org.apache.http.impl.DefaultHttpClientConnection;
+import org.apache.http.impl.DefaultHttpResponseFactory;
+import org.apache.http.impl.DefaultHttpServerConnection;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.CoreConnectionPNames;
+import org.apache.http.params.CoreProtocolPNames;
+import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.BasicHttpContext;
+import org.apache.http.protocol.BasicHttpProcessor;
+import org.apache.http.protocol.ExecutionContext;
+import org.apache.http.protocol.HTTP;
+import org.apache.http.protocol.HttpContext;
+import org.apache.http.protocol.HttpProcessor;
+import org.apache.http.protocol.HttpRequestExecutor;
+import org.apache.http.protocol.HttpRequestHandler;
+import org.apache.http.protocol.HttpRequestHandlerRegistry;
+import org.apache.http.protocol.HttpService;
+import org.apache.http.protocol.RequestConnControl;
+import org.apache.http.protocol.RequestContent;
+import org.apache.http.protocol.RequestExpectContinue;
+import org.apache.http.protocol.RequestTargetHost;
+import org.apache.http.protocol.RequestUserAgent;
+import org.apache.http.protocol.ResponseConnControl;
+import org.apache.http.protocol.ResponseContent;
+import org.apache.http.protocol.ResponseDate;
+import org.apache.http.protocol.ResponseServer;
+
+/**
+ * Rudimentary HTTP/1.1 reverse proxy.
+ * <p>
+ * Please note the purpose of this application is demonstrate the usage of HttpCore APIs.
+ * It is NOT intended to demonstrate the most efficient way of building an HTTP reverse proxy.

+ * 
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ *
+ * @version $Revision: $
+ */
+public class ElementalReverseProxy {
+
+    private static final String HTTP_IN_CONN = "http.proxy.in-conn";
+    private static final String HTTP_OUT_CONN = "http.proxy.out-conn";
+    private static final String HTTP_CONN_KEEPALIVE = "http.proxy.conn-keepalive";
+    
+    public static void main(String[] args) throws Exception {
+        if (args.length < 1) {
+            System.err.println("Please specified target hostname and port");
+            System.exit(1);
+        }
+        String hostname = args[0];
+        int port = 80;
+        if (args.length > 1) {
+            port = Integer.parseInt(args[1]);
+        }
+        HttpHost target = new HttpHost(hostname, port);
+        
+        Thread t = new RequestListenerThread(8888, target);
+        t.setDaemon(false);
+        t.start();
+    }
+    
+    static class ProxyHandler implements HttpRequestHandler  {
+        
+        private final HttpHost target;
+        private final HttpProcessor httpproc;
+        private final HttpRequestExecutor httpexecutor;
+        private final ConnectionReuseStrategy connStrategy;
+        
+        public ProxyHandler(
+                final HttpHost target,
+                final HttpProcessor httpproc,
+                final HttpRequestExecutor httpexecutor) {
+            super();
+            this.target = target;
+            this.httpproc = httpproc;
+            this.httpexecutor = httpexecutor;
+            this.connStrategy = new DefaultConnectionReuseStrategy();
+        }
+        
+        public void handle(
+                final HttpRequest request, 
+                final HttpResponse response,
+                final HttpContext context) throws HttpException, IOException {
+            
+            HttpClientConnection conn = (HttpClientConnection) context.getAttribute(
+                    HTTP_OUT_CONN);
+
+            context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
+            context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.target);
+
+            System.out.println(">> Request URI: " + request.getRequestLine().getUri());
+
+            // Remove hop-by-hop headers
+            request.removeHeaders(HTTP.CONTENT_LEN);
+            request.removeHeaders(HTTP.TRANSFER_ENCODING);
+            request.removeHeaders(HTTP.CONN_DIRECTIVE);
+            request.removeHeaders("Keep-Alive");
+            request.removeHeaders("Proxy-Authenticate");
+            request.removeHeaders("TE");
+            request.removeHeaders("Trailers");
+            request.removeHeaders("Upgrade");
+            
+            this.httpexecutor.preProcess(request, this.httpproc, context);
+            HttpResponse targetResponse = this.httpexecutor.execute(request, conn, context);
+            this.httpexecutor.postProcess(response, this.httpproc, context);
+            
+            // Remove hop-by-hop headers
+            targetResponse.removeHeaders(HTTP.CONTENT_LEN);
+            targetResponse.removeHeaders(HTTP.TRANSFER_ENCODING);
+            targetResponse.removeHeaders(HTTP.CONN_DIRECTIVE);
+            targetResponse.removeHeaders("Keep-Alive");
+            targetResponse.removeHeaders("TE");
+            targetResponse.removeHeaders("Trailers");
+            targetResponse.removeHeaders("Upgrade");
+            
+            response.setStatusLine(targetResponse.getStatusLine());
+            response.setHeaders(targetResponse.getAllHeaders());
+            response.setEntity(targetResponse.getEntity());
+            
+            System.out.println("<< Response: " + response.getStatusLine());
+
+            boolean keepalive = this.connStrategy.keepAlive(response, context);
+            context.setAttribute(HTTP_CONN_KEEPALIVE, Boolean.valueOf(keepalive));
+        }
+        
+    }
+    
+    static class RequestListenerThread extends Thread {
+
+        private final HttpHost target;
+        private final ServerSocket serversocket;
+        private final HttpParams params; 
+        private final HttpService httpService;
+        
+        public RequestListenerThread(int port, final HttpHost target) throws IOException
{
+            this.target = target;
+            this.serversocket = new ServerSocket(port);
+            this.params = new BasicHttpParams();
+            this.params
+                .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
+                .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
+                .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
+                .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
+                .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");
+
+            // Set up HTTP protocol processor for incoming connections
+            BasicHttpProcessor inhttpproc = new BasicHttpProcessor();
+            inhttpproc.addInterceptor(new ResponseDate());
+            inhttpproc.addInterceptor(new ResponseServer());
+            inhttpproc.addInterceptor(new ResponseContent());
+            inhttpproc.addInterceptor(new ResponseConnControl());
+
+            // Set up HTTP protocol processor for outgoing connections
+            BasicHttpProcessor outhttpproc = new BasicHttpProcessor();
+            outhttpproc.addInterceptor(new RequestContent());
+            outhttpproc.addInterceptor(new RequestTargetHost());
+            outhttpproc.addInterceptor(new RequestConnControl());
+            outhttpproc.addInterceptor(new RequestUserAgent());
+            outhttpproc.addInterceptor(new RequestExpectContinue());
+
+            // Set up outgoing request executor 
+            HttpRequestExecutor httpexecutor = new HttpRequestExecutor();
+            
+            // Set up incoming request handler
+            HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
+            reqistry.register("*", new ProxyHandler(
+                    this.target, 
+                    outhttpproc, 
+                    httpexecutor));
+            
+            // Set up the HTTP service
+            this.httpService = new HttpService(
+                    inhttpproc, 
+                    new DefaultConnectionReuseStrategy(), 
+                    new DefaultHttpResponseFactory());
+            this.httpService.setParams(this.params);
+            this.httpService.setHandlerResolver(reqistry);
+        }
+        
+        public void run() {
+            System.out.println("Listening on port " + this.serversocket.getLocalPort());
+            while (!Thread.interrupted()) {
+                try {
+                    // Set up incoming HTTP connection
+                    Socket insocket = this.serversocket.accept();
+                    DefaultHttpServerConnection inconn = new DefaultHttpServerConnection();
+                    System.out.println("Incoming connection from " + insocket.getInetAddress());
+                    inconn.bind(insocket, this.params);
+
+                    // Set up outgoing HTTP connection
+                    Socket outsocket = new Socket();
+                    
+                    int timeout = this.params.getIntParameter(
+                            CoreConnectionPNames.CONNECTION_TIMEOUT, 0);
+                    outsocket.connect(new InetSocketAddress(
+                            this.target.getHostName(), this.target.getPort()), timeout);
+                    
+                    DefaultHttpClientConnection outconn = new DefaultHttpClientConnection();
+                    outconn.bind(outsocket, this.params);
+                    System.out.println("Outgoing connection to " + outsocket.getInetAddress());
+                    
+                    // Start worker thread
+                    Thread t = new ProxyThread(this.httpService, inconn, outconn);
+                    t.setDaemon(true);
+                    t.start();
+                } catch (InterruptedIOException ex) {
+                    break;
+                } catch (IOException e) {
+                    System.err.println("I/O error initialising connection thread: " 
+                            + e.getMessage());
+                    break;
+                }
+            }
+        }
+    }
+    
+    static class ProxyThread extends Thread {
+
+        private final HttpService httpservice;
+        private final HttpServerConnection inconn;
+        private final HttpClientConnection outconn;
+        
+        public ProxyThread(
+                final HttpService httpservice, 
+                final HttpServerConnection inconn,
+                final HttpClientConnection outconn) {
+            super();
+            this.httpservice = httpservice;
+            this.inconn = inconn;
+            this.outconn = outconn;
+        }
+        
+        public void run() {
+            System.out.println("New connection thread");
+            HttpContext context = new BasicHttpContext(null);
+            
+            // Bind connection objects to the execution context
+            context.setAttribute(HTTP_IN_CONN, this.inconn);
+            context.setAttribute(HTTP_OUT_CONN, this.outconn);
+            
+            try {
+                while (!Thread.interrupted()) {
+                    if (!this.inconn.isOpen()) {
+                        this.outconn.close();
+                        break;
+                    }
+                    
+                    this.httpservice.handleRequest(this.inconn, context);
+                    
+                    Boolean keepalive = (Boolean) context.getAttribute(HTTP_CONN_KEEPALIVE);
+                    if (!Boolean.TRUE.equals(keepalive)) {
+                        this.outconn.close();
+                        this.inconn.close();
+                        break;
+                    }
+                }
+            } catch (ConnectionClosedException ex) {
+                System.err.println("Client closed connection");
+            } catch (IOException ex) {
+                System.err.println("I/O error: " + ex.getMessage());
+            } catch (HttpException ex) {
+                System.err.println("Unrecoverable HTTP protocol violation: " + ex.getMessage());
+            } finally {
+                try {
+                    this.inconn.shutdown();
+                } catch (IOException ignore) {}
+                try {
+                    this.outconn.shutdown();
+                } catch (IOException ignore) {}
+            }
+        }
+
+    }
+    
+}

Modified: httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/PrintVersionInfo.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/PrintVersionInfo.java?rev=741603&r1=741602&r2=741603&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/PrintVersionInfo.java
(original)
+++ httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/PrintVersionInfo.java
Fri Feb  6 15:57:10 2009
@@ -31,10 +31,8 @@
 
 package org.apache.http.examples;
 
-
 import org.apache.http.util.VersionInfo;
 
-
 /**
  * Prints version information for debugging purposes.
  * This can be used to verify that the correct versions of the
@@ -48,12 +46,8 @@
 
     /** A default list of module packages. */
     private final static String[] MODULE_LIST = {
-        "org.apache.http",              // HttpCore (main)
-        "org.apache.http.nio",          // HttpNIO
-        "org.apache.http.nio.ssl",      // HttpNIOSSL
-        "org.apache.http.conn",         // HttpConn
-        "org.apache.http.auth",         // HttpAuth
-        "org.apache.http.cookie",       // HttpCookie
+        "org.apache.http",              // HttpCore
+        "org.apache.http.nio",          // HttpCore NIO
         "org.apache.http.client",       // HttpClient
     };
 
@@ -66,7 +60,6 @@
      *                  a list of packages for which to get version info.
      */
     public static void main(String args[]) {
-
         String[]    pckgs = (args.length > 0) ? args : MODULE_LIST;
         VersionInfo[] via = VersionInfo.loadVersionInfo(pckgs, null);
         System.out.println("version info for thread context classloader:");

Modified: httpcomponents/httpcore/trunk/module-main/src/main/resources/org/apache/http/version.properties
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/resources/org/apache/http/version.properties?rev=741603&r1=741602&r2=741603&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/resources/org/apache/http/version.properties
(original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/resources/org/apache/http/version.properties
Fri Feb  6 15:57:10 2009
@@ -16,7 +16,7 @@
 # specific language governing permissions and limitations
 # under the License.    
 #
-info.module    = HttpCore/main
+info.module    = httpcore
 info.release   = ${pom.version}
 info.timestamp = ${mvn.timestamp}
 # timestamp requires Maven 2.1

Modified: httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java?rev=741603&r1=741602&r2=741603&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
Fri Feb  6 15:57:10 2009
@@ -66,6 +66,16 @@
 import org.apache.http.protocol.RequestUserAgent;
 import org.apache.http.util.EntityUtils;
 
+/**
+ * Elemental example for executing HTTP requests using the non-blocking I/O model.
+ * <p>
+ * Please note the purpose of this application is demonstrate the usage of HttpCore APIs.
+ * It is NOT intended to demonstrate the most efficient way of building an HTTP client. 
+ *
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ * 
+ * @version $Revision$
+ */
 public class NHttpClient {
 
     public static void main(String[] args) throws Exception {

Modified: httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java?rev=741603&r1=741602&r2=741603&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
Fri Feb  6 15:57:10 2009
@@ -75,6 +75,17 @@
 import org.apache.http.protocol.ResponseDate;
 import org.apache.http.protocol.ResponseServer;
 
+/**
+ * Basic, yet fully functional and spec compliant, HTTP/1.1 file server based on the non-blocking

+ * I/O model.
+ * <p>
+ * Please note the purpose of this application is demonstrate the usage of HttpCore APIs.
+ * It is NOT intended to demonstrate the most efficient way of building an HTTP file server.

+ * 
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ *
+ * @version $Revision$
+ */
 public class NHttpFileServer {
 
     public static void main(String[] args) throws Exception {

Modified: httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java?rev=741603&r1=741602&r2=741603&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
Fri Feb  6 15:57:10 2009
@@ -83,6 +83,16 @@
 import org.apache.http.protocol.ResponseDate;
 import org.apache.http.protocol.ResponseServer;
 
+/**
+ * Rudimentary HTTP/1.1 reverse proxy based on the non-blocking I/O model.
+ * <p>
+ * Please note the purpose of this application is demonstrate the usage of HttpCore APIs.
+ * It is NOT intended to demonstrate the most efficient way of building an HTTP reverse proxy.

+ * 
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ *
+ * @version $Revision$
+ */
 public class NHttpReverseProxy {
 
     public static void main(String[] args) throws Exception {

Modified: httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLClient.java?rev=741603&r1=741602&r2=741603&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLClient.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLClient.java
Fri Feb  6 15:57:10 2009
@@ -68,6 +68,16 @@
 import org.apache.http.protocol.RequestUserAgent;
 import org.apache.http.util.EntityUtils;
 
+/**
+ * Elemental example for executing HTTPS requests using the non-blocking I/O model.
+ * <p>
+ * Please note the purpose of this application is demonstrate the usage of HttpCore APIs.
+ * It is NOT intended to demonstrate the most efficient way of building an HTTP client. 
+ *
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ * 
+ * @version $Revision$
+ */
 public class NHttpSSLClient {
 
     public static void main(String[] args) throws Exception {

Modified: httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java?rev=741603&r1=741602&r2=741603&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java
Fri Feb  6 15:57:10 2009
@@ -79,6 +79,17 @@
 import org.apache.http.protocol.ResponseServer;
 import org.apache.http.util.EntityUtils;
 
+/**
+ * Basic, yet fully functional and spec compliant, HTTPS/1.1 server based on the non-blocking

+ * I/O model.
+ * <p>
+ * Please note the purpose of this application is demonstrate the usage of HttpCore APIs.
+ * It is NOT intended to demonstrate the most efficient way of building an HTTP server. 
+ * 
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ *
+ * @version $Revision$
+ */
 public class NHttpSSLServer {
 
     public static void main(String[] args) throws Exception {

Modified: httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java?rev=741603&r1=741602&r2=741603&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
Fri Feb  6 15:57:10 2009
@@ -69,6 +69,17 @@
 import org.apache.http.protocol.ResponseServer;
 import org.apache.http.util.EntityUtils;
 
+/**
+ * Basic, yet fully functional and spec compliant, HTTP/1.1 server based on the non-blocking

+ * I/O model.
+ * <p>
+ * Please note the purpose of this application is demonstrate the usage of HttpCore APIs.
+ * It is NOT intended to demonstrate the most efficient way of building an HTTP server. 
+ * 
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ *
+ * @version $Revision$
+ */
 public class NHttpServer {
 
     public static void main(String[] args) throws Exception {



Mime
View raw message