hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1620787 - in /httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie: BestMatchSpecFactory.java BrowserCompatSpecFactory.java NetscapeDraftSpecFactory.java RFC2109SpecFactory.java RFC2965SpecFactory.java
Date Wed, 27 Aug 2014 07:44:55 GMT
Author: olegk
Date: Wed Aug 27 07:44:54 2014
New Revision: 1620787

URL: http://svn.apache.org/r1620787
Log:
Cookie spec provides to re-use the same thread-safe CookieSpec instance by default

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BestMatchSpecFactory.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpecFactory.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpecFactory.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109SpecFactory.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965SpecFactory.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BestMatchSpecFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BestMatchSpecFactory.java?rev=1620787&r1=1620786&r2=1620787&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BestMatchSpecFactory.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BestMatchSpecFactory.java
Wed Aug 27 07:44:54 2014
@@ -38,8 +38,9 @@ import org.apache.http.params.HttpParams
 import org.apache.http.protocol.HttpContext;
 
 /**
- * {@link CookieSpecProvider} implementation that creates and initializes
- * {@link BestMatchSpec} instances.
+ * {@link org.apache.http.cookie.CookieSpecProvider} implementation that provides an instance
of
+ * {@link org.apache.http.impl.cookie.BestMatchSpec}. The instance returned by this factory
can
+ * be shared by multiple threads.
  *
  * @since 4.0
  */
