abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r555748 - in /incubator/abdera/java/trunk: client/src/main/java/org/apache/abdera/protocol/client/ client/src/main/java/org/apache/abdera/protocol/client/util/ client/src/test/java/org/apache/abdera/test/client/app/ client/src/test/java/org...
Date Thu, 12 Jul 2007 20:33:33 GMT
Author: jmsnell
Date: Thu Jul 12 13:33:32 2007
New Revision: 555748

URL: http://svn.apache.org/viewvc?view=rev&rev=555748
Log:
This looks like a big change but it's really not.  Previously we had an abstract class Client with a single concrete implementation called CommonsClient.
In the code, this would always look like:

  Abdera abdera = new Abdera();
  Client client = new CommonsClient(abdera);
  
Given that we currently only support the Commons HttpClient, having this distinction really does not make any sense.  This change combines the two classes
into a single AbderaClient class.

And while I know this will drive Garrett crazy, there is one additional change bundled in this set.  It is now possible to set a RequestOption so that a RequestException
is thrown when 4xx and 5xx is returned by the server.  This is disabled by default and allows client developers the ability to use explicit error handling.  I'll try 
to make this the last time I bundle multiple changes into a single commit.

Added:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java
      - copied, changed from r541096, incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/Client.java
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestException.java
Removed:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/Client.java
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsClient.java
Modified:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/BaseRequestEntity.java
    incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/app/AppTest.java
    incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/cache/CacheTest.java
    incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/Main.java
    incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/Services.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/editor/Editor.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthCredentials.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthScheme.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/wsse/WSSEAuthScheme.java
    incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/servlet/DHEncryptedResponseFilter.java
    incubator/abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/DSigThirdPartyVerifyTest.java

Copied: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java (from r541096, incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/Client.java)
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java?view=diff&rev=555748&p1=incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/Client.java&r1=541096&p2=incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java&r2=555748
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/Client.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java Thu Jul 12 13:33:32 2007
@@ -18,24 +18,38 @@
 package org.apache.abdera.protocol.client;
 
 import java.io.InputStream;
+import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.List;
 
 import javax.net.ssl.TrustManager;
 
 import org.apache.abdera.Abdera;
 import org.apache.abdera.model.Base;
 import org.apache.abdera.model.Document;
+import org.apache.abdera.protocol.Response.ResponseType;
 import org.apache.abdera.protocol.client.cache.Cache;
+import org.apache.abdera.protocol.client.cache.CacheDisposition;
 import org.apache.abdera.protocol.client.cache.CacheFactory;
+import org.apache.abdera.protocol.client.cache.CachedResponse;
 import org.apache.abdera.protocol.client.cache.lru.LRUCache;
 import org.apache.abdera.protocol.client.util.BaseRequestEntity;
+import org.apache.abdera.protocol.client.util.MethodHelper;
 import org.apache.abdera.protocol.client.util.SimpleSSLProtocolSocketFactory;
+import org.apache.abdera.protocol.util.CacheControlUtil;
 import org.apache.abdera.util.ServiceUtil;
+import org.apache.abdera.util.Version;
 import org.apache.commons.httpclient.Credentials;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
 import org.apache.commons.httpclient.auth.AuthPolicy;
 import org.apache.commons.httpclient.auth.AuthScheme;
+import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.commons.httpclient.cookie.CookiePolicy;
 import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
 import org.apache.commons.httpclient.methods.RequestEntity;
+import org.apache.commons.httpclient.params.HttpClientParams;
 import org.apache.commons.httpclient.protocol.Protocol;
 import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
 import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
@@ -43,52 +57,43 @@
 /**
  * An Atom Publishing Protocol client.
  */
