abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1239261 [2/2] - in /abdera/abdera2: ./ activities/src/main/java/org/apache/abdera2/activities/client/ activities/src/main/java/org/apache/abdera2/activities/extra/ client/src/main/java/org/apache/abdera2/protocol/client/ common/ common/src...
Date Wed, 01 Feb 2012 18:49:12 GMT
Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/RequestOptions.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/RequestOptions.java?rev=1239261&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/RequestOptions.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/RequestOptions.java Wed Feb  1 18:49:11 2012
@@ -0,0 +1,602 @@
+/*
+ * 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.abdera2.common.protocol;
+
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import javax.activation.MimeType;
+
+import org.apache.abdera2.common.Localizer;
+import org.apache.abdera2.common.lang.Lang;
+import org.apache.abdera2.common.misc.ExceptionHelper;
+import org.apache.abdera2.common.misc.MoreFunctions;
+import org.apache.abdera2.common.selector.AbstractSelector;
+import org.apache.abdera2.common.selector.Selector;
+import org.apache.abdera2.common.text.Codec;
+import org.apache.abdera2.common.text.UrlEncoding;
+import org.apache.abdera2.common.text.CharUtils.Profile;
+import org.apache.abdera2.common.date.DateTimes;
+import org.apache.abdera2.common.http.Authentication;
+import org.apache.abdera2.common.http.CacheControl;
+import org.apache.abdera2.common.http.EntityTag;
+import org.apache.abdera2.common.http.Preference;
+import org.apache.abdera2.common.http.WebLink;
+import org.apache.http.impl.cookie.DateParseException;
+import org.apache.http.impl.cookie.DateUtils;
+import org.joda.time.DateTime;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Maps;
+
+/**
+ * The RequestOptions class allows a variety of options affecting the execution of the request to be modified.
+ */
+public class RequestOptions extends AbstractRequest implements Request {
+
+  public static Builder make() {
+    return new Builder();
+  }
+  
+  public static Builder make(DateTime ifModifiedSince) {
+    return make().ifModifiedSince(ifModifiedSince);
+  }
+
+  public static Builder make(String ifNoneMatch) {
+    return make().ifNoneMatch(ifNoneMatch);
+  }
+
+  public static Builder make(String etag, String... ifNoneMatch) {
+    return make().ifNoneMatch(etag, ifNoneMatch);
+  }
+
+  public static Builder make(DateTime ifModifiedSince, String ifNoneMatch) {
+    return make()
+      .ifModifiedSince(ifModifiedSince)
+      .ifNoneMatch(ifNoneMatch);
+  }
+
+  public static Builder make(DateTime ifModifiedSince, String etag, String... ifNoneMatch) {
+    return make()
+      .ifModifiedSince(ifModifiedSince)
+      .ifNoneMatch(etag, ifNoneMatch);
+  }
+
+  public static Builder make(boolean no_cache) {
+    return make().cacheControl(CacheControl.NOCACHE());
+  }
+  
+  public Builder template() {
+    return new Builder(this);
+  }
+  
+  public Builder template(Selector<Map.Entry<String, Set<String>>> filter) {
+    return new Builder(this,filter);
+  }
+  
+  public static Selector<Map.Entry<String, Set<String>>> withAllHeaders() {
+    return new AbstractSelector<Map.Entry<String, Set<String>>>() {
+      public boolean select(Object item) {
+        return true;
+      }
+    };
+  }
+  
+  public static Selector<Map.Entry<String, Set<String>>> withNoHeaders() {
+    return new AbstractSelector<Map.Entry<String, Set<String>>>() {
+      public boolean select(Object item) {
+        return false;
+      }
+    };
+  }
+  
+  @SuppressWarnings("unchecked")
+  public static Selector<Map.Entry<String, Set<String>>> withHeaders(String... names) {
+    final ImmutableSet<String> set = ImmutableSet.copyOf(names);
+    return new AbstractSelector<Map.Entry<String, Set<String>>>() {
+      public boolean select(Object item) {
+        Map.Entry<String, Set<String>> entry = 
+          (Entry<String, Set<String>>) item;
+        return set.contains(entry.getKey());
+      }
+    };
+  }
+  
+  @SuppressWarnings("unchecked")
+  public static Selector<Map.Entry<String, Set<String>>> withoutHeaders(String... names) {
+    final ImmutableSet<String> set = ImmutableSet.copyOf(names);
+    return new AbstractSelector<Map.Entry<String, Set<String>>>() {
+      public boolean select(Object item) {
+        Map.Entry<String, Set<String>> entry = 
+          (Entry<String, Set<String>>) item;
+        return !set.contains(entry.getKey());
+      }
+    };
+  }
+  
+  
+  public static class Builder implements Supplier<RequestOptions> {
+
+    boolean revalidateAuth = false;
+    boolean useChunked = false;
+    boolean usePostOverride = false;
+    boolean requestException4xx = false;
+    boolean requestException5xx = false;
+    boolean useExpectContinue = true;
+    boolean useConditional = true;
+    boolean followRedirects = true;
+    CacheControl cacheControl = null;
+    int waitForContinue = -1;
+    
+    final Map<String, ImmutableSet.Builder<String>> headers = 
+      Maps.newHashMap();
+    
+    public Builder() {}
+    
+    Builder(RequestOptions template) {
+      this(template,null);
+    }
+    
+    Builder(RequestOptions template,Selector<Map.Entry<String, Set<String>>> filter) {
+      this.revalidateAuth = template.revalidateAuth;
+      this.followRedirects = template.followRedirects;
+      this.cacheControl = template.cacheControl;
+      this.useChunked = template.useChunked;
+      this.usePostOverride = template.usePostOverride;
+      this.requestException4xx = template.requestException4xx;
+      this.requestException5xx = template.requestException5xx;
+      this.useExpectContinue = template.useExpectContinue;
+      this.useConditional = template.useConditional;
+      this.waitForContinue = template.waitForContinue;
+      for (Map.Entry<String, Set<String>> header : template.headers.entrySet()) {
+        if (filter == null || filter.apply(header)) {
+          ImmutableSet.Builder<String> builder = ImmutableSet.builder();
+          builder.addAll(header.getValue());
+          this.headers.put(header.getKey(),builder);
+        }
+      }
+    }
+    
+    public Builder revalidateAuth() {
+      this.revalidateAuth = true;
+      return this;
+    }
+    
+    public Builder useChunked() {
+      this.useChunked = true;
+      return this;
+    }
+    
+    public Builder usePostOverride() {
+      this.usePostOverride = true;
+      return this;
+    }
+    
+    public Builder requestException4xx() {
+      this.requestException4xx = true;
+      return this;
+    }
+    
+    public Builder requestException5xx() {
+      this.requestException5xx = true;
+      return this;
+    }
+    
+    public Builder doNotUseExpectContinue() {
+      this.useExpectContinue = false;
+      return this;
+    }
+    
+    public Builder waitForContinue(int millis) {
+      this.waitForContinue = millis;
+      return this;
+    }
+    
+    public Builder doNotFollowRedirects() {
+      this.followRedirects = false;
+      return this;
+    }
+    
+    public Builder contentType(String value) {
+      return header("Content-Type", value);
+    }
+
+    public Builder contentType(MimeType value) {
+      return header("Content-Type", value.toString());
+    }
+    
+    public Builder contentLocation(String iri) {
+      return header("Content-Location", iri);
+    }
+
+    public Builder setAuthorization(String auth) {
+      return header("Authorization", auth);
+    }
+
+    public Builder setAuthorization(Authentication auth) {
+      return header("Authorization",auth.toString());
+    }
+    
+    public Builder encodedHeader(String header, String charset, String value) {
+      return header(header, Codec.encode(value, charset));
+    }
+
+    public Builder encodedHeader(String header, String charset, String... values) {
+      if (values != null && values.length > 0) {
+        ImmutableSet.Builder<String> vals = headers.get(header);
+        if (vals == null) {
+          vals = ImmutableSet.builder();
+          headers.put(header, vals);
+        }
+        for (String value : values) 
+          vals.add(Codec.encode(value,charset));
+      }
+      return this;
+    }
+
+    public Builder header(String header, String value) {
+      if (value != null)
+        header(header, MoreFunctions.array(value));
+      return this;
+    }
+
+    public Builder header(String header, String... values) {
+      if (values != null && values.length > 0) {
+        ImmutableSet.Builder<String> vals = headers.get(header);
+        if (vals == null) {
+          vals = ImmutableSet.builder();
+          headers.put(header, vals);
+        }
+        vals.add(combine(values));
+      }
+      return this;
+    }
+
+    public Builder dateHeader(
+      String header, 
+      DateTime value) {
+      if (value != null)
+        header(header, DateUtils.formatDate(value.toDate()));
+      return this;
+    }
+
+    private String combine(String... values) {
+      StringBuilder v = new StringBuilder();
+      for (String val : values) {
+          if (v.length() > 0)
+              v.append(", ");
+          v.append(val);
+      }
+      return v.toString();
+    }
+
+    public Builder ifMatch(EntityTag entity_tag) {
+        return header("If-Match", entity_tag.toString());
+    }
+
+    /**
+     * Sets the value of the HTTP If-Match header
+     */
+    public Builder ifMatch(EntityTag tag, EntityTag... entity_tags) {
+        return header("If-Match", EntityTag.toString(tag,entity_tags));
+    }
+
+    /**
+     * Sets the value of the HTTP If-Match header
+     */
+    public Builder ifMatch(String etag, String... entity_tags) {
+        return header("If-Match", EntityTag.toString(etag, entity_tags));
+    }
+
+    /**
+     * Sets the value of the HTTP If-None-Match header
+     */
+    public Builder ifNoneMatch(String entity_tag) {
+        return ifNoneMatch(new EntityTag(entity_tag));
+    }
+
+    /**
+     * Sets the value of the HTTP If-None-Match header
+     */
+    public Builder ifNoneMatch(EntityTag entity_tag) {
+        return header("If-None-Match", entity_tag.toString());
+    }
+
+    /**
+     * Sets the value of the HTTP If-None-Match header
+     */
+    public Builder ifNoneMatch(EntityTag etag, EntityTag... entity_tags) {
+        return header("If-None-Match", EntityTag.toString(etag, entity_tags));
+    }
+
+    /**
+     * Sets the value of the HTTP If-None-Match header
+     */
+    public Builder ifNoneMatch(String etag, String... entity_tags) {
+        return header("If-None-Match", EntityTag.toString(etag, entity_tags));
+    }
+
+    /**
+     * Sets the value of the HTTP If-Modified-Since header
+     */
+    public Builder ifModifiedSince(DateTime date) {
+        return dateHeader("If-Modified-Since", date);
+    }
+    
+    public Builder ifModifiedSinceNow() {
+      return ifModifiedSince(DateTimes.now());
+    }
+
+    /**
+     * Sets the value of the HTTP If-Unmodified-Since header
+     */
+    public Builder ifUnmodifiedSince(DateTime date) {
+        return dateHeader("If-Unmodified-Since", date);
+    }
+
+    /**
+     * Sets the value of the HTTP Accept header
+     */
+    public Builder accept(String accept) {
+      return accept(new String[] {accept});
+    }
+
+    /**
+     * Sets the value of the HTTP Accept header
+     */
+    public Builder accept(String... accept) {
+      return header("Accept", combine(accept));
+    }
+
+    public Builder acceptLanguage(Locale locale) {
+      return acceptLanguage(Lang.fromLocale(locale));
+    }
+
+    public Builder acceptLanguage(Locale... locales) {
+      String[] langs = new String[locales.length];
+      for (int n = 0; n < locales.length; n++)
+          langs[n] = Lang.fromLocale(locales[n]);
+      acceptLanguage(langs);
+      return this;
+    }
+
+    /**
+     * Sets the value of the HTTP Accept-Language header
+     */
+    public Builder acceptLanguage(String accept) {
+        return acceptLanguage(new String[] {accept});
+    }
+
+    /**
+     * Sets the value of the HTTP Accept-Language header
+     */
+    public Builder acceptLanguage(String... accept) {
+      return header("Accept-Language", combine(accept));
+    }
+
+    /**
+     * Sets the value of the HTTP Accept-Charset header
+     */
+    public Builder acceptCharset(String accept) {
+      return acceptCharset(new String[] {accept});
+    }
+
+    /**
+     * Sets the value of the HTTP Accept-Charset header
+     */
+    public Builder acceptCharset(String... accept) {
+        return header("Accept-Charset", combine(accept));
+    }
+
+    /**
+     * Sets the value of the HTTP Accept-Encoding header
+     */
+    public Builder acceptEncoding(String accept) {
+        return acceptEncoding(new String[] {accept});
+    }
+
+    /**
+     * Sets the value of the HTTP Accept-Encoding header
+     */
+    public Builder acceptEncoding(String... accept) {
+        return header("Accept-Encoding", combine(accept));
+    }
+
+    /**
+     * Sets the value of the Atom Publishing Protocol Slug header
+     */
+    public Builder slug(String slug) {
+        if (slug.indexOf((char)10) > -1 || slug.indexOf((char)13) > -1)
+            throw new IllegalArgumentException(Localizer.get("SLUG.BAD.CHARACTERS"));
+        return header("Slug", UrlEncoding.encode(slug, Profile.PATHNODELIMS));
+    }
+
+    public Builder cacheControl(String cc) {
+      this.cacheControl = CacheControl.parse(cc);
+      return this;
+    }
+
+    public Builder cacheControl(CacheControl cc) {
+      this.cacheControl = cc;
+      return this;
+    }
+    
+    public Builder ifMatch(String entity_tag) {
+        return ifMatch(new EntityTag(entity_tag));
+    }    
+    
+    public Builder webLinks(WebLink weblink, WebLink... links) {
+      header("Link", WebLink.toString(weblink,links));
+      return this;
+    }
+    
+    public Builder prefer(Preference pref, Preference... prefs) {
+      header("Prefer", Preference.toString(pref, prefs));
+      return this;
+    }
+    
+    public RequestOptions get() {
+      ImmutableMap.Builder<String,Set<String>> actuals =
+        ImmutableMap.builder();
+      for (Map.Entry<String, ImmutableSet.Builder<String>> header : headers.entrySet())
+        actuals.put(header.getKey(), header.getValue().build());
+      return new RequestOptions(this,actuals.build());
+    }
+    
+  }
+  
+    final boolean revalidateAuth;
+    final boolean useChunked;
+    final boolean usePostOverride;
+    final boolean requestException4xx;
+    final boolean requestException5xx;
+    final boolean useExpectContinue;
+    final boolean useConditional;
+    final boolean followRedirects;
+    final CacheControl cacheControl;
+    final ImmutableMap<String, Set<String>> headers;
+    final int waitForContinue;
+
+    RequestOptions(Builder builder,ImmutableMap<String,Set<String>> headers) {
+      this.revalidateAuth = builder.revalidateAuth;
+      this.useChunked = builder.useChunked;
+      this.usePostOverride = builder.usePostOverride;
+      this.requestException4xx = builder.requestException4xx;
+      this.requestException5xx = builder.requestException5xx;
+      this.useConditional = builder.useConditional;
+      this.useExpectContinue = builder.useExpectContinue;
+      this.followRedirects = builder.followRedirects;
+      this.cacheControl = builder.cacheControl;
+      this.headers = headers;
+      this.waitForContinue = builder.waitForContinue;
+    }
+
+    private Map<String, Set<String>> getHeaders() {
+        return headers;
+    }
+
+    /**
+     * Returns the text value of the specified header
+     */
+    public String getHeader(String header) {
+        Set<String> list = getHeaders().get(header);
+        return list.size() > 0 ? list.iterator().next() : null;
+    }
+
+    /**
+     * Return a listing of text values for the specified header
+     */
+    public Iterable<Object> getHeaders(String header) {
+      return ImmutableSet.<Object>copyOf(getHeaders().get(header));
+    }
+
+    /**
+     * Returns the date value of the specified header
+     */
+    public DateTime getDateHeader(String header) {
+      String val = getHeader(header);
+      try {
+          return (val != null) ? new DateTime(DateUtils.parseDate(val)) : null;
+      } catch (DateParseException e) {
+        throw ExceptionHelper.propogate(e);
+      }
+    }
+
+    /**
+     * Returns a listing of header names
+     */
+    public Iterable<String> getHeaderNames() {
+      return getHeaders().keySet();
+    }
+
+    /**
+     * Return the value of the Cache-Control header
+     */
+    public CacheControl getCacheControl() {
+        return cacheControl;
+    }
+
+    /**
+     * Configure the AbderaClient Side cache to revalidate when using Authorization
+     */
+    public boolean getRevalidateWithAuth() {
+        return revalidateAuth;
+    }
+
+    /**
+     * Should the request use chunked encoding?
+     */
+    public boolean isUseChunked() {
+        return useChunked;
+    }
+
+    /**
+     * Return whether the request should use the X-HTTP-Method-Override option
+     */
+    public boolean isUsePostOverride() {
+        return this.usePostOverride;
+    }
+
+    /**
+     * Return true if a RequestException should be thrown on 4xx responses
+     */
+    public boolean is4xxRequestException() {
+        return this.requestException4xx;
+    }
+
+    /**
+     * Return true if a RequestException should be thrown on 5xx responses
+     */
+    public boolean is5xxRequestException() {
+        return this.requestException5xx;
+    }
+
+    /**
+     * Return true if Expect-Continue should be used
+     */
+    public boolean isUseExpectContinue() {
+        return this.useExpectContinue;
+    }
+
+    /**
+     * True if HTTP Conditional Requests should be used automatically. This only has an effect when putting a Document
+     * that has an ETag or Last-Modified date present
+     */
+    public boolean isConditionalPut() {
+        return this.useConditional;
+    }
+
+    /**
+     * True if the client should follow redirects automatically
+     */
+    public boolean isFollowRedirects() {
+        return followRedirects;
+    }
+    
+    public boolean has(String header) {
+      return headers.containsKey(header);
+    }
+    
+    public int getWaitForContinue() {
+      return waitForContinue;
+    }
+}

