----- Original Message -----
> Signed-off-by: Pekka Enberg <penb...@kernel.org>
> ---
>  java/net/CacheRequest.java        |   52 ++++++++++++++++++++++++
>  java/net/CacheResponse.java       |   55 +++++++++++++++++++++++++
>  java/net/CookieHandler.java       |   68
>  +++++++++++++++++++++++++++++++
>  java/net/HttpRetryException.java  |   80
>  +++++++++++++++++++++++++++++++++++++
>  java/net/ResponseCache.java       |   69
>  +++++++++++++++++++++++++++++++
>  java/net/SecureCacheResponse.java |   55 +++++++++++++++++++++++++
>  6 files changed, 379 insertions(+), 0 deletions(-)
>  create mode 100644 java/net/CacheRequest.java
>  create mode 100644 java/net/CacheResponse.java
>  create mode 100644 java/net/CookieHandler.java
>  create mode 100644 java/net/HttpRetryException.java
>  create mode 100644 java/net/ResponseCache.java
>  create mode 100644 java/net/SecureCacheResponse.java
> 
> diff --git a/java/net/CacheRequest.java b/java/net/CacheRequest.java
> new file mode 100644
> index 0000000..23e0d9e
> --- /dev/null
> +++ b/java/net/CacheRequest.java
> @@ -0,0 +1,52 @@
> +/* CacheRequest.java --
> +   Copyright (C) 2012  Free Software Foundation, Inc.
> +
> +This file is part of GNU Classpath.
> +
> +GNU Classpath is free software; you can redistribute it and/or
> modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 2, or (at your option)
> +any later version.
> +
> +GNU Classpath is distributed in the hope that it will be useful, but
> +WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GNU Classpath; see the file COPYING.  If not, write to
> the
> +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
> Boston, MA
> +02110-1301 USA.
> +
> +Linking this library statically or dynamically with other modules is
> +making a combined work based on this library.  Thus, the terms and
> +conditions of the GNU General Public License cover the whole
> +combination.
> +
> +As a special exception, the copyright holders of this library give
> you
> +permission to link this library with independent modules to produce
> an
> +executable, regardless of the license terms of these independent
> +modules, and to copy and distribute the resulting executable under
> +terms of your choice, provided that you also meet, for each linked
> +independent module, the terms and conditions of the license of that
> +module.  An independent module is a module which is not derived from
> +or based on this library.  If you modify this library, you may
> extend
> +this exception to your version of the library, but you are not
> +obligated to do so.  If you do not wish to do so, delete this
> +exception statement from your version. */
> +
> +package java.net;
> +
> +import java.io.IOException;
> +import java.io.OutputStream;
> +
> +
> +/**
> + * @since 1.5
> + */
> +public abstract class CacheRequest
> +{
> +  public abstract OutputStream getBody() throws IOException;
> +
> +  public abstract void abort();
> +}
> diff --git a/java/net/CacheResponse.java
> b/java/net/CacheResponse.java
> new file mode 100644
> index 0000000..d4cf95f
> --- /dev/null
> +++ b/java/net/CacheResponse.java
> @@ -0,0 +1,55 @@
> +/* CacheResponse.java --
> +   Copyright (C) 2012  Free Software Foundation, Inc.
> +
> +This file is part of GNU Classpath.
> +
> +GNU Classpath is free software; you can redistribute it and/or
> modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 2, or (at your option)
> +any later version.
> +
> +GNU Classpath is distributed in the hope that it will be useful, but
> +WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GNU Classpath; see the file COPYING.  If not, write to
> the
> +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
> Boston, MA
> +02110-1301 USA.
> +
> +Linking this library statically or dynamically with other modules is
> +making a combined work based on this library.  Thus, the terms and
> +conditions of the GNU General Public License cover the whole
> +combination.
> +
> +As a special exception, the copyright holders of this library give
> you
> +permission to link this library with independent modules to produce
> an
> +executable, regardless of the license terms of these independent
> +modules, and to copy and distribute the resulting executable under
> +terms of your choice, provided that you also meet, for each linked
> +independent module, the terms and conditions of the license of that
> +module.  An independent module is a module which is not derived from
> +or based on this library.  If you modify this library, you may
> extend
> +this exception to your version of the library, but you are not
> +obligated to do so.  If you do not wish to do so, delete this
> +exception statement from your version. */
> +
> +package java.net;
> +
> +import java.io.IOException;
> +import java.io.InputStream;
> +
> +import java.util.List;
> +import java.util.Map;
> +
> +
> +/**
> + * @since 1.5
> + */
> +public abstract class CacheResponse
> +{
> +  public abstract InputStream getBody() throws IOException;
> +
> +  public abstract Map<String, List<String>> getHeaders() throws
> IOException;
> +}
> diff --git a/java/net/CookieHandler.java
> b/java/net/CookieHandler.java
> new file mode 100644
> index 0000000..c551f5d
> --- /dev/null
> +++ b/java/net/CookieHandler.java
> @@ -0,0 +1,68 @@
> +/* CookieHandler.java --
> +   Copyright (C) 2012  Free Software Foundation, Inc.
> +
> +This file is part of GNU Classpath.
> +
> +GNU Classpath is free software; you can redistribute it and/or
> modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 2, or (at your option)
> +any later version.
> +
> +GNU Classpath is distributed in the hope that it will be useful, but
> +WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GNU Classpath; see the file COPYING.  If not, write to
> the
> +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
> Boston, MA
> +02110-1301 USA.
> +
> +Linking this library statically or dynamically with other modules is
> +making a combined work based on this library.  Thus, the terms and
> +conditions of the GNU General Public License cover the whole
> +combination.
> +
> +As a special exception, the copyright holders of this library give
> you
> +permission to link this library with independent modules to produce
> an
> +executable, regardless of the license terms of these independent
> +modules, and to copy and distribute the resulting executable under
> +terms of your choice, provided that you also meet, for each linked
> +independent module, the terms and conditions of the license of that
> +module.  An independent module is a module which is not derived from
> +or based on this library.  If you modify this library, you may
> extend
> +this exception to your version of the library, but you are not
> +obligated to do so.  If you do not wish to do so, delete this
> +exception statement from your version. */
> +
> +package java.net;
> +
> +import java.io.IOException;
> +import java.util.List;
> +import java.util.Map;
> +
> +
> +/**
> + * @since 1.5
> + */
> +public abstract class CookieHandler
> +{
> +  private static CookieHandler defaultHandler;
> +
> +  public static CookieHandler getDefault()
> +  {
> +    return defaultHandler;
> +  }
> +
> +  public static void setDefault(CookieHandler handler)
> +  {
> +    defaultHandler = handler;
> +  }
> +
> +  public abstract Map<String, List<String>> get(URI uri, Map<String,
> +                                                List<String>>
> requestHeaders)
> +    throws IOException;
> +
> +  public abstract void put(URI uri, Map<String, List<String>>
> responseHeaders)
> +    throws IOException;
> +}
> diff --git a/java/net/HttpRetryException.java
> b/java/net/HttpRetryException.java
> new file mode 100644
> index 0000000..2b51bc5
> --- /dev/null
> +++ b/java/net/HttpRetryException.java
> @@ -0,0 +1,80 @@
> +/* HttpRetryException.java --
> +   Copyright (C) 2012  Free Software Foundation, Inc.
> +
> +This file is part of GNU Classpath.
> +
> +GNU Classpath is free software; you can redistribute it and/or
> modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 2, or (at your option)
> +any later version.
> +
> +GNU Classpath is distributed in the hope that it will be useful, but
> +WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GNU Classpath; see the file COPYING.  If not, write to
> the
> +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
> Boston, MA
> +02110-1301 USA.
> +
> +Linking this library statically or dynamically with other modules is
> +making a combined work based on this library.  Thus, the terms and
> +conditions of the GNU General Public License cover the whole
> +combination.
> +
> +As a special exception, the copyright holders of this library give
> you
> +permission to link this library with independent modules to produce
> an
> +executable, regardless of the license terms of these independent
> +modules, and to copy and distribute the resulting executable under
> +terms of your choice, provided that you also meet, for each linked
> +independent module, the terms and conditions of the license of that
> +module.  An independent module is a module which is not derived from
> +or based on this library.  If you modify this library, you may
> extend
> +this exception to your version of the library, but you are not
> +obligated to do so.  If you do not wish to do so, delete this
> +exception statement from your version. */
> +
> +package java.net;
> +
> +import java.io.IOException;
> +
> +
> +/**
> + * @since 1.5
> + */
> +public class HttpRetryException
> +  extends IOException
> +{
> +  private final String reason;
> +  private final int responseCode;
> +  private final String location;
> +
> +  public HttpRetryException(String reason, int responseCode)
> +  {
> +    this(reason, responseCode, null);
> +  }
> +
> +  public HttpRetryException(String reason, int responseCode, String
> location)
> +  {
> +    this.reason = reason;
> +    this.responseCode = responseCode;
> +    this.location = location;
> +  }
> +
> +  public int responseCode()
> +  {
> +    return this.responseCode;
> +  }
> +
> +  public String getReason()
> +  {
> +    return reason;
> +  }
> +
> +  public String getLocation()
> +  {
> +    return location;
> +  }
> +
> +}
> diff --git a/java/net/ResponseCache.java
> b/java/net/ResponseCache.java
> new file mode 100644
> index 0000000..179fa5f
> --- /dev/null
> +++ b/java/net/ResponseCache.java
> @@ -0,0 +1,69 @@
> +/* ResponseCache.java --
> +   Copyright (C) 2012  Free Software Foundation, Inc.
> +
> +This file is part of GNU Classpath.
> +
> +GNU Classpath is free software; you can redistribute it and/or
> modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 2, or (at your option)
> +any later version.
> +
> +GNU Classpath is distributed in the hope that it will be useful, but
> +WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GNU Classpath; see the file COPYING.  If not, write to
> the
> +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
> Boston, MA
> +02110-1301 USA.
> +
> +Linking this library statically or dynamically with other modules is
> +making a combined work based on this library.  Thus, the terms and
> +conditions of the GNU General Public License cover the whole
> +combination.
> +
> +As a special exception, the copyright holders of this library give
> you
> +permission to link this library with independent modules to produce
> an
> +executable, regardless of the license terms of these independent
> +modules, and to copy and distribute the resulting executable under
> +terms of your choice, provided that you also meet, for each linked
> +independent module, the terms and conditions of the license of that
> +module.  An independent module is a module which is not derived from
> +or based on this library.  If you modify this library, you may
> extend
> +this exception to your version of the library, but you are not
> +obligated to do so.  If you do not wish to do so, delete this
> +exception statement from your version. */
> +
> +package java.net;
> +
> +import java.io.IOException;
> +import java.util.List;
> +import java.util.Map;
> +
> +
> +/**
> + * @since 1.5
> + */
> +public abstract class ResponseCache
> +{
> +  private static ResponseCache defaultCache;
> +
> +  public static ResponseCache getDefault()
> +  {
> +    return defaultCache;
> +  }
> +
> +  public static void setDefault(ResponseCache cache)
> +  {
> +    defaultCache = cache;
> +  }
> +
> +  public abstract CacheResponse get(URI uri, String requestMethod,
> +                                    Map<String, List<String>>
> requestHeaders)
> +    throws IOException;
> +
> +  public abstract CacheRequest put(URI uri, URLConnection
> connection)
> +    throws IOException;
> +
> +}
> diff --git a/java/net/SecureCacheResponse.java
> b/java/net/SecureCacheResponse.java
> new file mode 100644
> index 0000000..e405484
> --- /dev/null
> +++ b/java/net/SecureCacheResponse.java
> @@ -0,0 +1,55 @@
> +/* SecureCacheResponse.java --
> +   Copyright (C) 2012  Free Software Foundation, Inc.
> +
> +This file is part of GNU Classpath.
> +
> +GNU Classpath is free software; you can redistribute it and/or
> modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 2, or (at your option)
> +any later version.
> +
> +GNU Classpath is distributed in the hope that it will be useful, but
> +WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GNU Classpath; see the file COPYING.  If not, write to
> the
> +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
> Boston, MA
> +02110-1301 USA.
> +
> +Linking this library statically or dynamically with other modules is
> +making a combined work based on this library.  Thus, the terms and
> +conditions of the GNU General Public License cover the whole
> +combination.
> +
> +As a special exception, the copyright holders of this library give
> you
> +permission to link this library with independent modules to produce
> an
> +executable, regardless of the license terms of these independent
> +modules, and to copy and distribute the resulting executable under
> +terms of your choice, provided that you also meet, for each linked
> +independent module, the terms and conditions of the license of that
> +module.  An independent module is a module which is not derived from
> +or based on this library.  If you modify this library, you may
> extend
> +this exception to your version of the library, but you are not
> +obligated to do so.  If you do not wish to do so, delete this
> +exception statement from your version. */
> +
> +package java.net;
> +
> +import java.security.Principal;
> +import java.security.cert.Certificate;
> +import java.util.List;
> +import javax.net.ssl.SSLPeerUnverifiedException;
> +
> +
> +/**
> + * @since 1.5
> + */
> +public abstract class SecureCacheResponse
> +  extends CacheResponse
> +{
> +  public abstract String getCipherSuite();
> +  public abstract List<Certificate> getLocalCertificateChain();
> +  public abstract Principal getLocalPrincipal();
> +}
> --
> 1.7.6.5
> 
> 
> 

The CookieHandler is the main one that concerns me here.  We're providing
getDefault() but it's going to return null unless someone sets it.  That is
valid, but I'm worried it gives the impression we implement something when
really we just provide the interfaces.  Also, both getDefault and setDefault
are supposed to perform security checks.

I also worry a lot of code is being added here without documentation.
-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

PGP Key: 248BDC07 (https://keys.indymedia.org/)
Fingerprint = EC5A 1F5E C0AD 1D15 8F1F  8F91 3B96 A578 248B DC07


Reply via email to