-public abstract class Client {
+public class AbderaClient {
 
+  public static final String DEFAULT_USER_AGENT = 
+    Version.APP_NAME + "/" + Version.VERSION;
+  
   protected final Abdera abdera;
   protected final Cache cache;
+  private final HttpClient client;
 
-  public Client() {
-    this(new Abdera());
+  public AbderaClient() {
+    this(new Abdera(),DEFAULT_USER_AGENT);
+  }
+  
+  public AbderaClient(String useragent) {
+    this(new Abdera(), useragent);
   }
   
-  protected Client(Abdera abdera) {
+  public AbderaClient(Abdera abdera, String useragent) {
     this.abdera = abdera;
     this.cache = initCache(initCacheFactory());
+    MultiThreadedHttpConnectionManager connManager = 
+      new MultiThreadedHttpConnectionManager();
+    client = new HttpClient(connManager);
+    client.getParams().setParameter(
+      HttpClientParams.USER_AGENT, 
+      useragent);
+    client.getParams().setBooleanParameter(
+      HttpClientParams.USE_EXPECT_CONTINUE, true);  
+    client.getParams().setCookiePolicy(
+      CookiePolicy.BROWSER_COMPATIBILITY);
+    setAuthenticationSchemeDefaults();
   }
   
-  /**
-   * Get the default request options used by this client.
-   */
-  public abstract RequestOptions getDefaultRequestOptions();
-
-  /**
-   * Add a set of authentication credentials to the client.
-   * 
-   * @param target The URI for which you wish to authenticate
-   * @param realm The authentication realm these credentials apply to,
-   *              or null if the credentials apply to any realm
-   * @param scheme The authentication scheme these credentials apply to,
-   *               or null if the credentials apply to any scheme
-   * @param credentials The credentials to use
-   * @throws URISyntaxException
-   */
-  public abstract void addCredentials(
-    String target, 
-    String realm,
-    String scheme,
-    Credentials credentials) 
-      throws URISyntaxException;
-  
-  /** Set the order in which authentication schemes should be used. */
-  public abstract void setAuthenticationSchemePriority(String... scheme);
-  
-  /**
-   * Indicates if the client should authenticate before attempting to do
-   * anything else.
-   */
-  public abstract void usePreemptiveAuthentication(boolean val);
-  
+  public AbderaClient(Abdera abdera) {
+    this(abdera,DEFAULT_USER_AGENT);
+  }
+    
   private CacheFactory initCacheFactory() {
     CacheFactory cacheFactory = 
       (CacheFactory)ServiceUtil.newInstance(
@@ -228,33 +233,6 @@
     String uri) {
       return delete(uri, getDefaultRequestOptions());
   }
-
-  /**
-   * Execute an arbitrary HTTP request
-   * 
-   * @param method The method name
-   * @param uri The URI to execute the request on
-   * @param entity The request entity to use for generating the request
-   * @param options The options to use for this request
-   * @return the server's response
-   */
-  public abstract ClientResponse execute(
-    String method, 
-    String uri, 
-    RequestEntity entity, 
-    RequestOptions options);
-
-  public abstract ClientResponse execute(
-    String method,
-    String uri,
-    Base base,
-    RequestOptions options);
-  
-  public abstract ClientResponse execute(
-    String method,
-    String uri,
-    InputStream in,
-    RequestOptions options);
   
   /**
    * Register a new authentication scheme.
@@ -312,8 +290,183 @@
   }
   
   /**
-   * Explicitly tear down the Client instance
+   * Configure the client to use preemptive authentication (HTTP Basic Authentication only)
    */
-  public void teardown() {}
+  public void usePreemptiveAuthentication(boolean val) {
+    client.getParams().setAuthenticationPreemptive(val);
+  }
   
+  private boolean useCache(
+    String method, 
+    RequestOptions options) {
+      return (CacheControlUtil.isIdempotent(method)) &&
+        !options.isNoCache() &&
+        !options.isNoStore() &&
+        options.getUseLocalCache();
+  }
+  
+  private boolean mustRevalidate(RequestOptions options, CachedResponse response) {
+    if (options.getRevalidateWithAuth()) {
+      if (options.getAuthorization() != null) return true;
+      if (client.getParams().getBooleanParameter(
+        HttpClientParams.PREEMPTIVE_AUTHENTICATION, false)) return true;
+      if (response != null) {
+        if (response.isPublic()) return false;
+      }
+    }
+    return false;
+  }
+  
+  public ClientResponse execute(
+    String method,
+    String uri,
+    Base base,
+    RequestOptions options) {
+      RequestEntity re = new BaseRequestEntity(base);
+      return execute(method,uri,re,options);
+  }
+    
+  public ClientResponse execute(
+    String method,
+    String uri,
+    InputStream in,
+    RequestOptions options) {
+      RequestEntity re = null;
+      try {
+        if (options.getContentType() != null) { 
+          re = new InputStreamRequestEntity(
+            in, options.getContentType().toString());
+        } else {
+          re = new InputStreamRequestEntity(in);
+        }
+      } catch (Exception e) {
+        re = new InputStreamRequestEntity(in);
+      }
+      return execute(method,uri,re,options);
+  }
+  
+  public ClientResponse execute(
+    String method, 
+    String uri, 
+    RequestEntity entity,
+    RequestOptions options) {
+      boolean usecache = useCache(method,options);
+      try {
+        if (options == null) options = getDefaultRequestOptions();
+        Cache cache = getCache();
+        CacheDisposition disp = 
+          (usecache) ? 
+            cache.getDisposition(uri, options) : 
+            CacheDisposition.TRANSPARENT;
+        CachedResponse cached_response = cache.get(uri, options);
+        disp = (!disp.equals(CacheDisposition.TRANSPARENT) && 
+                mustRevalidate(options, cached_response)) ? 
+                  CacheDisposition.STALE : 
+                  disp;
+        switch(disp) {
+          case FRESH:                                                            // CACHE HIT: FRESH
+            if (cached_response != null) {
+              checkRequestException(cached_response,options);
+              return cached_response;
+            }
+          case STALE:                                                            // CACHE HIT: STALE
+            // revalidate the cached entry
+            if (cached_response != null && cached_response.getEntityTag() != null) {
+              options.setIfModifiedSince(cached_response.getLastModified());
+              options.setIfNoneMatch(cached_response.getEntityTag().toString());
+            } else {
+              disp = CacheDisposition.TRANSPARENT;
+            }
+          default:                                                               // CACHE MISS
+            HttpMethod httpMethod = 
+              MethodHelper.createMethod(
+                method, uri, entity, options);
+            client.executeMethod(httpMethod);
+            if (usecache &&
+                (httpMethod.getStatusCode() == 304 || 
+                 httpMethod.getStatusCode() == 412) &&
+                cached_response != null) return cached_response;
+            ClientResponse response = new CommonsResponse(abdera,httpMethod);
+            response = (options.getUseLocalCache()) ?
+              response = cache.update(options, response, cached_response) : 
+              response;
+            checkRequestException(response,options);
+            return response;
+        }
+      } catch (Throwable t) {
+        if (t instanceof ClientException) throw (ClientException)t;
+        throw new ClientException(t);
+      }
+  }
+
+  private void checkRequestException(
+    ClientResponse response, 
+    RequestOptions options) {
+      if (response == null) return;
+      ResponseType type = response.getType();
+      if ((type.equals(ResponseType.CLIENT_ERROR) && options.is4xxRequestException()) ||
+          (type.equals(ResponseType.SERVER_ERROR) && options.is5xxRequestException()))
+        throw new RequestException(response);
+  }
+  
+  public RequestOptions getDefaultRequestOptions() {
+    return MethodHelper.createDefaultRequestOptions();
+  }
+  
+  public void addCredentials(
+    String target,
+    String realm,
+    String scheme,
+    Credentials credentials) 
+      throws URISyntaxException {
+    String host = AuthScope.ANY_HOST;
+    int port = AuthScope.ANY_PORT;
+    if (target != null) {
+      URI uri = new URI(target);
+      host = uri.getHost();
+      port = uri.getPort();
+    }
+    AuthScope scope = 
+      new AuthScope(
+        host, 
+        port, 
+        (realm != null) ? realm : AuthScope.ANY_REALM, 
+        (scheme != null) ? scheme : AuthScope.ANY_SCHEME);
+    client.getState().setCredentials(
+      scope, credentials);
+  }
+
+  public void setAuthenticationSchemeDefaults() {
+    List authPrefs = AuthPolicy.getDefaultAuthPrefs();
+    client.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);
+  }
+  
+  public void setAuthenticationSchemePriority(String... scheme) {
+    List authPrefs = java.util.Arrays.asList(scheme);
+    client.getParams().setParameter(
+      AuthPolicy.AUTH_SCHEME_PRIORITY, 
+      authPrefs);
+  }
+  
+  public List getAuthenticationSchemePriority() {
+    return (List)client.getParams().getParameter(AuthPolicy.AUTH_SCHEME_PRIORITY);
+  }
+  
+  /**
+   * <p>Per http://jakarta.apache.org/commons/httpclient/performance.html</p>
+   * <blockquote>
+   *   Generally it is recommended to have a single instance of HttpClient 
+   *   per communication component or even per application. However, if the 
+   *   application makes use of HttpClient only very infrequently, and keeping 
+   *   an idle instance of HttpClient in memory is not warranted, it is highly 
+   *   recommended to explicitly  shut down the multithreaded connection manager 
+   *   prior to disposing the HttpClient instance. This will ensure proper 
+   *   closure of all HTTP connections in the connection pool.
+   * </blockquote>
+   */
+  public void teardown() {
+    ((MultiThreadedHttpConnectionManager)
+      client.getHttpConnectionManager()).shutdown();
+  }
+
 }

Added: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestException.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestException.java?view=auto&rev=555748
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestException.java (added)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestException.java Thu Jul 12 13:33:32 2007
@@ -0,0 +1,44 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.client;
+
+/**
+ * RequestExceptions will be thrown optionally depending on the settings in
+ * RequestOptions for 4xx and 5xx responses.  This allows client implementations
+ * to use proper java error handling when error responses are encountered 
+ */
+public final class RequestException 
+  extends ClientException {
+
+  private static final long serialVersionUID = -4644092407795348739L;
+  private final ClientResponse response;
+  
+  protected RequestException(ClientResponse response) {
+    super(response.getStatus() + "::" + response.getStatusText());
+    this.response = response;
+  }
+  
+  public ClientResponse getClientResponse() {
+    return response;
+  }
+  
+  public int getStatus() {
+    return response.getStatus();
+  }
+  
+}

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java?view=diff&rev=555748&r1=555747&r2=555748
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java Thu Jul 12 13:33:32 2007
@@ -43,6 +43,8 @@
   private boolean revalidateAuth = false;
   private boolean useChunked = false;
   private boolean usePostOverride = false;
+  private boolean requestException4xx = false;
+  private boolean requestException5xx = false;
   
   private final Map<String,List<String>> headers;  
   
@@ -411,14 +413,14 @@
   }
 
   /**
-   * Configure the Client Side cache to revalidate when using Authorization
+   * Configure the AbderaClient Side cache to revalidate when using Authorization
    */
   public boolean getRevalidateWithAuth() {
     return revalidateAuth;
   }
   
   /**
-   * Configure the Client Side cache to revalidate when using Authorization
+   * Configure the AbderaClient Side cache to revalidate when using Authorization
    */
   public void setRevalidateWithAuth(boolean revalidateAuth) {
     this.revalidateAuth= revalidateAuth;
@@ -450,5 +452,33 @@
    */
   public boolean isUsePostOverride() {
     return this.usePostOverride;
+  }
+  
+  /**
+   * Set whether or not to throw a RequestExeption on 4xx responses
+   */
+  public void set4xxRequestException(boolean v) {
+    this.requestException4xx = v;
+  }
+  
+  /**
+   * Return true if a RequestException should be thrown on 4xx responses
+   */
+  public boolean is4xxRequestException() {
+    return this.requestException4xx;
+  }
+  
+  /**
+   * Set whether or not to throw a RequestExeption on 5xx responses
+   */
+  public void set5xxRequestException(boolean v) {
+    this.requestException5xx = v;
+  }
+  
+  /**
+   * Return true if a RequestException should be thrown on 5xx responses
+   */
+  public boolean is5xxRequestException() {
+    return this.requestException5xx;
   }
 }

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/BaseRequestEntity.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/BaseRequestEntity.java?view=diff&rev=555748&r1=555747&r2=555748
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/BaseRequestEntity.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/BaseRequestEntity.java Thu Jul 12 13:33:32 2007
@@ -26,7 +26,7 @@
 import org.apache.commons.httpclient.methods.RequestEntity;
 
 /**
- * Required for the Apache Commons HTTP Client.
+ * Required for the Apache Commons HTTP AbderaClient.
  */
 public class BaseRequestEntity 
   implements RequestEntity {

Modified: incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/app/AppTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/app/AppTest.java?view=diff&rev=555748&r1=555747&r2=555748
==============================================================================
--- incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/app/AppTest.java (original)
+++ incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/app/AppTest.java Thu Jul 12 13:33:32 2007
@@ -41,8 +41,7 @@
 import org.apache.abdera.model.Workspace;
 import org.apache.abdera.parser.Parser;
 import org.apache.abdera.parser.ParserOptions;
-import org.apache.abdera.protocol.client.Client;
-import org.apache.abdera.protocol.client.CommonsClient;
+import org.apache.abdera.protocol.client.AbderaClient;
 import org.apache.abdera.protocol.client.RequestOptions;
 import org.apache.abdera.protocol.client.ClientResponse;
 import org.apache.abdera.test.client.JettyTest;
@@ -331,20 +330,20 @@
   }  
   
   public void testRequestOptions() throws Exception {
-    Client client = new CommonsClient();
-    RequestOptions options = client.getDefaultRequestOptions();
+    AbderaClient abderaClient = new AbderaClient();
+    RequestOptions options = abderaClient.getDefaultRequestOptions();
     options.setIfModifiedSince(new Date());
     assertNotNull(options.getIfModifiedSince());
   }
   
   public void testAppClient() throws Exception {
-    Client client = new CommonsClient();
+    AbderaClient abderaClient = new AbderaClient();
     Entry entry = getFactory().newEntry();
-    RequestOptions options = client.getDefaultRequestOptions();
+    RequestOptions options = abderaClient.getDefaultRequestOptions();
     options.setHeader("Connection", "close");
 
     // do the introspection step
-    ClientResponse response = client.get("http://localhost:8080/service",
+    ClientResponse response = abderaClient.get("http://localhost:8080/service",
                                          options);
     String col_uri;
 
@@ -369,7 +368,7 @@
     }
 
     // post a new entry
-    response = client.post(col_uri, entry, options);
+    response = abderaClient.post(col_uri, entry, options);
 
     String self_uri;
 
@@ -384,7 +383,7 @@
     }
  
     // get the collection to see if our entry is there
-    response = client.get(col_uri, options);
+    response = abderaClient.get(col_uri, options);
 
     try {
       assertEquals(200, response.getStatus());
@@ -395,7 +394,7 @@
     }
 
     // get the entry to see if we can get it
-    response = client.get(self_uri, options);
+    response = abderaClient.get(self_uri, options);
 
     String edit_uri;
 
@@ -418,7 +417,7 @@
     }
 
     // submit the changed entry back to the server
-    response = client.put(edit_uri, entry, options);
+    response = abderaClient.put(edit_uri, entry, options);
 
     try {
       assertEquals(204, response.getStatus());
@@ -427,7 +426,7 @@
     }
 
     // check to see if the entry was modified properly
-    response = client.get(self_uri, options);
+    response = abderaClient.get(self_uri, options);
 
     try {
       assertEquals(200, response.getStatus());
@@ -439,7 +438,7 @@
     }
 
     // delete the entry
-    response = client.delete(edit_uri, options);
+    response = abderaClient.delete(edit_uri, options);
 
     try {
       assertEquals(204, response.getStatus());
@@ -448,7 +447,7 @@
     }
 
     // is it gone?
-    response = client.get(self_uri, options);
+    response = abderaClient.get(self_uri, options);
 
     try {
       assertEquals(404, response.getStatus());
@@ -461,11 +460,11 @@
     // Now let's try to do a media post
     
     // Post the media resource
-    options = client.getDefaultRequestOptions();
+    options = abderaClient.getDefaultRequestOptions();
     options.setContentType("text/plain");
     options.setHeader("Connection", "close");
 
-    response = client.post(col_uri,
+    response = abderaClient.post(col_uri,
                            new ByteArrayInputStream("test".getBytes()),
                            options);
 
@@ -480,9 +479,9 @@
     }
 
     // was an entry created?
-    options = client.getDefaultRequestOptions();
+    options = abderaClient.getDefaultRequestOptions();
     options.setHeader("Connection", "close");
-    response = client.get(self_uri, options);
+    response = abderaClient.get(self_uri, options);
 
     String edit_media, media;
 
@@ -509,11 +508,11 @@
     }
 
     // submit the changes
-    options = client.getDefaultRequestOptions();
+    options = abderaClient.getDefaultRequestOptions();
     options.setContentType("application/atom+xml;type=entry");
     options.setHeader("Connection", "close");
 
-    response = client.put(edit_uri, entry, options);
+    response = abderaClient.put(edit_uri, entry, options);
 
     try {
       assertEquals(204, response.getStatus());
@@ -522,7 +521,7 @@
     }
 
     // get the media resource
-    response = client.get(media);
+    response = abderaClient.get(media);
 
     try {
       assertEquals(200, response.getStatus());
@@ -534,11 +533,11 @@
     }
 
     // edit the media resource
-    options = client.getDefaultRequestOptions();
+    options = abderaClient.getDefaultRequestOptions();
     options.setHeader("Connection", "close");
     options.setContentType("text/plain");
 
-    response = client.put(edit_media,
+    response = abderaClient.put(edit_media,
                           new ByteArrayInputStream("TEST".getBytes()),
                           options);
 
@@ -549,7 +548,7 @@
     }
 
     // was the resource changed?
-    response = client.get(media, options);
+    response = abderaClient.get(media, options);
 
     try {
       assertEquals(200, response.getStatus());
@@ -561,7 +560,7 @@
     }
 
     // delete the entry
-    response = client.delete(edit_uri, options);
+    response = abderaClient.delete(edit_uri, options);
 
     try {
       assertEquals(204, response.getStatus());
@@ -570,7 +569,7 @@
     }
 
     // is the entry gone?
-    response = client.get(self_uri, options);
+    response = abderaClient.get(self_uri, options);
 
     try {
       assertEquals(404, response.getStatus());
@@ -581,7 +580,7 @@
     // is the media resource gone?
     options.setNoCache(true); // need to force revalidation to check
 
-    response = client.get(media, options);
+    response = abderaClient.get(media, options);
 
     try {
       assertEquals(404, response.getStatus());

Modified: incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/cache/CacheTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/cache/CacheTest.java?view=diff&rev=555748&r1=555747&r2=555748
==============================================================================
--- incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/cache/CacheTest.java (original)
+++ incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/cache/CacheTest.java Thu Jul 12 13:33:32 2007
@@ -22,14 +22,11 @@
 import java.io.IOException;
 import java.io.InputStream;
 
-import org.apache.abdera.protocol.client.Client;
-import org.apache.abdera.protocol.client.CommonsClient;
+import org.apache.abdera.protocol.client.AbderaClient;
 import org.apache.abdera.protocol.client.RequestOptions;
 import org.apache.abdera.protocol.client.ClientResponse;
 import org.apache.abdera.protocol.client.cache.CachedResponse;
 import org.apache.abdera.test.client.JettyTest;
-import org.apache.commons.httpclient.UsernamePasswordCredentials;
-import org.mortbay.jetty.servlet.ServletHandler;
 
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
@@ -209,7 +206,7 @@
 //      being cacheable (e.g. using Cache-Control: public). So this test 
 //      was testing incorrect behavior. 
     
-//    Client client = new CommonsClient();
+//    AbderaClient client = new CommonsClient();
 //    client.usePreemptiveAuthentication(true);
 //    client.addCredentials(CHECK_AUTH, null, null, new UsernamePasswordCredentials("james","snell"));
 //    RequestOptions options = client.getDefaultRequestOptions();
@@ -261,18 +258,18 @@
   }
   
   public void testResponseMustRevalidate() throws Exception {
-    Client client = new CommonsClient();
-    RequestOptions options = client.getDefaultRequestOptions();
+    AbderaClient abderaClient = new AbderaClient();
+    RequestOptions options = abderaClient.getDefaultRequestOptions();
     options.setHeader("Connection", "close");
     options.setHeader("x-reqnum", "1");
-    ClientResponse response = client.get(CHECK_MUST_REVALIDATE, options);
+    ClientResponse response = abderaClient.get(CHECK_MUST_REVALIDATE, options);
   
     String resp1 = getResponse(response);
     assertEquals(resp1, "1");
     
     // Should be revalidated and use the cache
     options.setHeader("x-reqnum", "2");
-    response = client.get(CHECK_MUST_REVALIDATE, options);
+    response = abderaClient.get(CHECK_MUST_REVALIDATE, options);
     assertTrue(response instanceof CachedResponse);
     
     String resp2 = getResponse(response);
@@ -280,7 +277,7 @@
     
     // Should be revalidated and return a 404
     options.setHeader("x-reqnum", "3");
-    response = client.get(CHECK_MUST_REVALIDATE, options);  
+    response = abderaClient.get(CHECK_MUST_REVALIDATE, options);  
     assertEquals(response.getStatus(), 404);
     response.release();
 
@@ -288,11 +285,11 @@
   
   private void _methodInvalidates(int type) throws Exception {
     
-    Client client = new CommonsClient();
-    RequestOptions options = client.getDefaultRequestOptions();
+    AbderaClient abderaClient = new AbderaClient();
+    RequestOptions options = abderaClient.getDefaultRequestOptions();
     options.setHeader("Connection", "close");
     options.setHeader("x-reqnum", "1");
-    ClientResponse response = client.get(CHECK_CACHE_INVALIDATE, options);
+    ClientResponse response = abderaClient.get(CHECK_CACHE_INVALIDATE, options);
   
     String resp1 = getResponse(response);
     response.release();
@@ -302,19 +299,19 @@
     options.setHeader("x-reqnum", "2");
     switch(type) {
       case POST:  
-        response = client.post(
+        response = abderaClient.post(
           CHECK_CACHE_INVALIDATE, 
           new ByteArrayInputStream("".getBytes()), 
           options);
         break;
       case PUT:
-        response = client.put(
+        response = abderaClient.put(
           CHECK_CACHE_INVALIDATE, 
           new ByteArrayInputStream("".getBytes()), 
           options);
         break;
       case DELETE:
-        response = client.delete(
+        response = abderaClient.delete(
           CHECK_CACHE_INVALIDATE, 
           options);
         break;
@@ -322,7 +319,7 @@
     response.release();
     
     options.setHeader("x-reqnum", "3");
-    response = client.get(CHECK_CACHE_INVALIDATE, options);
+    response = abderaClient.get(CHECK_CACHE_INVALIDATE, options);
   
     resp1 = getResponse(response);
     response.release();
@@ -331,11 +328,11 @@
   
   private void _requestCacheInvalidation(int type) throws Exception {
     
-    Client client = new CommonsClient();
-    RequestOptions options = client.getDefaultRequestOptions();
+    AbderaClient abderaClient = new AbderaClient();
+    RequestOptions options = abderaClient.getDefaultRequestOptions();
     options.setHeader("Connection", "close");
     options.setHeader("x-reqnum", "1");
-    ClientResponse response = client.get(CHECK_CACHE_INVALIDATE, options);  
+    ClientResponse response = abderaClient.get(CHECK_CACHE_INVALIDATE, options);  
     String resp1 = getResponse(response);
     assertEquals(resp1, "1");
     
@@ -346,7 +343,7 @@
       case NOSTORE: options.setNoStore(true); break;
       case MAXAGE0: options.setMaxAge(0); break;
     }
-    response = client.get(CHECK_CACHE_INVALIDATE, options);
+    response = abderaClient.get(CHECK_CACHE_INVALIDATE, options);
   
     String resp2 = getResponse(response);
     assertEquals(resp2, "2");
@@ -358,7 +355,7 @@
       case NOSTORE: options.setNoStore(false); break;
       case MAXAGE0: options.setMaxAge(60); break;
     }
-    response = client.get(CHECK_CACHE_INVALIDATE, options);
+    response = abderaClient.get(CHECK_CACHE_INVALIDATE, options);
   
     String resp3 = getResponse(response);
     assertEquals(resp3, "2");
@@ -366,26 +363,26 @@
   
   private void _responseNoCache(int type) throws Exception {
     
-    Client client = new CommonsClient();
-    RequestOptions options = client.getDefaultRequestOptions();
+    AbderaClient abderaClient = new AbderaClient();
+    RequestOptions options = abderaClient.getDefaultRequestOptions();
     options.setHeader("Connection", "close");
     options.setHeader("x-reqnum", "1");
     options.setHeader("x-reqtest", String.valueOf(type));
-    ClientResponse response = client.get(CHECK_NO_CACHE, options);
+    ClientResponse response = abderaClient.get(CHECK_NO_CACHE, options);
   
     String resp1 = getResponse(response);
     assertEquals(resp1, "1");
     
     // Should not use the cache
     options.setHeader("x-reqnum", "2");
-    response = client.get(CHECK_NO_CACHE, options);
+    response = abderaClient.get(CHECK_NO_CACHE, options);
   
     String resp2 = getResponse(response);
     assertEquals(resp2, "2");
     
     // Should use the cache
     options.setHeader("x-reqnum", "3");
-    response = client.get(CHECK_NO_CACHE, options);
+    response = abderaClient.get(CHECK_NO_CACHE, options);
   
     String resp3 = getResponse(response);
     assertEquals(resp3, "3");

Modified: incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/Main.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/Main.java?view=diff&rev=555748&r1=555747&r2=555748
==============================================================================
--- incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/Main.java (original)
+++ incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/Main.java Thu Jul 12 13:33:32 2007
@@ -27,8 +27,7 @@
 import org.apache.abdera.model.Entry;
 import org.apache.abdera.model.Link;
 import org.apache.abdera.model.Service;
-import org.apache.abdera.protocol.client.Client;
-import org.apache.abdera.protocol.client.CommonsClient;
+import org.apache.abdera.protocol.client.AbderaClient;
 import org.apache.abdera.i18n.iri.IRI;
 
 
@@ -37,13 +36,13 @@
   public static void main(String[] args) throws Exception {
     
     Abdera abdera = new Abdera();
-    Client client = new CommonsClient(abdera);
+    AbderaClient abderaClient = new AbderaClient(abdera);
     Factory factory = abdera.getFactory();
     
     // Perform introspection.  This is an optional step.  If you already
     // know the URI of the APP collection to POST to, you can skip it.
     Document<Service> introspection = 
-      client.get(
+      abderaClient.get(
         args[0]).getDocument();
     Service service = 
       introspection.getRoot();
@@ -63,7 +62,7 @@
     report("The Entry to Post", entry.toString());
     
     // Post the entry. Be sure to grab the resolved HREF of the collection
-    Document<Entry> doc = client.post(
+    Document<Entry> doc = abderaClient.post(
       collection.getResolvedHref().toString(), 
       entry).getDocument();
     
@@ -80,16 +79,16 @@
     // If there is an Edit Link, we can edit the entry
     if (editUri != null) {
       // Before we can edit, we need to grab an "editable" representation
-      doc = client.get(editUri.toString()).getDocument();    
+      doc = abderaClient.get(editUri.toString()).getDocument();    
       
       // Change whatever you want in the retrieved entry
       doc.getRoot().getTitleElement().setValue("This is the changed title");
       
       // Put it back to the server
-      client.put(editUri.toString(), doc.getRoot());
+      abderaClient.put(editUri.toString(), doc.getRoot());
       
       // This is just to show that the entry has been modified
-      doc = client.get(entryUri.toString()).getDocument();
+      doc = abderaClient.get(entryUri.toString()).getDocument();
       report("The Modified Entry", doc.getRoot().toString());
     } else {
       // Otherwise, the entry cannot be modified (no suitable edit link was found)
@@ -98,10 +97,10 @@
 
     // Delete the entry.  Again, we need to make sure that we have the current
     // edit link for the entry
-    doc = client.get(entryUri.toString()).getDocument();
+    doc = abderaClient.get(entryUri.toString()).getDocument();
     editUri = getEditUri(doc.getRoot());
     if (editUri != null) {
-      client.delete(editUri.toString());
+      abderaClient.delete(editUri.toString());
       report("The Enry has been deleted", null);
     } else {
       report("The Entry cannot be deleted", null);

Modified: incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/Services.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/Services.java?view=diff&rev=555748&r1=555747&r2=555748
==============================================================================
--- incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/Services.java (original)
+++ incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/Services.java Thu Jul 12 13:33:32 2007
@@ -33,8 +33,7 @@
 import org.apache.abdera.model.Service;
 import org.apache.abdera.parser.stax.util.FOMHelper;
 import org.apache.abdera.protocol.Response;
-import org.apache.abdera.protocol.client.Client;
-import org.apache.abdera.protocol.client.CommonsClient;
+import org.apache.abdera.protocol.client.AbderaClient;
 import org.apache.abdera.protocol.client.RequestOptions;
 import org.apache.commons.httpclient.UsernamePasswordCredentials;
 import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
@@ -57,21 +56,21 @@
     entry.setContentAsXhtml("<p>This is an example post to the new blogger beta</p>");
     
     // Initialize the client
-    Client client = new CommonsClient(abdera);
+    AbderaClient abderaClient = new AbderaClient(abdera);
     
     // Get and set the GoogleLogin authentication token
     GoogleLoginAuthCredentials creds = 
       new GoogleLoginAuthCredentials(
         "username", "password","blogger");
-    client.addCredentials(
+    abderaClient.addCredentials(
       "http://beta.blogger.com", 
       null, "GoogleLogin", creds);
     
-    RequestOptions options = client.getDefaultRequestOptions();
+    RequestOptions options = abderaClient.getDefaultRequestOptions();
     options.setUseChunked(false);
     
     // Post the entry
-    Response response = client.post(
+    Response response = abderaClient.post(
       "http://beta.blogger.com/feeds/7352231422284704069/posts/full", 
       entry, options);
     
@@ -103,20 +102,20 @@
     entry.setContentAsHtml("<p>This is an example post to Roller</p>");
     
     // Initialize the client and set the authentication credentials
-    Client client = new CommonsClient(abdera);
-    client.addCredentials(
+    AbderaClient abderaClient = new AbderaClient(abdera);
+    abderaClient.addCredentials(
     start, null, null, 
     new UsernamePasswordCredentials(
       "username", "password"));
     
     // Get the service document and look up the collection uri
-    Document<Service> service_doc = client.get(start).getDocument();
+    Document<Service> service_doc = abderaClient.get(start).getDocument();
     Service service = service_doc.getRoot();
     Collection collection = service.getWorkspaces().get(0).getCollections().get(0);
     String uri = collection.getHref().toString();
       
     // Post the entry to the collection
-    Response response = client.post(uri, entry);
+    Response response = abderaClient.post(uri, entry);
     
     // Check the result
     if (response.getStatus() == 201)
@@ -140,14 +139,14 @@
     InputStreamRequestEntity re = new InputStreamRequestEntity(fis, "audio/mp3");
     
     // Initialize the client and set the auth credentials
-    Client client = new CommonsClient(abdera);
-    client.addCredentials(
+    AbderaClient abderaClient = new AbderaClient(abdera);
+    abderaClient.addCredentials(
     start, null, null, 
     new UsernamePasswordCredentials(
       "username", "password"));
     
     // Get the service doc and locate the href of the collection
-    Document<Service> service_doc = client.get(start).getDocument();
+    Document<Service> service_doc = abderaClient.get(start).getDocument();
     Service service = service_doc.getRoot();
     Collection collection = service.getWorkspaces().get(0).getCollections().get(1);
     String uri = collection.getHref().toString();
@@ -155,11 +154,11 @@
     // Set the filename.  Note: the Title header was used by older drafts
     // of the Atom Publishing Protocol and should no longer be used.  The
     // current Roller APP implementation still currently requires it.
-    RequestOptions options = client.getDefaultRequestOptions();
+    RequestOptions options = abderaClient.getDefaultRequestOptions();
     options.setHeader("Title", "mypodcast.mp3");
     
     // Post the entry
-    Response response = client.post(uri, re, options);
+    Response response = abderaClient.post(uri, re, options);
     
     // Check the response
     if (response.getStatus() == 201)
@@ -211,29 +210,29 @@
     el.setAttributeValue("endTime", AtomDate.valueOf(new Date()).toString());
     
     // Prepare the client
-    Client client = new CommonsClient(abdera);
+    AbderaClient abderaClient = new AbderaClient(abdera);
     
     // Get and set the GoogleLogin auth token
     GoogleLoginAuthCredentials creds = 
       new GoogleLoginAuthCredentials(
         "username", "password","cl");
-    client.addCredentials(
+    abderaClient.addCredentials(
       "http://www.google.com/calendar", 
       null, "GoogleLogin", creds);
     
     String uri = "http://www.google.com/calendar/feeds/default/private/full";
     
-    RequestOptions options = client.getDefaultRequestOptions();
+    RequestOptions options = abderaClient.getDefaultRequestOptions();
     options.setUseChunked(false);
     
     // Post the entry
-    Response response = client.post(uri, entry, options);
+    Response response = abderaClient.post(uri, entry, options);
     
     // Google Calendar might return a 302 response with a new POST URI.
     // If it does, get the new URI and post again
     if (response.getStatus() == 302) {
       uri = response.getLocation().toString();
-      response = client.post(uri, entry, options);
+      response = abderaClient.post(uri, entry, options);
     }
     
     // Check the response

Modified: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/editor/Editor.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/editor/Editor.java?view=diff&rev=555748&r1=555747&r2=555748
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/editor/Editor.java (original)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/editor/Editor.java Thu Jul 12 13:33:32 2007
@@ -35,21 +35,20 @@
 import org.apache.abdera.model.Feed;
 import org.apache.abdera.model.Service;
 import org.apache.abdera.model.Workspace;
-import org.apache.abdera.protocol.client.Client;
+import org.apache.abdera.protocol.client.AbderaClient;
 import org.apache.abdera.protocol.client.ClientResponse;
-import org.apache.abdera.protocol.client.CommonsClient;
 import org.apache.abdera.protocol.client.RequestOptions;
 import org.apache.abdera.util.EntityTag;
 
 /**
- * A rudimentary, and currently incomplete editor client.  Encapsulates the
- * use of the client module apis to interact with APP servers. 
+ * A rudimentary, and currently incomplete editor abderaClient.  Encapsulates the
+ * use of the abderaClient module apis to interact with APP servers. 
  */
 public class Editor {
 
   private final Abdera abdera;
   private final Service service;
-  private final Client client;
+  private final AbderaClient abderaClient;
   private Workspace workspace;
   private Collection collection;
   private Document<Feed> feeddoc;
@@ -70,10 +69,10 @@
     Abdera abdera,
     String serviceDocument) {
     this.abdera = abdera;
-    this.client = new CommonsClient(abdera);
+    this.abderaClient = new AbderaClient(abdera);
     Document<Service> servicedoc = 
       getDocument(
-        client, 
+        abderaClient, 
         abdera, 
         serviceDocument);
     this.service = servicedoc.getRoot();
@@ -84,15 +83,15 @@
     Service service) {
       this.abdera = abdera;
       this.service = service;
-      this.client = new CommonsClient(abdera);
+      this.abderaClient = new AbderaClient(abdera);
   }
   
   private static <T extends Element>Document<T> getDocument(
-    Client client,
+    AbderaClient abderaClient,
     Abdera abdera, 
     String document) {
     
-    ClientResponse resp = client.get(document);
+    ClientResponse resp = abderaClient.get(document);
     switch(resp.getType()) {
       case SUCCESS:
         Document<T> doc = resp.getDocument();
@@ -121,8 +120,8 @@
     return service;
   }
   
-  public Client getClient() {
-    return client;
+  public AbderaClient getClient() {
+    return abderaClient;
   }
   
   public List<Workspace> getWorkspaces() {
@@ -159,7 +158,7 @@
       if (this.feeddoc == null) {
         this.feeddoc = 
           getDocument(
-            client, 
+            abderaClient, 
             abdera, 
             collection.getResolvedHref().toString());
       }
@@ -186,7 +185,7 @@
       if (np != null) {
         this.feeddoc = 
           getDocument(
-            client, 
+            abderaClient, 
             abdera, 
             np.toString());
       }
@@ -212,7 +211,7 @@
       if (np != null) {
         this.feeddoc = 
           getDocument(
-            client, 
+            abderaClient, 
             abdera, 
             np.toString());
       }
@@ -247,7 +246,7 @@
     
     private void getMedia(IRI editMediaLink) 
       throws IOException {
-      ClientResponse resp = client.get(editMediaLink.toString());
+      ClientResponse resp = abderaClient.get(editMediaLink.toString());
       switch(resp.getType()) {
         case SUCCESS:
           this.media = resp.getInputStream();
@@ -287,14 +286,14 @@
     }
     
     public boolean delete() {
-      RequestOptions options = client.getDefaultRequestOptions();
+      RequestOptions options = abderaClient.getDefaultRequestOptions();
       if (etag != null) {
         options.setIfMatch(etag.toString());
       }
       if (lastModified != null && etag == null) {
         options.setIfUnmodifiedSince(lastModified);
       }
-      ClientResponse resp = client.delete(editMediaLink.toString(),options);
+      ClientResponse resp = abderaClient.delete(editMediaLink.toString(),options);
       switch(resp.getType()) {
         case SUCCESS:
           return true;
@@ -310,7 +309,7 @@
     }
     
     public boolean save() {
-      RequestOptions options = client.getDefaultRequestOptions();
+      RequestOptions options = abderaClient.getDefaultRequestOptions();
       if (etag != null) {
         options.setIfMatch(etag.toString());
       }
@@ -318,7 +317,7 @@
         options.setIfUnmodifiedSince(lastModified);
       }
       if (contentType != null) options.setContentType(contentType);
-      ClientResponse resp = client.put(editMediaLink.toString(), media, options);
+      ClientResponse resp = abderaClient.put(editMediaLink.toString(), media, options);
       switch(resp.getType()) {
         case SUCCESS:
           return true;
@@ -350,7 +349,7 @@
     public EntryEditor(Entry entry) {
       this.editLink = entry.getEditLinkResolvedHref();
       this.editMediaLink = entry.getEditMediaLinkResolvedHref();
-      entryDoc = getDocument(client,abdera,this.editLink.toString());
+      entryDoc = getDocument(abderaClient,abdera,this.editLink.toString());
     }
     
     public Entry getEntry() {
@@ -369,7 +368,7 @@
     }
     
     public boolean delete() {
-      RequestOptions options = client.getDefaultRequestOptions();
+      RequestOptions options = abderaClient.getDefaultRequestOptions();
       EntityTag etag = entryDoc.getEntityTag();
       Date lm = entryDoc.getLastModified();
       if (etag != null) {
@@ -378,7 +377,7 @@
       if (lm != null && etag == null) {
         options.setIfUnmodifiedSince(lm);
       }
-      ClientResponse resp = client.delete(editLink.toString(),options);
+      ClientResponse resp = abderaClient.delete(editLink.toString(),options);
       switch(resp.getType()) {
         case SUCCESS:
           return true;
@@ -394,7 +393,7 @@
     }
     
     public boolean save() {
-      RequestOptions options = client.getDefaultRequestOptions();
+      RequestOptions options = abderaClient.getDefaultRequestOptions();
       EntityTag etag = entryDoc.getEntityTag();
       Date lm = entryDoc.getLastModified();
       if (etag != null) {
@@ -403,7 +402,7 @@
       if (lm != null && etag == null) {
         options.setIfUnmodifiedSince(lm);
       }
-      ClientResponse resp = client.put(editLink.toString(), entryDoc, options);
+      ClientResponse resp = abderaClient.put(editLink.toString(), entryDoc, options);
       switch(resp.getType()) {
         case SUCCESS:
           return true;
@@ -420,7 +419,7 @@
     
     public void refresh() {
       entryDoc = getDocument(
-        client, 
+        abderaClient, 
         abdera, 
         editLink.toString());
     }

Modified: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthCredentials.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthCredentials.java?view=diff&rev=555748&r1=555747&r2=555748
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthCredentials.java (original)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthCredentials.java Thu Jul 12 13:33:32 2007
@@ -20,7 +20,7 @@
 import org.apache.commons.httpclient.Credentials;
 
 /**
- * <p>When using the GoogleLoginAuthScheme with the typical Commons Client
+ * <p>When using the GoogleLoginAuthScheme with the typical Commons AbderaClient
  * UsernamePasswordCredentials, the AuthScheme implementation will request
  * a new auth token from the Google server for every request.  To make it 
  * a more efficient, clients can use GoogleLoginAuthCredentials which will
@@ -30,7 +30,7 @@
  * <pre>
  *    GoogleLoginAuthScheme.register();
  *   
- *   Client client = new CommonsClient();
+ *   AbderaClient client = new CommonsClient();
  *   
  *   GoogleLoginAuthCredentials credentials = 
  *     new GoogleLoginAuthCredentials(

Modified: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthScheme.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthScheme.java?view=diff&rev=555748&r1=555747&r2=555748
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthScheme.java (original)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthScheme.java Thu Jul 12 13:33:32 2007
@@ -22,9 +22,8 @@
 import java.net.URLEncoder;
 import java.util.Formatter;
 
-import org.apache.abdera.protocol.client.Client;
+import org.apache.abdera.protocol.client.AbderaClient;
 import org.apache.abdera.protocol.client.ClientResponse;
-import org.apache.abdera.protocol.client.CommonsClient;
 import org.apache.abdera.protocol.client.RequestOptions;
 import org.apache.abdera.util.Version;
 import org.apache.commons.httpclient.Credentials;
@@ -43,7 +42,7 @@
  * <pre>
  *   GoogleLoginAuthScheme.register();
  *   
- *   Client client = new CommonsClient();
+ *   AbderaClient client = new CommonsClient();
  *   client.addCredentials(
  *     "http://beta.blogger.com", 
  *     null, "GoogleLogin", 
@@ -55,12 +54,12 @@
   extends RFC2617Scheme
   implements AuthScheme {
   
-  public static void register(Client client, boolean exclusive) {
-    Client.registerScheme("GoogleLogin", GoogleLoginAuthScheme.class);
+  public static void register(AbderaClient abderaClient, boolean exclusive) {
+    AbderaClient.registerScheme("GoogleLogin", GoogleLoginAuthScheme.class);
     if (exclusive)
-      ((CommonsClient)client).setAuthenticationSchemePriority("GoogleLogin");
+      ((AbderaClient)abderaClient).setAuthenticationSchemePriority("GoogleLogin");
     else
-      ((CommonsClient)client).setAuthenticationSchemeDefaults();
+      ((AbderaClient)abderaClient).setAuthenticationSchemeDefaults();
   }
   
   private String service = null;
@@ -125,7 +124,7 @@
   
   protected String getAuth(String id, String pwd, String service) {
     try {
-      Client client = new CommonsClient();
+      AbderaClient abderaClient = new AbderaClient();
       Formatter f = new Formatter();
       f.format(
         "Email=%s&Passwd=%s&service=%s&source=%s",
@@ -136,9 +135,9 @@
       StringRequestEntity stringreq = new StringRequestEntity(
         f.toString(),"application/x-www-form-urlencoded","utf-8");
       String uri = "https://www.google.com/accounts/ClientLogin";
-      RequestOptions options = client.getDefaultRequestOptions();
+      RequestOptions options = abderaClient.getDefaultRequestOptions();
       options.setContentType("application/x-www-form-urlencoded");
-      ClientResponse response = client.post(uri, stringreq, options);
+      ClientResponse response = abderaClient.post(uri, stringreq, options);
       InputStream in = response.getInputStream();
       ByteArrayOutputStream out = new ByteArrayOutputStream();
       int n = -1;

Modified: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/wsse/WSSEAuthScheme.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/wsse/WSSEAuthScheme.java?view=diff&rev=555748&r1=555747&r2=555748
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/wsse/WSSEAuthScheme.java (original)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/wsse/WSSEAuthScheme.java Thu Jul 12 13:33:32 2007
@@ -22,8 +22,7 @@
 import java.util.Date;
 
 import org.apache.abdera.model.AtomDate;
-import org.apache.abdera.protocol.client.Client;
-import org.apache.abdera.protocol.client.CommonsClient;
+import org.apache.abdera.protocol.client.AbderaClient;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.codec.binary.Hex;
 import org.apache.commons.httpclient.Credentials;
@@ -34,7 +33,7 @@
 import org.apache.commons.httpclient.auth.RFC2617Scheme;
 
 /**
- * WSSE Auth Scheme implementation for use with HTTP Commons Client
+ * WSSE Auth Scheme implementation for use with HTTP Commons AbderaClient
  * Some APP implementations use WSSE for authentication
  * 
  * @see http://www.xml.com/pub/a/2003/12/17/dive.html
@@ -45,12 +44,12 @@
 
   private final int NONCE_LENGTH = 16;
   
-  public static void register(Client client, boolean exclusive) {
-    Client.registerScheme("WSSE", WSSEAuthScheme.class);
+  public static void register(AbderaClient abderaClient, boolean exclusive) {
+    AbderaClient.registerScheme("WSSE", WSSEAuthScheme.class);
     if (exclusive)
-      ((CommonsClient)client).setAuthenticationSchemePriority("WSSE");
+      ((AbderaClient)abderaClient).setAuthenticationSchemePriority("WSSE");
     else
-      ((CommonsClient)client).setAuthenticationSchemeDefaults();
+      ((AbderaClient)abderaClient).setAuthenticationSchemeDefaults();
   }
   
   public String authenticate(

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/servlet/DHEncryptedResponseFilter.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/servlet/DHEncryptedResponseFilter.java?view=diff&rev=555748&r1=555747&r2=555748
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/servlet/DHEncryptedResponseFilter.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/servlet/DHEncryptedResponseFilter.java Thu Jul 12 13:33:32 2007
@@ -32,7 +32,7 @@
  * 
  * X-DH: p={dh_p}, g={dh_g}, l={dh_l}, k={base64_pubkey}
  * 
- * Example Client Code:
+ * Example AbderaClient Code:
  * <pre>
  *   DHContext context = new DHContext();
  *   Abdera abdera = new Abdera();

Modified: incubator/abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/DSigThirdPartyVerifyTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/DSigThirdPartyVerifyTest.java?view=diff&rev=555748&r1=555747&r2=555748
==============================================================================
--- incubator/abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/DSigThirdPartyVerifyTest.java (original)
+++ incubator/abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/DSigThirdPartyVerifyTest.java Thu Jul 12 13:33:32 2007
@@ -29,9 +29,8 @@
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.model.Entry;
-import org.apache.abdera.protocol.client.Client;
+import org.apache.abdera.protocol.client.AbderaClient;
 import org.apache.abdera.protocol.client.ClientResponse;
-import org.apache.abdera.protocol.client.CommonsClient;
 import org.apache.abdera.protocol.client.RequestOptions;
 import org.apache.abdera.protocol.client.util.BaseRequestEntity;
 import org.apache.abdera.security.AbderaSecurity;
@@ -98,11 +97,11 @@
           "Signature")));
 
     // Verify the signature with Verisign's "Signed Ping" interop endpoint
-    Client client = new CommonsClient();
-    RequestOptions reqoptions = client.getDefaultRequestOptions();
+    AbderaClient abderaClient = new AbderaClient();
+    RequestOptions reqoptions = abderaClient.getDefaultRequestOptions();
     reqoptions.setContentType("application/xml");
     BaseRequestEntity bre = new BaseRequestEntity(entry,false);
-    ClientResponse response = client.post(
+    ClientResponse response = abderaClient.post(
       "http://verisignlabs.com/tg/verify", 
       bre, reqoptions);
     assertEquals(200, response.getStatus());



Mime
View raw message