Propchange: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/RequestOptions.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/Session.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/Session.java?rev=1239261&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/Session.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/Session.java Wed Feb  1 18:49:11 2012
@@ -0,0 +1,916 @@
+/*
+ * 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.abdera2.common.protocol;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+
+import org.apache.abdera2.common.http.Method;
+import org.apache.abdera2.common.http.ResponseType;
+import org.apache.abdera2.common.misc.ExceptionHelper;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpResponse;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.client.AuthCache;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.client.protocol.ClientContext;
+import org.apache.http.entity.InputStreamEntity;
+import org.apache.http.impl.auth.BasicScheme;
+import org.apache.http.impl.client.BasicAuthCache;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.protocol.BasicHttpContext;
+import org.apache.http.protocol.HTTP;
+import org.apache.http.protocol.HttpContext;
+import org.apache.http.util.EntityUtils;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
+
+/**
+ * A client session. Session's MUST NOT be used by more
+ * than one Thread of execution as a time as multiple threads would stomp 
+ * all over the shared session context. It is critical to completely
+ * consume each ClientResponse before executing an additional request on 
+ * the same session.
+ */
+@SuppressWarnings("unchecked")
+public class Session {
+
+    protected final Client client;
+    protected final HttpContext localContext;
+
+    protected Session(Client client) {
+        this.client = client;
+        this.localContext = 
+          new BasicHttpContext();
+    }
+    
+    private HttpClient getClient() {
+      return client.getClient();
+    }
+    
+    protected <T extends ClientResponse>T wrap(ClientResponse resp) {
+      return (T)resp;
+    }
+    
+    /**
+     * Sends an HTTP GET request to the specified URI.
+     * 
+     * @param uri The request URI
+     * @param options The request options
+     */
+    public <T extends ClientResponse>T get(String uri, RequestOptions options) {
+        return (T)wrap(execute("GET", uri, (HttpEntity)null, options));
+    }
+    
+    public <T extends ClientResponse>Callable<T> getTask(
+      final String uri) {
+      return new Callable<T>() {
+        public T call() throws Exception {
+          return (T) get(uri);
+        }
+      };
+    }
+    
+    public <T extends ClientResponse>Callable<T> getTask(
+      final String uri, 
+      final RequestOptions options) {
+        return new Callable<T>() {
+          public T call() throws Exception {
+            return (T) get(uri,options);
+          }
+        };
+    }
+
+    /**
+     * Sends an HTTP POST request to the specified URI.
+     * 
+     * @param uri The request URI
+     * @param entity A RequestEntity object providing the payload of the request
+     * @param options The request options
+     */
+    public <T extends ClientResponse>T post(
+      String uri, 
+      HttpEntity entity, 
+      RequestOptions options) {
+      return (T)wrap(execute("POST", uri, entity, options));
+    }
+    
+    public <T extends ClientResponse>Callable<T> postTask(
+      final String uri, 
+      final HttpEntity entity) {
+        return new Callable<T>() {
+          public T call() throws Exception {
+            return (T) post(uri,entity);
+          }
+        };
+    }
+    
+    public <T extends ClientResponse>Callable<T> postTask(
+      final String uri, 
+      final HttpEntity entity, 
+      final RequestOptions options) {
+        return new Callable<T>() {
+          public T call() throws Exception {
+            return (T) post(uri,entity,options);
+          }
+        };
+    }
+
+    /**
+     * Sends an HTTP POST request to the specified URI.
+     * 
+     * @param uri The request URI
+     * @param in An InputStream providing the payload of the request
+     * @param options The request options
+     */
+    public <T extends ClientResponse>T post(String uri, InputStream in, RequestOptions options) {
+        return (T)wrap(execute("POST", uri, new InputStreamEntity(in,-1), options));
+    }
+    
+    public <T extends ClientResponse>Callable<T> postTask(
+      final String uri, 
+      final InputStream in) {
+        return new Callable<T>() {
+          public T call() throws Exception {
+            return (T) post(uri,in);
+          }
+        };
+    }
+    
+    public <T extends ClientResponse>Callable<T> postTask(
+      final String uri, 
+      final InputStream in, 
+      final RequestOptions options) {
+        return new Callable<T>() {
+          public T call() throws Exception {
+            return (T) post(uri,in,options);
+          }
+        };
+    }
+
+    /**
+     * Sends an HTTP PUT request to the specified URI.
+     * 
+     * @param uri The request URI
+     * @param entity A RequestEntity object providing the payload of the request
+     * @param options The request options
+     */
+    public <T extends ClientResponse>T put(String uri, HttpEntity entity, RequestOptions options) {
+        return (T)wrap(execute("PUT", uri, entity, options));
+    }
+
+    public <T extends ClientResponse>Callable<T> putTask(
+      final String uri, 
+      final HttpEntity entity) {
+        return new Callable<T>() {
+          public T call() throws Exception {
+            return (T) put(uri,entity);
+          }
+        };
+    }
+    
+    public <T extends ClientResponse>Callable<T> putTask(
+      final String uri, 
+      final HttpEntity entity, 
+      final RequestOptions options) {
+        return new Callable<T>() {
+          public T call() throws Exception {
+            return (T) put(uri,entity,options);
+          }
+        };
+    }
+
+    /**
+     * Sends an HTTP PUT request to the specified URI.
+     * 
+     * @param uri The request URI
+     * @param in An InputStream providing the payload of the request
+     * @param options The request options
+     */
+    public <T extends ClientResponse>T put(String uri, InputStream in, RequestOptions options) {
+        return (T)wrap(execute("PUT", uri, new InputStreamEntity(in,-1), options));
+    }
+    
+    public <T extends ClientResponse>Callable<T> putTask(
+        final String uri, 
+        final InputStream in) {
+          return new Callable<T>() {
+            public T call() throws Exception {
+              return (T) put(uri,in);
+            }
+          };
+      }
+    
+    public <T extends ClientResponse>Callable<T> putTask(
+      final String uri, 
+      final InputStream in, 
+      final RequestOptions options) {
+        return new Callable<T>() {
+          public T call() throws Exception {
+            return (T) put(uri,in,options);
+          }
+        };
+    }
+
+    /**
+     * Sends an HTTP DELETE request to the specified URI.
+     * 
+     * @param uri The request URI
+     * @param options The request options
+     */
+    public <T extends ClientResponse>T delete(String uri, RequestOptions options) {
+        return (T)wrap(execute("DELETE", uri, (HttpEntity)null, options));
+    }
+    
+    public <T extends ClientResponse>Callable<T> deleteTask(
+      final String uri) {
+        return new Callable<T>() {
+          public T call() throws Exception {
+            return (T) delete(uri);
+          }
+        };
+    }
+    
+    public <T extends ClientResponse>Callable<T> deleteTask(
+      final String uri,
+      final RequestOptions options) {
+        return new Callable<T>() {
+          public T call() throws Exception {
+            return (T) delete(uri,options);
+          }
+        };
+    }
+
+    /**
+     * Sends an HTTP HEAD request to the specified URI using the default options
+     * 
+     * @param uri The request URI
+     */
+    public <T extends ClientResponse>T head(String uri) {
+        return (T)wrap(head(uri, getDefaultRequestOptions().get()));
+    }
+    
+    public <T extends ClientResponse>Callable<T> headTask(
+        final String uri) {
+          return new Callable<T>() {
+            public T call() throws Exception {
+              return (T) head(uri);
+            }
+          };
+      }
+    
+    public <T extends ClientResponse>Callable<T> headTask(
+      final String uri,
+      final RequestOptions options) {
+        return new Callable<T>() {
+          public T call() throws Exception {
+            return (T) head(uri,options);
+          }
+        };
+    }
+    
+    /**
+     * Sends an HTTP HEAD request to the specified URI
+     * 
+     * @param uri The request URI
+     */
+    public <T extends ClientResponse>T head(String uri, RequestOptions options) {
+       return (T)wrap(execute("HEAD", uri, (HttpEntity)null, options));
+    }
+
+    /**
+     * Sends an HTTP GET request to the specified URI using the default options
+     * 
+     * @param uri The request URI
+     */
+    public <T extends ClientResponse>T get(String uri) {
+        return (T)wrap(get(uri, getDefaultRequestOptions().get()));
+    }
+
+    /**
+     * Sends an HTTP POST request to the specified URI using the default options
+     * 
+     * @param uri The request URI
+     * @param entity A RequestEntity object providing the payload of the request
+     */
+    public <T extends ClientResponse>T post(String uri, HttpEntity entity) {
+        return (T)wrap(post(uri, entity, getDefaultRequestOptions().get()));
+    }
+
+    /**
+     * Sends an HTTP POST request to the specified URI using the default options
+     * 
+     * @param uri The request URI
+     * @param in An InputStream providing the payload of the request
+     */
+    public <T extends ClientResponse>T post(String uri, InputStream in) {
+        return (T)wrap(post(uri, in, getDefaultRequestOptions().get()));
+    }
+
+    /**
+     * Sends an HTTP PUT request to the specified URI using the default options
+     * 
+     * @param uri The request URI
+     * @param entity A RequestEntity object providing the payload of the request
+     */
+    public <T extends ClientResponse>T put(String uri, HttpEntity entity) {
+        return (T)wrap(put(uri, entity, getDefaultRequestOptions().get()));
+    }
+
+    /**
+     * Sends an HTTP PUT request to the specified URI using the default options
+     * 
+     * @param uri The request URI
+     * @param in An InputStream providing the payload of the request
+     */
+    public <T extends ClientResponse>T put(String uri, InputStream in) {
+        return (T)wrap(put(uri, in, getDefaultRequestOptions().get()));
+    }
+
+    /**
+     * Sends an HTTP DELETE request to the specified URI using the default options
+     * 
+     * @param uri The request URI
+     */
+    public <T extends ClientResponse>T delete(String uri) {
+        return (T)wrap(delete(uri, getDefaultRequestOptions().get()));
+    }
+    
+    /**
+     * Sends the specified method request to the specified URI. This can be used to send extension HTTP methods to a
+     * server (e.g. PATCH, LOCK, etc)
+     * 
+     * @param method The HTTP method
+     * @param uri The request URI
+     * @param in An InputStream providing the payload of the request
+     * @param options The Request Options
+     */
+    public <T extends ClientResponse>T execute(
+        String method, 
+        String uri, 
+        InputStream in, 
+        RequestOptions options) {
+        if (options == null)
+          options = getDefaultRequestOptions().get();
+        InputStreamEntity re = 
+          new InputStreamEntity(in, -1);
+        re.setContentType(
+          options.getContentType().toString());
+        return (T)wrap(execute(
+          method, uri, re, options));
+    }
+    
+    public <T extends ClientResponse>Callable<T> executeTask(
+      final String method, 
+      final String uri, 
+      final InputStream in, 
+      final RequestOptions options) {
+        return new Callable<T>() {
+          public T call() throws Exception {
+            return (T) execute(method,uri,in,options);
+          }
+        };
+    }
+    
+    /**
+     * Sends the specified method request to the specified URI. This can be used to send extension HTTP methods to a
+     * server (e.g. PATCH, LOCK, etc)
+     * 
+     * @param method The HTTP method
+     * @param uri The request URI
+     * @param in An InputStream providing the payload of the request
+     * @param options The Request Options
+     */
+    public <T extends ClientResponse>T execute(
+        Method method, 
+        String uri, 
+        InputStream in, 
+        RequestOptions options) {
+        return (T)wrap(execute(method.name(),uri,in,options));
+    }
+    
+    public <T extends ClientResponse>Callable<T> executeTask(
+      final Method method, 
+      final String uri, 
+      final InputStream in, 
+      final RequestOptions options) {
+        return new Callable<T>() {
+          public T call() throws Exception {
+            return (T) execute(method,uri,in,options);
+          }
+        };
+    }
+
+    public <T extends ClientResponse>T execute(
+        Method method, 
+        String uri, 
+        HttpEntity entity, 
+        RequestOptions options) {
+      return (T)wrap(execute(method.name(),uri,entity,options));
+    }
+    
+    public <T extends ClientResponse>Callable<T> executeTask(
+      final Method method, 
+      final String uri, 
+      final HttpEntity entity, 
+      final RequestOptions options) {
+        return new Callable<T>() {
+          public T call() throws Exception {
+            return (T) execute(method,uri,entity,options);
+          }
+        };
+    }
+    
+    /**
+     * Sends the specified method request to the specified URI. This can be used to send extension HTTP methods to a
+     * server (e.g. PATCH, LOCK, etc)
+     * 
+     * @param method The HTTP method
+     * @param uri The request URI
+     * @param entity A RequestEntity object providing the payload for the request
+     * @param options The Request Options
+     */
+    public <T extends ClientResponse>T execute(
+        String method, 
+        String uri, 
+        HttpEntity entity, 
+        RequestOptions options) {
+        options =
+          options != null ? 
+            options : 
+            getDefaultRequestOptions()
+              .get();
+        try {
+          HttpUriRequest request = 
+            RequestHelper.createRequest(
+                method, uri, entity, options);
+          HttpResponse response = 
+            getClient().execute(request, localContext);
+          ClientResponse resp = 
+            wrap(new ClientResponseImpl(
+              this, response, method, localContext));
+          return (T)checkRequestException(resp, options);
+        } catch (RuntimeException r) {
+            throw r;
+        } catch (Throwable t) {
+            throw new RuntimeException(t);
+        }
+    }
+
+    public <T extends ClientResponse>Callable<T> executeTask(
+      final String method, 
+      final String uri, 
+      final HttpEntity entity, 
+      final RequestOptions options) {
+       return new Callable<T>() {
+          public T call() throws Exception {
+            return (T) execute(method,uri,entity,options);
+          }
+        };
+    }
+    
+    protected <T extends ClientResponse>T checkRequestException(ClientResponse response, RequestOptions options) {
+      if (response == null)
+          return (T)response;
+      ResponseType type = response.getType();
+      if ((type.equals(ResponseType.CLIENT_ERROR) && options.is4xxRequestException()) || (type
+          .equals(ResponseType.SERVER_ERROR) && options.is5xxRequestException())) {
+        throw new ProtocolException(response.getStatus(),response.getStatusText());
+      }
+      return (T)response;
+  }
+    
+    /**
+     * Get a copy of the default request options
+     */
+    public RequestOptions.Builder getDefaultRequestOptions() {
+        return RequestHelper.createAtomDefaultRequestOptions();
+    }
+
+    public void usePreemptiveAuthentication(String target, String realm) throws URISyntaxException {
+        AuthCache cache = (AuthCache) localContext.getAttribute(ClientContext.AUTH_CACHE);
+        if (cache == null) {
+          String host = AuthScope.ANY_HOST;
+          int port = AuthScope.ANY_PORT;
+          if (target != null) {
+            URI uri = new URI(target);
+            host = uri.getHost();
+            port = uri.getPort();
+          }
+          BasicScheme basicAuth = new BasicScheme();
+          HttpHost targetHost = 
+            new HttpHost(host,port,basicAuth.getSchemeName());
+          cache = new BasicAuthCache();
+          cache.put(targetHost, basicAuth);
+          localContext.setAttribute(ClientContext.AUTH_CACHE, cache);
+        }
+    }
+    
+    public boolean doFormLogin(String uri, String userid, String password) {
+      return doFormLogin(uri, "j_username", userid, "j_password", password);
+    }
+    
+    public boolean doFormLogin(String uri, String userfield, String userid, String passfield, String password) {
+      return doFormLogin(uri, userfield, userid, passfield, password, (ImmutableMap<String,String>)null);
+    }
+ 
+    public boolean doFormLogin(
+        String uri, 
+        String userfield, 
+        String userid, 
+        String passfield, 
+        String password,
+        ImmutableMap.Builder<String,String> additional) {
+      return doFormLogin(uri,userfield,userid,passfield,password,additional.build());
+    }
+    
+    public boolean doFormLogin(
+      String uri, 
+      String userfield, 
+      String userid, 
+      String passfield, 
+      String password,
+      ImmutableMap<String,String> additional) {
+      try {
+        HttpPost httpost = new HttpPost(uri);
+        ImmutableList.Builder<BasicNameValuePair> pairs = 
+          ImmutableList.<BasicNameValuePair>builder()
+           .add(new BasicNameValuePair(userfield,userid))
+           .add(new BasicNameValuePair(passfield,password));
+        for (Map.Entry<String, String> entry : additional.entrySet())
+          pairs.add(new BasicNameValuePair(entry.getKey(),entry.getValue()));
+        httpost.setEntity(
+          new UrlEncodedFormEntity(
+            pairs.build(),
+            HTTP.UTF_8));
+        HttpResponse response = getClient().execute(httpost,localContext);
+        HttpEntity entity = response.getEntity();
+        EntityUtils.consume(entity);
+        ResponseType type = ResponseType.select(response.getStatusLine().getStatusCode());
+        return type == ResponseType.SUCCESSFUL;
+      } catch (Throwable t) {
+        throw new RuntimeException(t);
+      }
+    }
+    
+  public static interface Listener<X extends ClientResponse> {
+    void onResponse(X resp);
+  }
+  
+  /**
+   * Processes requests asynchronously.. will return a Future
+   * whose value will be set once the call completes
+   */
+  public <X extends ClientResponse>Future<X> process(
+    ExecutorService executor, 
+    Callable<X> resp) {
+      ListeningExecutorService exec = 
+        MoreExecutors.listeningDecorator(executor);
+      return exec.submit(resp);
+  }
+  
+  /**
+   * Processes requests asynchronously.. the listener will
+   * be invoked once the call completes
+   */
+  public <X extends ClientResponse>void process(
+    ExecutorService executor, 
+    Callable<X> resp, 
+    final Listener<X> listener) {
+      ListeningExecutorService exec = MoreExecutors.listeningDecorator(executor);
+      final ListenableFuture<X> lf = exec.submit(resp);
+      lf.addListener(
+        new Runnable() {
+          public void run() {
+            X resp = null;
+            try {
+              resp = lf.get();
+              listener.onResponse(resp);
+            } catch (Throwable t) {
+              throw ExceptionHelper.propogate(t);
+            } finally { // auto release since by this point we know we're done with it
+              if (resp != null) resp.release();
+            }
+          }
+        }, 
+        executor);
+  }
+  
+  public <T extends ClientResponse>void get(
+    String uri, 
+    ExecutorService exec, 
+    Listener<T> listener) {
+    process(exec,this.<T>getTask(uri),listener);
+  }
+  
+  public <T extends ClientResponse>void get(
+    String uri, 
+    RequestOptions options,
+    ExecutorService exec, 
+    Listener<T> listener) {
+    process(exec,this.<T>getTask(uri,options),listener);
+  }
+  
+  public <T extends ClientResponse>Future<T> get(
+    String uri, 
+    ExecutorService exec) {
+      return process(exec,this.<T>getTask(uri));
+  }
+  
+  public <T extends ClientResponse>Future<T> get(
+    String uri, 
+    RequestOptions options,
+    ExecutorService exec) {
+      return process(exec,this.<T>getTask(uri,options));
+  }
+  
+  public <T extends ClientResponse>void post(
+    String uri, 
+    InputStream in,
+    ExecutorService exec, 
+    Listener<T> listener) {
+    process(exec,this.<T>postTask(uri,in),listener);
+  }
+  
+  public <T extends ClientResponse>void post(
+    String uri, 
+    InputStream in,
+    RequestOptions options,
+    ExecutorService exec, 
+    Listener<T> listener) {
+    process(exec,this.<T>postTask(uri,in,options),listener);
+  }
+  
+  public <T extends ClientResponse>Future<T> post(
+    String uri, 
+    InputStream in,
+    ExecutorService exec) {
+      return process(exec,this.<T>postTask(uri,in));
+  }
+  
+  public <T extends ClientResponse>Future<T> post(
+    String uri, 
+    InputStream in,
+    RequestOptions options,
+    ExecutorService exec) {
+      return process(exec,this.<T>postTask(uri,in,options));
+  }
+  
+  public <T extends ClientResponse>void post(
+    String uri, 
+    HttpEntity in,
+    ExecutorService exec, 
+    Listener<T> listener) {
+    process(exec,this.<T>postTask(uri,in),listener);
+  }
+  
+  public <T extends ClientResponse>void post(
+    String uri, 
+    HttpEntity in,
+    RequestOptions options,
+    ExecutorService exec, 
+    Listener<T> listener) {
+    process(exec,this.<T>postTask(uri,in,options),listener);
+  }
+  
+  public <T extends ClientResponse>Future<T> post(
+    String uri, 
+    HttpEntity in,
+    ExecutorService exec) {
+      return process(exec,this.<T>postTask(uri,in));
+  }
+  
+  public <T extends ClientResponse>Future<T> post(
+    String uri, 
+    HttpEntity in,
+    RequestOptions options,
+    ExecutorService exec) {
+      return process(exec,this.<T>postTask(uri,in,options));
+  }
+
+
+  public <T extends ClientResponse>void put(
+      String uri, 
+      InputStream in,
+      ExecutorService exec, 
+      Listener<T> listener) {
+      process(exec,this.<T>putTask(uri,in),listener);
+    }
+    
+    public <T extends ClientResponse>void put(
+      String uri, 
+      InputStream in,
+      RequestOptions options,
+      ExecutorService exec, 
+      Listener<T> listener) {
+      process(exec,this.<T>putTask(uri,in,options),listener);
+    }
+    
+    public <T extends ClientResponse>Future<T> put(
+      String uri, 
+      InputStream in,
+      ExecutorService exec) {
+        return process(exec,this.<T>putTask(uri,in));
+    }
+    
+    public <T extends ClientResponse>Future<T> put(
+      String uri, 
+      InputStream in,
+      RequestOptions options,
+      ExecutorService exec) {
+        return process(exec,this.<T>putTask(uri,in,options));
+    }
+    
+    public <T extends ClientResponse>void put(
+      String uri, 
+      HttpEntity in,
+      ExecutorService exec, 
+      Listener<T> listener) {
+      process(exec,this.<T>putTask(uri,in),listener);
+    }
+    
+    public <T extends ClientResponse>void put(
+      String uri, 
+      HttpEntity in,
+      RequestOptions options,
+      ExecutorService exec, 
+      Listener<T> listener) {
+      process(exec,this.<T>putTask(uri,in,options),listener);
+    }
+    
+    public <T extends ClientResponse>Future<T> put(
+      String uri, 
+      HttpEntity in,
+      ExecutorService exec) {
+        return process(exec,this.<T>putTask(uri,in));
+    }
+    
+    public <T extends ClientResponse>Future<T> put(
+      String uri, 
+      HttpEntity in,
+      RequestOptions options,
+      ExecutorService exec) {
+        return process(exec,this.<T>putTask(uri,in,options));
+    }
+    
+    public <T extends ClientResponse>void delete(
+      String uri, 
+      ExecutorService exec, 
+      Listener<T> listener) {
+      process(exec,this.<T>deleteTask(uri),listener);
+    }
+    
+    public <T extends ClientResponse>void delete(
+      String uri, 
+      RequestOptions options,
+      ExecutorService exec, 
+      Listener<T> listener) {
+      process(exec,this.<T>deleteTask(uri,options),listener);
+    }
+    
+    public <T extends ClientResponse>Future<T> delete(
+      String uri, 
+      ExecutorService exec) {
+        return process(exec,this.<T>deleteTask(uri));
+    }
+    
+    public <T extends ClientResponse>Future<T> delete(
+      String uri, 
+      RequestOptions options,
+      ExecutorService exec) {
+        return process(exec,this.<T>deleteTask(uri,options));
+    }
+    
+    public <T extends ClientResponse>void head(
+      String uri, 
+      ExecutorService exec, 
+      Listener<T> listener) {
+      process(exec,this.<T>headTask(uri),listener);
+    }
+    
+    public <T extends ClientResponse>void head(
+      String uri, 
+      RequestOptions options,
+      ExecutorService exec, 
+      Listener<T> listener) {
+      process(exec,this.<T>headTask(uri,options),listener);
+    }
+    
+    public <T extends ClientResponse>Future<T> head(
+      String uri, 
+      ExecutorService exec) {
+        return process(exec,this.<T>headTask(uri));
+    }
+    
+    public <T extends ClientResponse>Future<T> head(
+      String uri, 
+      RequestOptions options,
+      ExecutorService exec) {
+        return process(exec,this.<T>headTask(uri,options));
+    }
+    
+    
+    public <T extends ClientResponse>void execute(
+      String method, 
+      String uri, 
+      InputStream in, 
+      RequestOptions options,
+      ExecutorService exec, 
+      Listener<T> listener) {
+      process(exec,this.<T>executeTask(method,uri,in,options),listener);
+    }
+    
+    public <T extends ClientResponse>void execute(
+      String method, 
+      String uri, 
+      HttpEntity in, 
+      RequestOptions options,
+      ExecutorService exec, 
+      Listener<T> listener) {
+      process(exec,this.<T>executeTask(method,uri,in,options),listener);
+    }
+    
+    public <T extends ClientResponse>Future<T> execute(
+      String method, 
+      String uri, 
+      InputStream in, 
+      RequestOptions options,
+      ExecutorService exec) {
+        return process(exec,this.<T>executeTask(method,uri,in,options));
+    }
+    
+    public <T extends ClientResponse>Future<T> execute(
+      String method, 
+      String uri, 
+      HttpEntity in, 
+      RequestOptions options,
+      ExecutorService exec) {
+        return process(exec,this.<T>executeTask(method,uri,in,options));
+    }
+    
+    public <T extends ClientResponse>void execute(
+      Method method, 
+      String uri, 
+      InputStream in, 
+      RequestOptions options,
+      ExecutorService exec, 
+      Listener<T> listener) {
+      process(exec,this.<T>executeTask(method,uri,in,options),listener);
+    }
+    
+    public <T extends ClientResponse>void execute(
+      Method method, 
+      String uri, 
+      HttpEntity in, 
+      RequestOptions options,
+      ExecutorService exec, 
+      Listener<T> listener) {
+      process(exec,this.<T>executeTask(method,uri,in,options),listener);
+    }
+    
+    public <T extends ClientResponse>Future<T> execute(
+      Method method, 
+      String uri, 
+      InputStream in, 
+      RequestOptions options,
+      ExecutorService exec) {
+        return process(exec,this.<T>executeTask(method,uri,in,options));
+    }
+    
+    public <T extends ClientResponse>Future<T> execute(
+      Method method, 
+      String uri, 
+      HttpEntity in, 
+      RequestOptions options,
+      ExecutorService exec) {
+        return process(exec,this.<T>executeTask(method,uri,in,options));
+    }
+}