@@ -47,13 +48,11 @@ import org.apache.http.protocol.HttpCont
 @SuppressWarnings("deprecation")
 public class BestMatchSpecFactory implements CookieSpecFactory, CookieSpecProvider {
 
-    private final String[] datepatterns;
-    private final boolean oneHeader;
+    private final CookieSpec cookieSpec;
 
     public BestMatchSpecFactory(final String[] datepatterns, final boolean oneHeader) {
         super();
-        this.datepatterns = datepatterns;
-        this.oneHeader = oneHeader;
+        this.cookieSpec = new BestMatchSpec(datepatterns, oneHeader);;
     }
 
     public BestMatchSpecFactory() {
@@ -82,7 +81,7 @@ public class BestMatchSpecFactory implem
 
     @Override
     public CookieSpec create(final HttpContext context) {
-        return new BestMatchSpec(this.datepatterns, this.oneHeader);
+        return this.cookieSpec;
     }
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpecFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpecFactory.java?rev=1620787&r1=1620786&r2=1620787&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpecFactory.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpecFactory.java
Wed Aug 27 07:44:54 2014
@@ -38,8 +38,9 @@ import org.apache.http.params.HttpParams
 import org.apache.http.protocol.HttpContext;
 
 /**
- * {@link CookieSpecProvider} implementation that creates and initializes
- * {@link BrowserCompatSpec} instances.
+ * {@link org.apache.http.cookie.CookieSpecProvider} implementation that provides an instance
of
+ * {@link org.apache.http.impl.cookie.BrowserCompatSpec}. The instance returned by this factory
+ * can be shared by multiple threads.
  *
  * @since 4.0
  */
@@ -52,13 +53,13 @@ public class BrowserCompatSpecFactory im
         SECURITYLEVEL_IE_MEDIUM
     }
 
-    private final String[] datepatterns;
     private final SecurityLevel securityLevel;
+    private final CookieSpec cookieSpec;
 
     public BrowserCompatSpecFactory(final String[] datepatterns, final SecurityLevel securityLevel)
{
         super();
-        this.datepatterns = datepatterns;
         this.securityLevel = securityLevel;
+        this.cookieSpec = new BrowserCompatSpec(datepatterns, securityLevel);
     }
 
     public BrowserCompatSpecFactory(final String[] datepatterns) {
@@ -88,7 +89,7 @@ public class BrowserCompatSpecFactory im
 
     @Override
     public CookieSpec create(final HttpContext context) {
-        return new BrowserCompatSpec(this.datepatterns);
+        return this.cookieSpec;
     }
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpecFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpecFactory.java?rev=1620787&r1=1620786&r2=1620787&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpecFactory.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpecFactory.java
Wed Aug 27 07:44:54 2014
@@ -38,8 +38,9 @@ import org.apache.http.params.HttpParams
 import org.apache.http.protocol.HttpContext;
 
 /**
- * {@link CookieSpecProvider} implementation that creates and initializes
- * {@link NetscapeDraftSpec} instances.
+ * {@link org.apache.http.cookie.CookieSpecProvider} implementation that provides an instance
of
+ * {@link org.apache.http.impl.cookie.NetscapeDraftSpec}. The instance returned by this factory
+ * can be shared by multiple threads.
  *
  * @since 4.0
  */
@@ -47,11 +48,11 @@ import org.apache.http.protocol.HttpCont
 @SuppressWarnings("deprecation")
 public class NetscapeDraftSpecFactory implements CookieSpecFactory, CookieSpecProvider {
 
-    private final String[] datepatterns;
+    private final CookieSpec cookieSpec;
 
     public NetscapeDraftSpecFactory(final String[] datepatterns) {
         super();
-        this.datepatterns = datepatterns;
+        this.cookieSpec = new NetscapeDraftSpec(datepatterns);
     }
 
     public NetscapeDraftSpecFactory() {
@@ -77,11 +78,7 @@ public class NetscapeDraftSpecFactory im
 
     @Override
     public CookieSpec create(final HttpContext context) {
-
-
-
-
-        return new NetscapeDraftSpec(this.datepatterns);
+        return this.cookieSpec;
     }
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109SpecFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109SpecFactory.java?rev=1620787&r1=1620786&r2=1620787&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109SpecFactory.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109SpecFactory.java
Wed Aug 27 07:44:54 2014
@@ -38,8 +38,9 @@ import org.apache.http.params.HttpParams
 import org.apache.http.protocol.HttpContext;
 
 /**
- * {@link CookieSpecProvider} implementation that creates and initializes
- * {@link RFC2109Spec} instances.
+ * {@link org.apache.http.cookie.CookieSpecProvider} implementation that provides an instance
of
+ * {@link org.apache.http.impl.cookie.RFC2109Spec}. The instance returned by this factory
+ * can be shared by multiple threads.
  *
  * @since 4.0
  */
@@ -47,13 +48,11 @@ import org.apache.http.protocol.HttpCont
 @SuppressWarnings("deprecation")
 public class RFC2109SpecFactory implements CookieSpecFactory, CookieSpecProvider {
 
-    private final String[] datepatterns;
-    private final boolean oneHeader;
+    private final CookieSpec cookieSpec;
 
     public RFC2109SpecFactory(final String[] datepatterns, final boolean oneHeader) {
         super();
-        this.datepatterns = datepatterns;
-        this.oneHeader = oneHeader;
+        this.cookieSpec = new RFC2109Spec(datepatterns, oneHeader);
     }
 
     public RFC2109SpecFactory() {
@@ -82,7 +81,7 @@ public class RFC2109SpecFactory implemen
 
     @Override
     public CookieSpec create(final HttpContext context) {
-        return new RFC2109Spec(this.datepatterns, this.oneHeader);
+        return this.cookieSpec;
     }
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965SpecFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965SpecFactory.java?rev=1620787&r1=1620786&r2=1620787&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965SpecFactory.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965SpecFactory.java
Wed Aug 27 07:44:54 2014
@@ -38,8 +38,9 @@ import org.apache.http.params.HttpParams
 import org.apache.http.protocol.HttpContext;
 
 /**
- * {@link CookieSpecProvider} implementation that creates and initializes
- * {@link RFC2965Spec} instances.
+ * {@link org.apache.http.cookie.CookieSpecProvider} implementation that provides an instance
of
+ * {@link org.apache.http.impl.cookie.RFC2965Spec}. The instance returned by this factory
can
+ * be shared by multiple threads.
  *
  * @since 4.0
  */
@@ -47,13 +48,11 @@ import org.apache.http.protocol.HttpCont
 @SuppressWarnings("deprecation")
 public class RFC2965SpecFactory implements CookieSpecFactory, CookieSpecProvider {
 
-    private final String[] datepatterns;
-    private final boolean oneHeader;
+    private final CookieSpec cookieSpec;
 
     public RFC2965SpecFactory(final String[] datepatterns, final boolean oneHeader) {
         super();
-        this.datepatterns = datepatterns;
-        this.oneHeader = oneHeader;
+        this.cookieSpec = new RFC2965Spec(datepatterns, oneHeader);
     }
 
     public RFC2965SpecFactory() {
@@ -82,7 +81,7 @@ public class RFC2965SpecFactory implemen
 
     @Override
     public CookieSpec create(final HttpContext context) {
-        return new RFC2965Spec(this.datepatterns, this.oneHeader);
+        return this.cookieSpec;
     }
 
 }



Mime
View raw message