You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by ad...@apache.org on 2009/11/23 08:07:16 UTC

svn commit: r883261 [1/2] - in /mina/sandbox/adc/ahc: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/ahc/ src/main/java/org/apache/ahc/api/ src/main/java/org/apache/ahc/api/listeners/ src/main/jav...

Author: adc
Date: Mon Nov 23 07:07:13 2009
New Revision: 883261

URL: http://svn.apache.org/viewvc?rev=883261&view=rev
Log:
Initial sketch

Added:
    mina/sandbox/adc/ahc/pom.xml   (with props)
    mina/sandbox/adc/ahc/src/
    mina/sandbox/adc/ahc/src/main/
    mina/sandbox/adc/ahc/src/main/java/
    mina/sandbox/adc/ahc/src/main/java/org/
    mina/sandbox/adc/ahc/src/main/java/org/apache/
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/BadRequestException.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/ClientException.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/Cookie.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/HttpException.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/HttpHeaders.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/ServerException.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/UnauthorizedException.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookieHandler.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookiePolicy.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookieStore.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/FutureListener.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpBatch.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpBatchFuture.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpClient.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpClientFuture.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpConfig.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpConnection.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpFactory.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpListener.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpRequest.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpResponse.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpVerb.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeContent.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeInputStream.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeReadChannel.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeWriteChannel.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/Provisionable.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/listeners/
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/listeners/AcceptedListener.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/listeners/CreatedListener.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/listeners/FoundListener.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/listeners/MimeContentListener.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/listeners/OkListener.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/listeners/RedirectListener.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/listeners/SslCertificateListener.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/listeners/SuccessfulListener.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/client/
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/client/AsyncHttpClient.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/client/AsyncHttpConfig.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/client/ByteArrayBasedMimeContent.java   (with props)
    mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/client/InputStreamBasedMimeContent.java   (with props)
    mina/sandbox/adc/ahc/src/main/resources/
    mina/sandbox/adc/ahc/src/test/
    mina/sandbox/adc/ahc/src/test/java/
    mina/sandbox/adc/ahc/src/test/java/com/
    mina/sandbox/adc/ahc/src/test/java/com/acme/
    mina/sandbox/adc/ahc/src/test/java/com/acme/ahc/
    mina/sandbox/adc/ahc/src/test/java/com/acme/ahc/AcmeHttpClient.java   (with props)
    mina/sandbox/adc/ahc/src/test/java/com/acme/ahc/AcmeHttpRequest.java   (with props)
    mina/sandbox/adc/ahc/src/test/java/com/acme/ahc/AcmeMockHandle.java   (with props)
    mina/sandbox/adc/ahc/src/test/java/com/acme/ahc/listeners/
    mina/sandbox/adc/ahc/src/test/java/com/acme/ahc/listeners/AcmeSslBenchmarkListener.java   (with props)
    mina/sandbox/adc/ahc/src/test/java/com/acme/ahc/listeners/AcmeSslCertificatManager.java   (with props)
    mina/sandbox/adc/ahc/src/test/java/com/acme/ahc/listeners/BenchmarkListener.java   (with props)
    mina/sandbox/adc/ahc/src/test/java/com/acme/ahc/listeners/SslBenchmarkListener.java
    mina/sandbox/adc/ahc/src/test/java/org/
    mina/sandbox/adc/ahc/src/test/java/org/apache/
    mina/sandbox/adc/ahc/src/test/java/org/apache/ahc/
    mina/sandbox/adc/ahc/src/test/java/org/apache/ahc/api/
    mina/sandbox/adc/ahc/src/test/java/org/apache/ahc/api/ClientTest.java   (with props)
    mina/sandbox/adc/ahc/src/test/resources/

Added: mina/sandbox/adc/ahc/pom.xml
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/pom.xml?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/pom.xml (added)
+++ mina/sandbox/adc/ahc/pom.xml Mon Nov 23 07:07:13 2009
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache</groupId>
+        <artifactId>apache</artifactId>
+        <version>4</version>
+    </parent>
+
+    <groupId>org.apache.ahc</groupId>
+    <artifactId>client</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <name>Apache Asynchronous HTTP Client</name>
+    <packaging>jar</packaging>
+
+    <build>
+        <plugins>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <encoding>UTF-8</encoding>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                    <debug>true</debug>
+                    <optimize>true</optimize>
+                    <showDeprecations>true</showDeprecations>
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.5</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.mina</groupId>
+            <artifactId>mina-core</artifactId>
+            <version>2.0.0-RC1</version>
+        </dependency>
+
+    </dependencies>
+
+</project>