Propchange: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/Session.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/protocol/client/AbderaClient.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/protocol/client/AbderaClient.java?rev=1239261&r1=1239260&r2=1239261&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/protocol/client/AbderaClient.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/protocol/client/AbderaClient.java Wed Feb  1 18:49:11 2012
@@ -19,6 +19,12 @@ package org.apache.abdera2.protocol.clie
 
 import java.io.IOException;
 import org.apache.abdera2.Abdera;
+import org.apache.abdera2.common.protocol.BasicClient;
+import org.apache.abdera2.common.protocol.Client;
+import org.apache.abdera2.common.protocol.ClientWrapper;
+import org.apache.abdera2.common.protocol.RequestHelper;
+import org.apache.abdera2.common.protocol.RequestOptions;
+import org.apache.abdera2.common.protocol.Session;
 import org.apache.abdera2.model.Document;
 import org.apache.abdera2.model.Element;
 import org.apache.abdera2.parser.ParserOptions;

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponse.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponse.java?rev=1239261&r1=1239260&r2=1239261&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponse.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponse.java Wed Feb  1 18:49:11 2012
@@ -17,6 +17,7 @@
  */
 package org.apache.abdera2.protocol.client;
 
+import org.apache.abdera2.common.protocol.ClientResponse;
 import org.apache.abdera2.model.Document;
 import org.apache.abdera2.model.Element;
 import org.apache.abdera2.parser.ParseException;

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponseImpl.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponseImpl.java?rev=1239261&r1=1239260&r2=1239261&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponseImpl.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponseImpl.java Wed Feb  1 18:49:11 2012
@@ -21,6 +21,8 @@ import javax.activation.MimeType;
 
 import org.apache.abdera2.common.http.EntityTag;
 import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.common.protocol.ClientResponse;
+import org.apache.abdera2.common.protocol.ClientResponseWrapper;
 import org.apache.abdera2.model.Document;
 import org.apache.abdera2.model.Element;
 import org.apache.abdera2.parser.ParseException;

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/protocol/client/AbderaSession.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/protocol/client/AbderaSession.java?rev=1239261&r1=1239260&r2=1239261&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/protocol/client/AbderaSession.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/protocol/client/AbderaSession.java Wed Feb  1 18:49:11 2012
@@ -28,6 +28,9 @@ import org.apache.abdera2.protocol.error
 import org.apache.abdera2.common.http.EntityTag;
 import org.apache.abdera2.common.http.Method;
 import org.apache.abdera2.common.http.ResponseType;
+import org.apache.abdera2.common.protocol.ClientResponse;
+import org.apache.abdera2.common.protocol.RequestOptions;
+import org.apache.abdera2.common.protocol.Session;
 import org.apache.http.entity.mime.content.ContentBody;
 import org.joda.time.DateTime;
 

Modified: abdera/abdera2/examples/src/main/java/org/apache/abdera2/examples/appclient/Main.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/examples/src/main/java/org/apache/abdera2/examples/appclient/Main.java?rev=1239261&r1=1239260&r2=1239261&view=diff
==============================================================================
--- abdera/abdera2/examples/src/main/java/org/apache/abdera2/examples/appclient/Main.java (original)
+++ abdera/abdera2/examples/src/main/java/org/apache/abdera2/examples/appclient/Main.java Wed Feb  1 18:49:11 2012
@@ -29,8 +29,8 @@ import org.apache.abdera2.model.Service;
 import org.apache.abdera2.protocol.client.AbderaClient;
 import org.apache.abdera2.protocol.client.AbderaClientResponse;
 import org.apache.abdera2.protocol.client.AbderaSession;