Propchange: mina/sandbox/adc/ahc/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: mina/sandbox/adc/ahc/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/BadRequestException.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/BadRequestException.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/BadRequestException.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/BadRequestException.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,48 @@
+/**
+ * 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.
+ */
+package org.apache.ahc;
+
+import org.apache.ahc.api.HttpConnection;
+
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public final class BadRequestException extends ClientException
+{
+    public BadRequestException(HttpConnection connection, short code)
+    {
+        super(connection, BAD_REQUEST);
+    }
+
+    public BadRequestException(HttpConnection connection, short code, String message)
+    {
+        super(connection, BAD_REQUEST, message);
+    }
+
+    public BadRequestException(HttpConnection connection, short code, String message, Throwable cause)
+    {
+        super(connection, BAD_REQUEST, message, cause);
+    }
+
+    public BadRequestException(HttpConnection connection, short code, Throwable cause)
+    {
+        super(connection, BAD_REQUEST, cause);
+    }
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/BadRequestException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/BadRequestException.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/BadRequestException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/ClientException.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/ClientException.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/ClientException.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/ClientException.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,51 @@
+/**
+ * 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.
+ */
+package org.apache.ahc;
+
+import org.apache.ahc.api.HttpConnection;
+
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public abstract class ClientException extends HttpException
+{
+    public static final short BAD_REQUEST = 400;
+    public static final short UNAUTHORIZED = 401;
+
+    protected ClientException(HttpConnection connection, short code)
+    {
+        super(connection, code);
+    }
+
+    protected ClientException(HttpConnection connection, short code, String message)
+    {
+        super(connection, code, message);
+    }
+
+    protected ClientException(HttpConnection connection, short code, String message, Throwable cause)
+    {
+        super(connection, code, message, cause);
+    }
+
+    protected ClientException(HttpConnection connection, short code, Throwable cause)
+    {
+        super(connection, code, cause);
+    }
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/ClientException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/ClientException.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/ClientException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/Cookie.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/Cookie.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/Cookie.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/Cookie.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,330 @@
+/**
+ * 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.
+ */
+package org.apache.ahc;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public final class Cookie implements Serializable, Comparable<Cookie>, Cloneable
+{
+    private final String name;
+    private String value;
+    private String domain;
+    private String path;
+    private int version;
+    private boolean secure;
+    private int maxAge;
+    private String comment;
+    private long createdDate;
+    private long expirationDate;
+    private boolean httpOnly;
+
+    public Cookie(String name, String value, String domain, String path, int version, boolean secure, int maxAge, String comment, long createdDate, long expirationDate, boolean httpOnly)
+    {
+        if (name == null) throw new IllegalArgumentException("Name cannot be null");
+
+        this.name = name;
+        this.value = value;
+        this.domain = domain;
+        this.path = path;
+        this.version = version;
+        this.secure = secure;
+        this.maxAge = maxAge;
+        this.comment = comment;
+        this.createdDate = createdDate;
+        this.expirationDate = expirationDate;
+        this.httpOnly = httpOnly;
+    }
+
+    /**
+     * Returns the name of this cookie
+     *
+     * @return The cookie name
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    /**
+     * Returns the value of this cookie
+     *
+     * @return The cookie value - or <code>null</code> if this cookie does not have
+     *         a value
+     */
+    public String getValue()
+    {
+        return value;
+    }
+
+    public void setValue(String value)
+    {
+        this.value = value;
+    }
+
+    /**
+     * Returns the domain of this cookie.
+     *
+     * @return the domain of this cookie
+     */
+    public String getDomain()
+    {
+        return domain;
+    }
+
+    public void setDomain(String domain)
+    {
+        this.domain = domain;
+    }
+
+    /**
+     * Returns the path on the server to which the client returns this cookie.
+     *
+     * @return The path
+     */
+    public String getPath()
+    {
+        return path;
+    }
+
+    public void setPath(String path)
+    {
+        this.path = path;
+    }
+
+    /**
+     * Returns the cookie version number. The default (if not specified) is 0
+     *
+     * @return The version number
+     */
+    public int getVersion()
+    {
+        return version;
+    }
+
+    public void setVersion(int version)
+    {
+        this.version = version;
+    }
+
+    /**
+     * Returns if this cookie is marked as "secure".
+     * Secure cookies should be sent back by a client over a transport as least as
+     * secure as that upon which they were received
+     *
+     * @return <tt>true</tt> if this cookie is marked as "secure", <tt>false</tt> otherwise.
+     */
+    public boolean isSecure()
+    {
+        return secure;
+    }
+
+    public void setSecure(boolean secure)
+    {
+        this.secure = secure;
+    }
+
+    /**
+     * Returns the maximum age of this cookie in seconds.
+     *
+     * @return the maximum age of this cookie in seconds.
+     */
+    public int getMaxAge()
+    {
+        return maxAge;
+    }
+
+    public void setMaxAge(int maxAge)
+    {
+        this.maxAge = maxAge;
+    }
+
+    /**
+     * Returns the comment of this cookie.  Comments are not supported by version 0 cookies.
+     *
+     * @return <tt>null</tt> if no comment is specified
+     */
+    public String getComment()
+    {
+        return comment;
+    }
+
+    public void setComment(String comment)
+    {
+        this.comment = comment;
+    }
+
+    /**
+     * Returns the date the cookie was create.  This value is not included in the HTTP
+     * header.  This is a convenience method for clients to determine when the cookie
+     * will expire.
+     *
+     * @return the date the cookie was created in milliseconds after Jan. 1, 1970
+     */
+    public long getCreatedDate()
+    {
+        return createdDate;
+    }
+
+    public void setCreatedDate(long createdDate)
+    {
+        this.createdDate = createdDate;
+    }
+
+    /**
+     * Returns the date the expiration date of the cookie.  This value is calculated
+     * based on the the values returned by {@link #getMaxAge()} and
+     * {@link #getCreatedDate()}.
+     *
+     * @return the expiration date of the cookie in milliseconds after Jan. 1, 1970.
+     */
+    public long getExpirationDate()
+    {
+        return expirationDate;
+    }
+
+    public void setExpirationDate(long expirationDate)
+    {
+        this.expirationDate = expirationDate;
+    }
+
+    /**
+     * Returns if this cookie is marked as "HTTP only".
+     * See http://www.owasp.org/index.php/HTTPOnly.
+     *
+     * @return <tt>true</tt> if this cookie is marked as "HTTP only", <tt>false</tt> otherwise.
+     */
+    public boolean isHttpOnly()
+    {
+        return httpOnly;
+    }
+
+    public void setHttpOnly(boolean httpOnly)
+    {
+        this.httpOnly = httpOnly;
+    }
+
+    public int compareTo(Cookie o)
+    {
+        int result;
+
+        // Compare the name first.
+        result = name.compareTo(o.getName());
+        if (result != 0) return result;
+
+        // and then path
+        if (path == null)
+        {
+            if (o.getPath() != null) return -1;
+        }
+        else
+        {
+            result = path.compareTo(o.getPath());
+        }
+        if (result != 0) return result;
+
+        // and then domain
+        if (domain == null)
+        {
+            if (o.getDomain() != null) return -1;
+        }
+        else
+        {
+            result = domain.compareTo(o.getDomain());
+        }
+
+        return result;
+    }
+
+    /**
+     * Constructs cookies from set-cookie or set-cookie2 header string.
+     * RFC 2965 section 3.2.2 set-cookie2 syntax indicates that one header line
+     * may contain more than one cookie definitions, so this is a static
+     * utility method instead of another constructor.
+     *
+     * @param header {@link String} specifying the set-cookie header. The
+     *               header should start with "set-cookie", or "set-cookie2" token; or it
+     *               should have no leading token at all.
+     * @return a List of cookie parsed from header line string
+     * @throws IllegalArgumentException if header string violates the cookie specification's syntax, or the cookie name contains llegal characters, or the cookie name is one of the tokens reserved for use by the cookie protocol
+     * @throws NullPointerException     if the argument is null
+     */
+    public static List<Cookie> parse(String header)
+    {
+        List<Cookie> result = new ArrayList<Cookie>();
+
+        // todo : parse
+
+        return result;
+    }
+
+    public static boolean domainMatches(String domain, String host)
+    {
+        if (domain == null) return false;
+
+        if (host.equals(domain))
+        {
+            return true;
+        }
+        if (!domain.startsWith("."))
+        {
+            domain = '.' + domain;
+        }
+        return host.endsWith(domain) || host.equals(domain.substring(1));
+    }
+
+    @Override
+    public boolean equals(Object o)
+    {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        Cookie cookie = (Cookie)o;
+
+        if (!name.equals(cookie.name)) return false;
+        if (domain != null ? !domain.equals(cookie.domain) : cookie.domain != null) return false;
+        return !(path != null ? !path.equals(cookie.path) : cookie.path != null);
+    }
+
+    @Override
+    public int hashCode()
+    {
+        int result = name.hashCode();
+        result = 31 * result + (domain != null ? domain.hashCode() : 0);
+        result = 31 * result + (path != null ? path.hashCode() : 0);
+        return result;
+    }
+
+    @Override
+    public String toString()
+    {
+        return "name=" + getName() +
+               " value=" + getValue() +
+               " domain=" + getDomain() +
+               " path=" + getPath() +
+               " maxAge=" + getMaxAge() +
+               " secure=" + isSecure() +
+               " httpOnly=" + isHttpOnly();
+    }
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/Cookie.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/Cookie.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/Cookie.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/HttpException.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/HttpException.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/HttpException.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/HttpException.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,68 @@
+/**
+ * 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.
+ */
+package org.apache.ahc;
+
+import org.apache.ahc.api.HttpConnection;
+
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public abstract class HttpException extends Exception
+{
+    private final HttpConnection connection;
+    private final short code;
+
+    protected HttpException(HttpConnection connection, short code)
+    {
+        this.connection = connection;
+        this.code = code;
+    }
+
+    protected HttpException(HttpConnection connection, short code, String message)
+    {
+        super(message);
+        this.connection = connection;
+        this.code = code;
+    }
+
+    protected HttpException(HttpConnection connection, short code, String message, Throwable cause)
+    {
+        super(message, cause);
+        this.connection = connection;
+        this.code = code;
+    }
+
+    protected HttpException(HttpConnection connection, short code, Throwable cause)
+    {
+        super(cause);
+        this.connection = connection;
+        this.code = code;
+    }
+
+    public HttpConnection getConnection()
+    {
+        return connection;
+    }
+
+    public short getCode()
+    {
+        return code;
+    }
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/HttpException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/HttpException.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/HttpException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/HttpHeaders.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/HttpHeaders.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/HttpHeaders.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/HttpHeaders.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,101 @@
+/**
+ * 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.
+ */
+package org.apache.ahc;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public class HttpHeaders implements Map<String, List<String>>
+{
+    private final Map<String, List<String>> map = new HashMap<String, List<String>>();
+
+    public HttpHeaders()
+    {
+    }
+
+    public HttpHeaders(HttpHeaders headers)
+    {
+        for (Map.Entry<String, List<String>> entry : headers.map.entrySet())
+        {
+            map.put(entry.getKey(), new ArrayList<String>(entry.getValue()));
+        }
+    }
+
+    public int size() { return map.size(); }
+
+    public boolean isEmpty() { return map.isEmpty(); }
+
+    public boolean containsKey(Object key) { return map.containsKey(key); }
+
+    public boolean containsValue(Object value) { return map.containsValue(value); }
+
+    public List<String> get(Object key) { return map.get(key); }
+
+    public List<String> put(String key, List<String> value) { return map.put(key, value); }
+
+    public List<String> put(String key, String value)
+    {
+        List<String> values = map.get(key);
+
+        if (values == null) map.put(key, values = new ArrayList<String>());
+
+        List<String> old = new ArrayList<String>(values);
+
+        values.add(value);
+
+        return old;
+    }
+
+    public List<String> remove(Object key) { return map.remove(key); }
+
+    public void putAll(Map<? extends String, ? extends List<String>> t) { map.putAll(t); }
+
+    public void clear() { map.clear(); }
+
+    public Set<String> keySet() { return map.keySet(); }
+
+    public Collection<List<String>> values() { return map.values(); }
+
+    public Set<Entry<String, List<String>>> entrySet() { return map.entrySet(); }
+
+    @Override
+    public boolean equals(Object o)
+    {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        HttpHeaders that = (HttpHeaders)o;
+
+        return map.equals(that.map);
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return map.hashCode();
+    }
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/HttpHeaders.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/HttpHeaders.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/HttpHeaders.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/ServerException.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/ServerException.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/ServerException.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/ServerException.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,48 @@
+/**
+ * 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.
+ */
+package org.apache.ahc;
+
+import org.apache.ahc.api.HttpConnection;
+
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public abstract class ServerException extends HttpException
+{
+    protected ServerException(HttpConnection connection, short code)
+    {
+        super(connection, code);
+    }
+
+    protected ServerException(HttpConnection connection, short code, String message)
+    {
+        super(connection, code, message);
+    }
+
+    protected ServerException(HttpConnection connection, short code, String message, Throwable cause)
+    {
+        super(connection, code, message, cause);
+    }
+
+    protected ServerException(HttpConnection connection, short code, Throwable cause)
+    {
+        super(connection, code, cause);
+    }
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/ServerException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/ServerException.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/ServerException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/UnauthorizedException.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/UnauthorizedException.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/UnauthorizedException.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/UnauthorizedException.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,48 @@
+/**
+ * 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.
+ */
+package org.apache.ahc;
+
+import org.apache.ahc.api.HttpConnection;
+
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public final class UnauthorizedException extends ClientException
+{
+    protected UnauthorizedException(HttpConnection connection)
+    {
+        super(connection, UNAUTHORIZED);
+    }
+
+    protected UnauthorizedException(HttpConnection connection, String message)
+    {
+        super(connection, UNAUTHORIZED, message);
+    }
+
+    protected UnauthorizedException(HttpConnection connection, String message, Throwable cause)
+    {
+        super(connection, UNAUTHORIZED, message, cause);
+    }
+
+    protected UnauthorizedException(HttpConnection connection, Throwable cause)
+    {
+        super(connection, UNAUTHORIZED, cause);
+    }
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/UnauthorizedException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/UnauthorizedException.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/UnauthorizedException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookieHandler.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookieHandler.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookieHandler.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookieHandler.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,82 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * A CookieHandler object provides a callback mechanism to hook up a HTTP state
+ * management policy implementation into the HTTP protocol handler. The HTTP
+ * state management mechanism specifies a way to create a stateful session with
+ * HTTP requests and responses.
+ * <p/>
+ * A system-wide {@link CookieHandler} that to used by the HTTP protocol
+ * handler can be registered by doing a {@link #setDefault(CookieHandler)}. The
+ * currently registered {@link CookieHandler} can be retrieved by calling
+ * {@link #getDefault()}. For more information on HTTP state management, see
+ * RFC 2965: HTTP State Management Mechanism
+ *
+ * @author Yingxian Wang
+ * @version $Revision$ $Date: $
+ */
+public abstract class CookieHandler implements HttpConfig
+{
+    private static CookieHandler cookieHandler;
+
+    public static CookieHandler getDefault()
+    {
+        return cookieHandler;
+    }
+
+    public static void setDefault(CookieHandler cookieHandler)
+    {
+        CookieHandler.cookieHandler = cookieHandler;
+    }
+
+    /**
+     * Gets all the applicable cookies from a cookie cache for the specified
+     * uri in the request header. HTTP protocol implementers should make sure
+     * that this method is called after all request headers related to choosing
+     * cookies are added, and before the request is sent.
+     *
+     * @param uri            a {@link URI} to send cookies to in a request
+     * @param requestHeaders a {@link Map} from request header field names to lists of field values representing the current request
+     * @return an immutable map from state management headers, with field names "Cookie" or "Cookie2" to a list of cookies containing state information
+     * @throws IOException              if an I/O error occurs
+     * @throws IllegalArgumentException if either argument is null
+     * @see #put(URI, Map<String, List<String>>)
+     */
+    public abstract Map<String, List<String>> get(URI uri, Map<String, List<String>> requestHeaders) throws IOException;
+
+    /**
+     * Sets all the applicable cookies, examples are response header fields
+     * that are named <tt>Set-Cookie2</tt>, present in the response headers
+     * into a cookie cache.
+     *
+     * @param uri             a {@link URI} where the cookies come from
+     * @param responseHeaders an immutable map from field names to lists of field values representing the response header fields returned
+     * @throws IOException              if an I/O error occurs
+     * @throws IllegalArgumentException if either argument is null
+     */
+    public abstract void put(URI uri, Map<String, List<String>> responseHeaders) throws IOException;
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookieHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookieHandler.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookieHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookiePolicy.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookiePolicy.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookiePolicy.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookiePolicy.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,73 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+import java.net.URI;
+
+import org.apache.ahc.Cookie;
+
+
+/**
+ * CookiePolicy implementations decide which cookies should be accepted and
+ * which should be rejected. Three pre-defined policy implementations are
+ * provided, namely ACCEPT_ALL, ACCEPT_NONE and ACCEPT_ORIGINAL_SERVER.
+ * <p/>
+ * See RFC 2965 sec. 3.3 & 7 for more detail.
+ *
+ * @author Edward Wang
+ * @version $Revision$ $Date: $
+ */
+public interface CookiePolicy extends HttpConfig
+{
+    /**
+     * One pre-defined policy which accepts all cookies.
+     */
+    public final static CookiePolicy ACCEPT_ALL = new CookiePolicy()
+    {
+        public boolean shouldAccept(URI uri, Cookie cookie) { return true; }
+    };
+
+    /**
+     * One pre-defined policy which accepts no cookies.
+     */
+    public final static CookiePolicy ACCEPT_NONE = new CookiePolicy()
+    {
+        public boolean shouldAccept(URI uri, Cookie cookie) { return false; }
+    };
+
+    /**
+     * One pre-defined policy which only accepts cookies from original server.
+     */
+    public final static CookiePolicy ACCEPT_ORIGINAL_SERVER = new CookiePolicy()
+    {
+        public boolean shouldAccept(URI uri, Cookie cookie)
+        {
+            return Cookie.domainMatches(cookie.getDomain(), uri.getHost());
+        }
+    };
+
+    /**
+     * Will be called to see whether or not this cookie should be accepted.
+     *
+     * @param uri    the URI to consult accept policy with
+     * @param cookie the {@link Cookie} object in question
+     * @return <tt>true</tt> if this cookie should be accepted; otherwise, <tt>false</tt>
+     */
+    public boolean shouldAccept(URI uri, Cookie cookie);
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookiePolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookiePolicy.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookiePolicy.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookieStore.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookieStore.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookieStore.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookieStore.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,43 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+import java.net.URI;
+import java.util.List;
+
+import org.apache.ahc.Cookie;
+
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public interface CookieStore extends HttpConfig
+{
+    void add(URI uri, Cookie cookie);
+
+    List<Cookie> get(URI uri);
+
+    List<Cookie> getCookies();
+
+    List<URI> getURIs();
+
+    boolean remove(URI uri, Cookie cookie);
+
+    boolean removeAll();
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookieStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookieStore.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/CookieStore.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/FutureListener.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/FutureListener.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/FutureListener.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/FutureListener.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public interface FutureListener<V>
+{
+    void exception(Throwable t);
+
+    void completed(V result);
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/FutureListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/FutureListener.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/FutureListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpBatch.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpBatch.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpBatch.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpBatch.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,44 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+import java.util.Map;
+
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public interface HttpBatch extends Provisionable
+{
+    HttpBatch send(HttpRequest request);
+
+    HttpBatch get(String url);
+
+    HttpBatch post(String url, Map<String, String> map, MimeContent... content);
+
+    HttpBatchFuture submit();
+
+    HttpBatch equipWith(HttpListener listener);
+
+    HttpBatch equipWith(String key, Object value);
+
+    HttpBatch push();
+
+    HttpBatch pop();
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpBatch.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpBatch.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpBatch.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpBatchFuture.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpBatchFuture.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpBatchFuture.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpBatchFuture.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,90 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public interface HttpBatchFuture
+{
+    HttpBatchFuture register(FutureListener<List<HttpResponse>> listener);
+
+    /**
+     * Attempts to cancel execution of this task.  This attempt will
+     * fail if the task has already completed, already been cancelled,
+     * or could not be cancelled for some other reason. If successful,
+     * and this task has not started when <tt>cancel</tt> is called,
+     * this task should never run.  If the task has already started,
+     * then the <tt>mayInterruptIfRunning</tt> parameter determines
+     * whether the thread executing this task should be interrupted in
+     * an attempt to stop the task.
+     *
+     * @param mayInterruptIfRunning <tt>true</tt> if the thread executing this
+     *                              task should be interrupted; otherwise, in-progress tasks are allowed
+     *                              to complete
+     * @return <tt>false</tt> if the task could not be cancelled,
+     *         typically because it has already completed normally;
+     *         <tt>true</tt> otherwise
+     */
+    boolean cancel(boolean mayInterruptIfRunning);
+
+    /**
+     * Returns <tt>true</tt> if this task was cancelled before it completed
+     * normally.
+     *
+     * @return <tt>true</tt> if task was cancelled before it completed
+     */
+    boolean isCancelled();
+
+    /**
+     * Returns <tt>true</tt> if this task completed.
+     * <p/>
+     * Completion may be due to normal termination, an exception, or
+     * cancellation -- in all of these cases, this method will return
+     * <tt>true</tt>.
+     *
+     * @return <tt>true</tt> if this task completed.
+     */
+    boolean isDone();
+
+    /**
+     * Waits if necessary for the computation to complete, and then
+     * retrieves its result.
+     *
+     * @return the computed result
+     * @throws java.util.concurrent.CancellationException
+     *                              if the computation was cancelled
+     * @throws java.util.concurrent.ExecutionException
+     *                              if the computation threw an
+     *                              exception
+     * @throws InterruptedException if the current thread was interrupted
+     *                              while waiting
+     * @throws java.util.concurrent.TimeoutException
+     *                              if the wait timed out
+     */
+    List<HttpResponse> get() throws InterruptedException, ExecutionException, TimeoutException;
+}
+
+
+

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpBatchFuture.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpBatchFuture.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpBatchFuture.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpClient.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpClient.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpClient.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpClient.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,56 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+import java.net.InetAddress;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public interface HttpClient extends Provisionable
+{
+    void addConfig(HttpConfig config);
+
+    HttpClientFuture<HttpResponse> send(HttpRequest request);
+
+    HttpClientFuture<HttpResponse> get(String url);
+
+    HttpClientFuture<HttpResponse> post(String url, Map<String, String> map, MimeContent... content);
+
+    HttpClientFuture<HttpResponse> put(String url, Map<String, String> map, MimeContent... content);
+
+    HttpClientFuture<HttpResponse> delete(String url);
+
+    HttpBatch batch();
+
+    HttpBatch batch(int duration, TimeUnit timeUnit);
+
+    HttpConnection open(InetAddress address, int port);
+
+    HttpClient equipWith(String key, Object value);
+
+    HttpClient equipWith(HttpListener listener);
+
+    HttpClient push();
+
+    HttpClient pop();
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpClient.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpClient.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpClientFuture.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpClientFuture.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpClientFuture.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpClientFuture.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,183 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicReference;
+
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public class HttpClientFuture<V> implements Future<V>
+{
+    private final CountDownLatch latch = new CountDownLatch(1);
+    private final List<FutureListener<V>> listeners = new ArrayList<FutureListener<V>>();
+    private final AtomicReference<Object> result = new AtomicReference<Object>();
+    private final AtomicReference<FutureResultOwner<V>> owner = new AtomicReference<FutureResultOwner<V>>();
+    private volatile boolean canceled;
+
+    public HttpClientFuture(FutureResultOwner<V> owner)
+    {
+        this.owner.set(owner);
+
+        owner.set(new ChangeListener<V>()
+        {
+            public void exception(Throwable t)
+            {
+                assert !isDone();
+
+                synchronized (latch)
+                {
+                    result.set(t);
+                    latch.countDown();
+                }
+
+                for (FutureListener<V> listener : listeners)
+                {
+                    listener.exception(t);
+                }
+
+                listeners.clear();
+                HttpClientFuture.this.owner.set(null);
+            }
+
+            public void set(V value)
+            {
+                assert !isDone();
+
+                synchronized (latch)
+                {
+                    result.set(value);
+                    latch.countDown();
+                }
+
+                for (FutureListener<V> listener : listeners)
+                {
+                    listener.completed(value);
+                }
+
+                listeners.clear();
+                HttpClientFuture.this.owner.set(null);
+            }
+        });
+    }
+
+    @SuppressWarnings({"unchecked"})
+    public HttpClientFuture<V> register(FutureListener<V> listener)
+    {
+        synchronized (latch)
+        {
+            if (!isDone())
+            {
+                listeners.add(listener);
+                listener = null;
+            }
+        }
+
+        if (listener != null)
+        {
+            Object object = result.get();
+            if (object instanceof Throwable)
+            {
+                listener.exception((Throwable)object);
+            }
+            else
+            {
+                listener.completed((V)object);
+            }
+        }
+
+        return this;
+    }
+
+    public boolean cancel(boolean mayInterruptIfRunning)
+    {
+        synchronized (latch)
+        {
+            boolean c = !canceled && !isDone() && owner.get().cancel(mayInterruptIfRunning);
+
+            if (c) canceled = true;
+
+            return canceled;
+        }
+    }
+
+    public boolean isCancelled()
+    {
+        return canceled;
+    }
+
+    public boolean isDone()
+    {
+        return latch.getCount() == 0;
+    }
+
+    @SuppressWarnings({"unchecked"})
+    public V get() throws InterruptedException, ExecutionException
+    {
+        latch.await();
+
+        Object object = result.get();
+        if (object instanceof Throwable)
+        {
+            throw new ExecutionException((Throwable)object);
+        }
+        else
+        {
+            return (V)object;
+        }
+    }
+
+    @SuppressWarnings({"unchecked"})
+    public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
+    {
+        if (!latch.await(timeout, unit)) throw new TimeoutException();
+
+        Object object = result.get();
+        if (object instanceof Throwable)
+        {
+            throw new ExecutionException((Throwable)object);
+        }
+        else
+        {
+            return (V)object;
+        }
+    }
+
+    public interface FutureResultOwner<V>
+    {
+        void set(ChangeListener<V> listener);
+
+        boolean cancel(boolean mayInterruptIfRunning);
+    }
+
+    public interface ChangeListener<V>
+    {
+        void exception(Throwable t);
+
+        void set(V value);
+    }
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpClientFuture.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpClientFuture.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpClientFuture.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpConfig.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpConfig.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpConfig.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpConfig.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,26 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public interface HttpConfig
+{
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpConfig.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpConfig.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpConnection.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpConnection.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpConnection.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpConnection.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,37 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public interface HttpConnection extends Provisionable
+{
+    HttpClient getClient();
+
+    HttpConnection equipWith(HttpListener listener);
+
+    HttpConnection equipWith(String key, Object value);
+
+    HttpConnection push();
+
+    HttpConnection pop();
+
+    HttpClientFuture<HttpResponse> send(HttpRequest request);
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpConnection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpConnection.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpConnection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpFactory.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpFactory.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpFactory.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpFactory.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,37 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public interface HttpFactory extends Provisionable
+{
+    void addConfig(HttpConfig config);
+
+    HttpClient generateClient();
+
+    HttpFactory equipWith(String key, Object value);
+
+    HttpFactory equipWith(HttpListener listener);
+
+    HttpFactory push();
+
+    HttpFactory pop();
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpFactory.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpListener.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpListener.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpListener.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpListener.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+import java.util.EventListener;
+
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public interface HttpListener extends EventListener
+{
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpListener.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpRequest.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpRequest.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpRequest.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpRequest.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,160 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.ahc.HttpHeaders;
+import org.apache.ahc.api.listeners.MimeContentListener;
+
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public class HttpRequest
+{
+    private URL url;
+    private HttpVerb verb;
+    private HttpHeaders headers;
+    private final List<MimeContent> mimeContent = new ArrayList<MimeContent>();
+    private final List<MimeContentListener> listeners = new ArrayList<MimeContentListener>();
+    private int timeout;
+    private TimeUnit timeUnit;
+
+    public HttpRequest()
+    {
+    }
+
+    public HttpRequest(URL url, HttpVerb verb, HttpHeaders headers, List<MimeContent> mimeContent, List<MimeContentListener> listeners, int timeout, TimeUnit timeUnit)
+    {
+        try
+        {
+            this.url = new URL(url.toString());
+            this.verb = verb;
+            this.headers = new HttpHeaders(headers);
+            this.mimeContent.addAll(mimeContent);
+            this.listeners.addAll(listeners);
+            this.timeout = timeout;
+            this.timeUnit = timeUnit;
+        }
+        catch (MalformedURLException ignore)
+        {
+        }
+    }
+
+    public HttpRequest(HttpRequest httpRequest)
+    {
+        this(httpRequest.getUrl(), httpRequest.getVerb(), httpRequest.getHeaders(), httpRequest.getMimeContent(), httpRequest.getListeners(), httpRequest.getTimeout(), httpRequest.getTimeUnit());
+    }
+
+    public HttpRequest(URL url)
+    {
+        this.url = url;
+    }
+
+    public URL getUrl()
+    {
+        return url;
+    }
+
+    public HttpRequest setUrl(URL url)
+    {
+        this.url = url;
+
+        return this;
+    }
+
+    public HttpVerb getVerb()
+    {
+        return verb;
+    }
+
+    public HttpRequest setVerb(HttpVerb verb)
+    {
+        this.verb = verb;
+
+        return this;
+    }
+
+    public HttpHeaders getHeaders()
+    {
+        return headers;
+    }
+
+    public HttpRequest setHeaders(HttpHeaders headers)
+    {
+        this.headers = headers;
+
+        return this;
+    }
+
+    public List<MimeContent> getMimeContent()
+    {
+        return mimeContent;
+    }
+
+    public HttpRequest addMimeContent(MimeContent content)
+    {
+        mimeContent.add(content);
+
+        return this;
+    }
+
+    public HttpRequest addMimeContent(MimeContent... contentSet)
+    {
+        mimeContent.addAll(Arrays.asList(contentSet));
+
+        return this;
+    }
+
+    public int getTimeout()
+    {
+        return timeout;
+    }
+
+    public TimeUnit getTimeUnit()
+    {
+        return timeUnit;
+    }
+
+    public HttpRequest setTimeOut(int timeout, TimeUnit timeUnit)
+    {
+        this.timeout = timeout;
+        this.timeUnit = timeUnit;
+
+        return this;
+    }
+
+    public List<MimeContentListener> getListeners()
+    {
+        return listeners;
+    }
+
+    public HttpRequest addMimeContentListener(MimeContentListener listener)
+    {
+        listeners.add(listener);
+
+        return this;
+    }
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpRequest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpRequest.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpRequest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpResponse.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpResponse.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpResponse.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpResponse.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,39 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+import java.io.InputStream;
+import java.util.List;
+
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public interface HttpResponse
+{
+    HttpConnection getConnection();
+
+    Object getEquip(String key);
+
+    InputStream getInputStream();
+
+    int getStatusCode();
+
+    List<MimeContent> getMimeContent();
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpResponse.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpResponse.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpResponse.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpVerb.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpVerb.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpVerb.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpVerb.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,31 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public enum HttpVerb
+{
+    GET,
+    PUT,
+    POST,
+    DELETE,
+    HEAD
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpVerb.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpVerb.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/HttpVerb.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeContent.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeContent.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeContent.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeContent.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public interface MimeContent
+{
+    String getName();
+
+    String getFileName();
+
+    String getContentType();
+
+    int getContentSize();
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeContent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeContent.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeContent.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeInputStream.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeInputStream.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeInputStream.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeInputStream.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+import java.io.InputStream;
+
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public interface MimeInputStream extends MimeContent
+{
+    InputStream getInputStream();
+}

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeInputStream.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeInputStream.java
------------------------------------------------------------------------------
    svn:keywords = "Date Revision Id Author"

Propchange: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeInputStream.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeReadChannel.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeReadChannel.java?rev=883261&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeReadChannel.java (added)
+++ mina/sandbox/adc/ahc/src/main/java/org/apache/ahc/api/MimeReadChannel.java Mon Nov 23 07:07:13 2009
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+package org.apache.ahc.api;
+
+import java.nio.channels.ScatteringByteChannel;
+
+
+/**
+ * @version $Revision$ $Date: $
+ */
+public interface MimeReadChannel extends MimeContent
+{
+    void readReady(Provisionable owner, ScatteringByteChannel channel);
+}