-import org.apache.abdera2.protocol.client.Client;
 import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.common.protocol.Client;
 import org.joda.time.DateTime;
 
 public class Main {

Modified: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/history/FeedPagingHelper.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/history/FeedPagingHelper.java?rev=1239261&r1=1239260&r2=1239261&view=diff
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/history/FeedPagingHelper.java (original)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/history/FeedPagingHelper.java Wed Feb  1 18:49:11 2012
@@ -30,6 +30,7 @@ import static org.apache.abdera2.model.L
 
 import org.apache.abdera2.Abdera;
 import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.common.protocol.RequestOptions;
 import org.apache.abdera2.model.Document;
 import org.apache.abdera2.model.Element;
 import org.apache.abdera2.model.ExtensibleElement;
@@ -38,7 +39,6 @@ import org.apache.abdera2.model.Source;
 import org.apache.abdera2.protocol.client.AbderaClient;
 import org.apache.abdera2.protocol.client.AbderaClientResponse;
 import org.apache.abdera2.protocol.client.AbderaSession;
-import org.apache.abdera2.protocol.client.RequestOptions;
 
 import com.google.common.base.Function;
 import com.google.common.base.Predicate;

Modified: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/html/HtmlHelper.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/html/HtmlHelper.java?rev=1239261&r1=1239260&r2=1239261&view=diff
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/html/HtmlHelper.java (original)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/html/HtmlHelper.java Wed Feb  1 18:49:11 2012
@@ -30,11 +30,11 @@ import org.apache.abdera2.Abdera;
 import org.apache.abdera2.model.Div;
 import org.apache.abdera2.model.Document;
 import org.apache.abdera2.model.Element;
-import org.apache.abdera2.protocol.client.BasicClient;
-import org.apache.abdera2.protocol.client.Client;
-import org.apache.abdera2.protocol.client.ClientResponse;
-import org.apache.abdera2.protocol.client.Session;
 import org.apache.abdera2.common.mediatype.MimeTypeHelper;
+import org.apache.abdera2.common.protocol.BasicClient;
+import org.apache.abdera2.common.protocol.Client;
+import org.apache.abdera2.common.protocol.ClientResponse;
+import org.apache.abdera2.common.protocol.Session;
 import org.apache.abdera2.common.xml.XmlRestrictedCharReader;
 
 public class HtmlHelper {

Modified: abdera/abdera2/pom.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2/pom.xml?rev=1239261&r1=1239260&r2=1239261&view=diff
==============================================================================
--- abdera/abdera2/pom.xml (original)
+++ abdera/abdera2/pom.xml Wed Feb  1 18:49:11 2012
@@ -690,7 +690,6 @@
     <module>common</module>
     <module>core</module>
     <module>activities</module>
-    <module>client</module>
     <module>ext</module>
     <module>security</module>
     <module>test</module>

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/AppTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/AppTest.java?rev=1239261&r1=1239260&r2=1239261&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/AppTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/AppTest.java Wed Feb  1 18:49:11 2012
@@ -52,10 +52,10 @@ import org.apache.abdera2.parser.ParserO
 import org.apache.abdera2.protocol.client.AbderaClient;
 import org.apache.abdera2.protocol.client.AbderaClientResponse;
 import org.apache.abdera2.protocol.client.AbderaSession;
-import org.apache.abdera2.protocol.client.RequestOptions;
 import org.apache.abdera2.common.http.CacheControl;
 import org.apache.abdera2.common.http.EntityTag;
 import org.apache.abdera2.common.mediatype.MimeTypeHelper;
+import org.apache.abdera2.common.protocol.RequestOptions;
 import org.apache.abdera2.test.JettyUtil;
 import org.apache.abdera2.writer.WriterOptions;
 import org.joda.time.DateTime;

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/CacheTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/CacheTest.java?rev=1239261&r1=1239260&r2=1239261&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/CacheTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/CacheTest.java Wed Feb  1 18:49:11 2012
@@ -30,11 +30,11 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.abdera2.common.http.CacheControl;
-import org.apache.abdera2.protocol.client.BasicCachingClient;
-import org.apache.abdera2.protocol.client.Client;
-import org.apache.abdera2.protocol.client.ClientResponse;
-import org.apache.abdera2.protocol.client.RequestOptions;
-import org.apache.abdera2.protocol.client.Session;
+import org.apache.abdera2.common.protocol.BasicCachingClient;
+import org.apache.abdera2.common.protocol.Client;
+import org.apache.abdera2.common.protocol.ClientResponse;
+import org.apache.abdera2.common.protocol.RequestOptions;
+import org.apache.abdera2.common.protocol.Session;
 import org.apache.abdera2.test.JettyUtil;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/ClientTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/ClientTest.java?rev=1239261&r1=1239260&r2=1239261&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/ClientTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/ClientTest.java Wed Feb  1 18:49:11 2012
@@ -32,11 +32,11 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.abdera2.common.misc.MoreExecutors2;
-import org.apache.abdera2.protocol.client.BasicClient;
-import org.apache.abdera2.protocol.client.Client;
-import org.apache.abdera2.protocol.client.ClientResponse;
-import org.apache.abdera2.protocol.client.Session;
-import org.apache.abdera2.protocol.client.Session.Listener;
+import org.apache.abdera2.common.protocol.BasicClient;
+import org.apache.abdera2.common.protocol.Client;
+import org.apache.abdera2.common.protocol.ClientResponse;
+import org.apache.abdera2.common.protocol.Session;
+import org.apache.abdera2.common.protocol.Session.Listener;
 import org.apache.abdera2.test.JettyUtil;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/anno/AnnoUtilTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/anno/AnnoUtilTest.java?rev=1239261&r1=1239260&r2=1239261&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/anno/AnnoUtilTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/anno/AnnoUtilTest.java Wed Feb  1 18:49:11 2012
@@ -11,7 +11,7 @@ import org.apache.abdera2.common.anno.Na
 import org.apache.abdera2.common.anno.Namespace;
 import org.apache.abdera2.common.anno.QName;
 import org.apache.abdera2.common.anno.Version;
-import org.apache.abdera2.protocol.client.BasicClient;
+import org.apache.abdera2.common.protocol.BasicClient;
 import org.junit.Test;
 
 @DefaultImplementation("FooBarBaz")



Mime
View raw message