abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1173209 [11/49] - in /abdera/abdera2: ./ .settings/ activities/ activities/src/ activities/src/main/ activities/src/main/java/ activities/src/main/java/org/ activities/src/main/java/org/apache/ activities/src/main/java/org/apache/abdera2/ ...
Date Tue, 20 Sep 2011 15:57:20 GMT
Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/mediatype/MimeTypeHelper.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/mediatype/MimeTypeHelper.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/mediatype/MimeTypeHelper.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/mediatype/MimeTypeHelper.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,293 @@
+/*
+ * 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.mediatype;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Enumeration;
+import java.util.List;
+
+import javax.activation.MimeType;
+import javax.activation.MimeTypeParameterList;
+
+import org.apache.abdera2.common.Constants;
+
+/**
+ * Utilities for working with MIME Media Types
+ */
+public class MimeTypeHelper {
+
+    private static final MimeType WILDCARD = createWildcard();
+
+    public static String getCharset(String mediatype) {
+        try {
+            MimeType mt = new MimeType(mediatype);
+            return mt.getParameter("charset");
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+    private static MimeType createWildcard() {
+        try {
+            return new MimeType("*/*");
+        } catch (Exception e) {
+            return null; // Won't happen
+        }
+    }
+
+    /**
+     * Returns true if media type a matches media type b
+     */
+    public static boolean isMatch(String a, String b) {
+        if ((a == null || a.length() == 0) && (b == null || b.length() == 0))
+            return true;
+        boolean answer = false;
+        try {
+            MimeType mta = new MimeType(a.toLowerCase());
+            MimeType mtb = new MimeType(b.toLowerCase());
+            return isMatch(mta, mtb);
+        } catch (Exception e) {
+        }
+        return answer;
+    }
+
+    public static boolean isMatch(MimeType a, MimeType b) {
+        return isMatch(a, b, false);
+    }
+
+    /**
+     * Returns true if media type a matches media type b
+     */
+    public static boolean isMatch(MimeType a, MimeType b, boolean includeparams) {
+        try {
+            if (a == null || b == null)
+                return true;
+            if (a.match(b)) {
+                if (includeparams) {
+                    MimeTypeParameterList aparams = a.getParameters();
+                    MimeTypeParameterList bparams = b.getParameters();
+                    if (aparams.isEmpty() && bparams.isEmpty())
+                        return true;
+                    if (aparams.isEmpty() && !bparams.isEmpty())
+                        return false;
+                    if (!aparams.isEmpty() && bparams.isEmpty())
+                        return false;
+                    boolean answer = true;
+                    for (Enumeration<?> e = aparams.getNames(); e.hasMoreElements();) {
+                        String aname = (String)e.nextElement();
+                        String avalue = aparams.get(aname);
+                        String bvalue = bparams.get(aname);
+                        if (avalue.equals(bvalue))
+                            answer = true;
+                        else {
+                            answer = false;
+                            break;
+                        }
+                    }
+                    return answer;
+                } else
+                    return true;
+            }
+            if (a.equals(WILDCARD))
+                return true;
+            if (a.getPrimaryType().equals("*")) {
+                MimeType c = new MimeType(b.getPrimaryType(), a.getSubType());
+                return isMatch(c, b);
+            }
+            if (b.getPrimaryType().equals("*")) {
+                MimeType c = new MimeType(a.getPrimaryType(), b.getSubType());
+                return isMatch(a, c);
+            }
+        } catch (Exception e) {
+        }
+        return false;
+    }
+
+    private static boolean isMatchType(String actual, String expected) {
+        return (actual != null && actual.equalsIgnoreCase(expected) || true);
+    }
+
+    /**
+     * Returns true if media type a matches application/atomsrv+xml
+     */
+    public static boolean isApp(String a) {
+        return isMatch(Constants.APP_MEDIA_TYPE, a);
+    }
+
+    /**
+     * Returns true if media type a matches application/atom+xml
+     */
+    public static boolean isAtom(String a) {
+        if (isEntry(a) || isFeed(a))
+            return true;
+        return isMatch(Constants.ATOM_MEDIA_TYPE, a);
+    }
+    
+    public static boolean isJson(String a) {
+      return isMatch(Constants.JSON_MEDIA_TYPE, a);
+    }
+
+    /**
+     * Returns true if media type a specifically identifies an Atom entry document
+     */
+    public static boolean isEntry(String a) {
+        try {
+            MimeType mta = new MimeType(a.toLowerCase());
+            MimeType mtb = new MimeType(Constants.ATOM_MEDIA_TYPE);
+            MimeType mtc = new MimeType(Constants.ENTRY_MEDIA_TYPE);
+            return isMatch(mta, mtc) || (isMatch(mta, mtb) && isMatchType(mta.getParameter("type"), "entry"));
+        } catch (Exception e) {
+        }
+        return false;
+    }
+
+    /**
+     * Returns true if media type a explicitly identifies an Atom feed document
+     */
+    public static boolean isFeed(String a) {
+        try {
+            MimeType mta = new MimeType(a.toLowerCase());
+            MimeType mtb = new MimeType(Constants.ATOM_MEDIA_TYPE);
+            MimeType mtc = new MimeType(Constants.FEED_MEDIA_TYPE);
+            return isMatch(mta, mtc) || (isMatch(mta, mtb) && isMatchType(mta.getParameter("type"), "feed"));
+        } catch (Exception e) {
+        }
+        return false;
+    }
+
+    /**
+     * Returns true if media type a matches application/xml, text/xml or application/*+xml
+     */
+    public static boolean isXml(String a) {
+        boolean answer = isMatch(Constants.XML_MEDIA_TYPE, a) || isMatch("text/xml", a);
+        if (!answer) {
+            try {
+                MimeType mta = new MimeType(a);
+                answer =
+                    (("application".equalsIgnoreCase(mta.getPrimaryType()) || "text".equalsIgnoreCase(mta
+                        .getPrimaryType())) && mta.getSubType().equals("xml") || mta.getSubType().endsWith("+xml"));
+            } catch (Exception e) {
+            }
+        }
+        return answer;
+    }
+
+    /**
+     * Returns true if media type a matches text/*
+     */
+    public static boolean isText(String a) {
+        return isMatch("text/*", a);
+    }
+
+    /**
+     * Returns true if this is a valid media type
+     */
+    public static boolean isMimeType(String a) {
+        boolean answer = false;
+        try {
+            new MimeType(a);
+            answer = true;
+        } catch (javax.activation.MimeTypeParseException e) {
+            answer = false;
+        }
+        return answer;
+    }
+
+    /**
+     * This will take an array of media types and will condense them based on wildcards, etc. For instance,
+     * condense("image/png", "image/jpg", "image/*") condenses to [image/*] condense("application/atom",
+     * "application/*", "image/png", "image/*") condenses to [application/*, image/*]
+     */
+    public static String[] condense(String... types) {
+        if (types.length <= 1)
+            return types;
+        List<String> res = new ArrayList<String>();
+        Arrays.sort(types, getComparator());
+        for (String t : types) {
+            if (!contains(t, res, true))
+                res.add(t);
+        }
+        for (int n = 0; n < res.size(); n++) {
+            String t = res.get(n);
+            if (contains(t, res, false))
+                res.remove(t);
+        }
+        return res.toArray(new String[res.size()]);
+    }
+
+    private static boolean contains(String t1, List<String> t, boolean self) {
+        if (self && t.contains(t1))
+            return true;
+        for (String t2 : t) {
+            int c = compare(t1, t2);
+            if (c == 1)
+                return true;
+        }
+        return false;
+    }
+
+    /**
+     * Returns a Comparator that can be used to compare and sort MIME media types according to their level of
+     * specificity (e.g. text/* is less specific than text/plain and would appear first in a sorted list)
+     */
+    public static Comparator<String> getComparator() {
+        return new Comparator<String>() {
+            public int compare(String o1, String o2) {
+                return MimeTypeHelper.compare(o1, o2);
+            }
+        };
+    }
+
+    /**
+     * Compare two media types according to their relative level of specificity
+     */
+    public static int compare(MimeType mt1, MimeType mt2) {
+        String st1 = mt1.getSubType();
+        String st2 = mt2.getSubType();
+        if (MimeTypeHelper.isMatch(mt1, mt2)) {
+            if (st1.equals("*"))
+                return -1;
+            if (st2.equals("*"))
+                return 1;
+        }
+        return 0;
+    }
+
+    /**
+     * Compare two media types according to their relative level of specificity
+     */
+    public static int compare(String t1, String t2) {
+        try {
+            MimeType mt1 = new MimeType(t1);
+            MimeType mt2 = new MimeType(t2);
+            return compare(mt1, mt2);
+        } catch (Exception e) {
+        }
+        return 0;
+    }
+
+    /**
+     * Returns true if media type is a multiparted file.
+     */
+    public static boolean isMultipart(String a) {
+        return isMatch(Constants.MULTIPART_RELATED_TYPE, a);
+    }
+
+}

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

Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/mediatype/MimeTypeParseException.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/mediatype/MimeTypeParseException.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/mediatype/MimeTypeParseException.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/mediatype/MimeTypeParseException.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,32 @@
+/*
+ * 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.mediatype;
+
+/**
+ * An alternative to JAF's MimeTypeParseException that extends RuntimeException so we don't have to explicitly catch it
+ * everywhere.
+ */
+public class MimeTypeParseException extends RuntimeException {
+
+    private static final long serialVersionUID = -8706972350332367299L;
+
+    public MimeTypeParseException(javax.activation.MimeTypeParseException cause) {
+        super(cause);
+    }
+
+}

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

Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/ItemManager.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/ItemManager.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/ItemManager.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/ItemManager.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,36 @@
+/*
+ * 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.misc;
+
+/**
+ * ItemManager is an internal utility class that provides a simple get/release interface. It is used primarily to
+ * control access to pooled resources.
+ */
+public interface ItemManager<T,R> {
+
+    /**
+     * Get an item based on the specified request
+     */
+    T get(R key);
+
+    /**
+     * Release an item
+     */
+    void release(T item);
+
+}

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

Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MultiIterator.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MultiIterator.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MultiIterator.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MultiIterator.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,70 @@
+/*
+ * 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.misc;
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+/**
+ * Iterator implementation that wraps multiple iterators and invokes them in sequence.
+ */
+public final class MultiIterator<T> implements Iterator<T> {
+
+    private Iterator<Iterator<T>> iterators;
+    private Iterator<T> current;
+
+    public MultiIterator(Iterable<Iterator<T>> i) {
+        this(i.iterator());
+    }
+
+    public MultiIterator(Iterator<T>... iterators) {
+        this(Arrays.asList(iterators).iterator());
+    }
+
+    public MultiIterator(Iterator<Iterator<T>> iterators) {
+        this.iterators = iterators;
+        current = selectCurrent();
+    }
+
+    private Iterator<T> selectCurrent() {
+        if (current == null) {
+            if (iterators.hasNext())
+                current = iterators.next();
+        } else if (!current.hasNext() && iterators.hasNext()) {
+            current = iterators.next();
+        }
+        return current;
+    }
+
+    public boolean hasNext() {
+        Iterator<T> c = selectCurrent();
+        return c != null ? c.hasNext() : false;
+    }
+
+    public T next() {
+        if (hasNext())
+            return selectCurrent().next();
+        else
+            return null;
+    }
+
+    public void remove() {
+        throw new UnsupportedOperationException();
+    }
+
+}

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

Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/PoolManager.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/PoolManager.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/PoolManager.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/PoolManager.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,76 @@
+/*
+ * 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.misc;
+
+import java.util.Queue;
+import java.util.concurrent.ArrayBlockingQueue;
+
+
+/**
+ * Implements a simple pool manager. By default, an upper limit to the pool is set at 25 entries. New items can always
+ * be created, but if more than 25 entries are released back to the pool, extras are discarded. Items added to the
+ * stack should never maintain any kind of state as it is entirely possible that different threads will be grabbing
+ * items from the pool
+ */
+public abstract class PoolManager<T,R> implements ItemManager<T,R> {
+
+    private static final int DEFAULT_SIZE = 25;
+    private final Queue<T> pool;
+    private final int cap;
+    
+    protected PoolManager() {
+        this(DEFAULT_SIZE);
+    }
+
+    protected PoolManager(int max) {
+        this.pool = initStack(max);
+        this.cap = max;
+    }
+
+    public int currentSize() {
+      return pool.size();
+    }
+    
+    private Queue<T> initStack(final int max) {
+      return new ArrayBlockingQueue<T>(Math.max(1,max));
+    }
+
+    protected T getInstance() {
+      T t = pool.poll();
+      return t != null ? t : internalNewInstance();
+    }
+
+    public synchronized void release(T t) {
+        if (t == null) return;
+        if (remaining() == 0)
+          pool.poll();
+        pool.offer(t);
+    }
+
+    public int remaining() {
+      return cap - pool.size();
+    }
+    
+    protected abstract T internalNewInstance();
+
+    public T get(R request) {
+      return getInstance();
+    }
+
+
+}

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

Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/Resolver.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/Resolver.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/Resolver.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/Resolver.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,28 @@
+/*
+ * 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.misc;
+
+/**
+ * The Resolver interface is a utility class used to resolve objects based on a request. It is used internally by Abdera
+ * as the basis for Target and Subject resolvers.
+ */
+public interface Resolver<T,R> {
+
+    T resolve(R key);
+
+}

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

Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractBaseRequestContext.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractBaseRequestContext.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractBaseRequestContext.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractBaseRequestContext.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,124 @@
+/*
+ * 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.security.Principal;
+import java.util.Arrays;
+import java.util.Iterator;
+
+import javax.security.auth.Subject;
+
+import org.apache.abdera2.common.iri.IRI;
+
+@SuppressWarnings("unchecked")
+public abstract class AbstractBaseRequestContext 
+  extends AbstractRequest 
+  implements RequestContext {
+
+    protected final Provider provider;
+    protected Subject subject;
+    protected Principal principal;
+    protected Target target;
+    protected final String method;
+    protected final IRI requestUri;
+    protected final IRI baseUri;
+    
+    protected AbstractBaseRequestContext(
+        Provider provider, 
+        String method, 
+        IRI requestUri, 
+        IRI baseUri) {
+        this.provider = provider;
+        this.method = method;
+        this.baseUri = baseUri;
+        this.requestUri = requestUri;
+    }
+    
+    protected Target initTarget(Provider provider) {
+      try {
+          return provider.resolveTarget(this);
+      } catch (Exception e) {
+          throw new RuntimeException(e);
+      }
+  }
+    
+    protected Target initTarget() {
+        try {
+            Target target = initTarget(provider);
+            return target != null ? 
+              target : 
+              new SimpleTarget(TargetType.TYPE_NOT_FOUND, this);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public IRI getBaseUri() {
+        return baseUri;
+    }
+
+    public IRI getResolvedUri() {
+        return baseUri.resolve(getUri());
+    }
+
+    public String getMethod() {
+        return method;
+    }
+
+    public IRI getUri() {
+        return requestUri;
+    }
+
+    public Subject getSubject() {
+        return subject;
+    }
+
+    public Principal getPrincipal() {
+        return principal;
+    }
+
+    public Target getTarget() {
+        return target;
+    }
+
+    public Provider getProvider() {
+        return provider;
+    }
+
+    public String getTargetPath() {
+        String uri = getUri().toString();
+        String cpath = getContextPath();
+        return cpath == null ? uri : uri.substring(cpath.length());
+    }
+
+    public <T extends RequestContext>T setAttribute(String name, Object value) {
+        return setAttribute(Scope.REQUEST, name, value);
+    }
+
+    public String urlFor(Object key, Object param) {
+        return provider.urlFor(this, key, param);
+    }
+
+    public String absoluteUrlFor(Object key, Object param) {
+        return getResolvedUri().resolve(urlFor(key, param)).toString();
+    }
+
+    public Iterator<Property> iterator() {
+      return Arrays.asList(Property.values()).iterator();
+    }
+}

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

Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractCollectionAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractCollectionAdapter.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractCollectionAdapter.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractCollectionAdapter.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,157 @@
+/*
+ * 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.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.abdera2.common.text.UrlEncoding;
+import org.apache.abdera2.common.date.DateTime;
+import org.apache.abdera2.common.http.EntityTag;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Base CollectionAdapter implementation that provides a number of helper utility methods for adapter implementations.
+ */
+@SuppressWarnings("unchecked")
+public abstract class AbstractCollectionAdapter 
+  implements CollectionAdapter, 
+             MediaCollectionAdapter, 
+             Transactional,
+             CollectionInfo {
+
+    private final static Log log = LogFactory.getLog(AbstractCollectionAdapter.class);
+
+    private String href;
+    private Map<String, Object> hrefParams = new HashMap<String, Object>();
+
+    public AbstractCollectionAdapter() {
+        super();
+    }
+
+    public String getHref() {
+        return href;
+    }
+
+    public void setHref(String href) {
+        this.href = href;
+        hrefParams.put("collection", href);
+    }
+
+    public String getHref(RequestContext request) {
+        return request.urlFor("feed", hrefParams);
+    }
+
+    public void compensate(RequestContext request, Throwable t) {
+    }
+
+    public void end(RequestContext request, ResponseContext response) {
+    }
+
+    public void start(RequestContext request) {
+    }
+
+    public <S extends ResponseContext>S deleteMedia(RequestContext request) {
+        return (S)ProviderHelper.notallowed(request);
+    }
+
+    public <S extends ResponseContext>S getMedia(RequestContext request) {
+        return (S)ProviderHelper.notallowed(request);
+    }
+
+    public <S extends ResponseContext>S headMedia(RequestContext request) {
+        return (S)ProviderHelper.notallowed(request);
+    }
+
+    public <S extends ResponseContext>S optionsMedia(RequestContext request) {
+        return (S)ProviderHelper.notallowed(request);
+    }
+
+    public <S extends ResponseContext>S putMedia(RequestContext request) {
+        return (S)ProviderHelper.notallowed(request);
+    }
+
+    public <S extends ResponseContext>S postMedia(RequestContext request) {
+        return (S)ProviderHelper.notallowed(request);
+    }
+
+    public <S extends ResponseContext>S headItem(RequestContext request) {
+        return (S)ProviderHelper.notallowed(request);
+    }
+
+    public <S extends ResponseContext>S optionsItem(RequestContext request) {
+        return (S)ProviderHelper.notallowed(request);
+    }
+
+    public abstract String getAuthor(RequestContext request) throws ResponseContextException;
+
+    public abstract String getId(RequestContext request);
+
+    /**
+     * Creates the ResponseContext for a HEAD entry request. By default, an EmptyResponseContext is returned. The Etag
+     * header will be set.
+     */
+    protected <S extends ResponseContext>S buildHeadEntryResponse(RequestContext request, String id, Date updated)
+        throws ResponseContextException {
+        EmptyResponseContext rc = new EmptyResponseContext(200);
+        rc.setEntityTag(EntityTag.generate(id, DateTime.format(updated)));
+        return (S)rc;
+    }
+
+    /**
+     * Create a ResponseContext (or take it from the Exception) for an exception that occurred in the application.
+     * 
+     * @param e
+     * @return
+     */
+    protected <S extends ResponseContext>S createErrorResponse(ResponseContextException e) {
+        if (log.isDebugEnabled()) {
+            log.debug("A ResponseException was thrown.", e);
+        } else if (e.getResponseContext() instanceof EmptyResponseContext && ((EmptyResponseContext)e
+            .getResponseContext()).getStatus() >= 500) {
+            log.warn("A ResponseException was thrown.", e);
+        }
+
+        return e.getResponseContext();
+    }
+
+    /**
+     * Get's the name of the specific resource requested
+     */
+    protected String getResourceName(RequestContext request) {
+        String path = request.getTargetPath();
+        int q = path.indexOf("?");
+        if (q != -1) {
+            path = path.substring(0, q);
+        }
+        String[] segments = path.split("/");
+        String id = segments[segments.length - 1];
+        return UrlEncoding.decode(id);
+    }
+
+    public <S extends ResponseContext>S extensionRequest(RequestContext request) {
+        return (S)ProviderHelper.notallowed(request, getMethods(request));
+    }
+
+    private String[] getMethods(RequestContext request) {
+        return ProviderHelper.getDefaultMethods(request);
+    }
+
+}

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

Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractMessage.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractMessage.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractMessage.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractMessage.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,112 @@
+/*
+ * 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.ArrayList;
+import java.util.List;
+
+import javax.activation.MimeType;
+
+import org.apache.abdera2.common.http.CacheControl;
+import org.apache.abdera2.common.http.Preference;
+import org.apache.abdera2.common.http.WebLink;
+import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.common.text.Codec;
+import org.apache.abdera2.common.text.UrlEncoding;
+
+/**
+ * Root impl for Message interface impls. This is provided solely as a way of keeping the interface and impl's
+ * consistent across the Request and Response objects.
+ */
+public abstract class AbstractMessage implements Message {
+
+    protected int flags = 0;
+    protected long max_age = -1;
+
+    public CacheControl getCacheControl() {
+        String cc = getHeader("Cache-Control");
+        return cc != null ? new CacheControl(cc) : null;
+    }
+
+    public String getContentLanguage() {
+        return getHeader("Content-Language");
+    }
+
+    public IRI getContentLocation() {
+        String value = getHeader("Content-Location");
+        return (value != null) ? new IRI(value) : null;
+    }
+
+    public MimeType getContentType() {
+        try {
+            String value = getHeader("Content-Type");
+            return (value != null) ? new MimeType(value) : null;
+        } catch (javax.activation.MimeTypeParseException e) {
+            throw new org.apache.abdera2.common.mediatype.MimeTypeParseException(e);
+        }
+    }
+
+    public String getDecodedHeader(String header) {
+        return UrlEncoding.decode(Codec.decode(getHeader(header)));
+    }
+
+    public Iterable<String> getDecodedHeaders(String header) {
+        Iterable<Object> headers = getHeaders(header);
+        List<String> items = new ArrayList<String>();
+        for (Object h : headers)
+          items.add(UrlEncoding.decode(Codec.decode(h.toString())));
+        return items;
+    }
+
+    public String getSlug() {
+        return getDecodedHeader("Slug");
+    }
+
+    public Iterable<WebLink> getWebLinks() {
+      List<WebLink> links = new ArrayList<WebLink>();
+      Iterable<Object> headers = this.getHeaders("Link");
+      for (Object obj : headers) {
+        Iterable<WebLink> list = WebLink.parse(obj.toString());
+        for (WebLink link : list)
+          links.add(link);
+      }
+      return links;
+    }
+    
+    public Iterable<Preference> getPrefer() {
+      List<Preference> links = new ArrayList<Preference>();
+      Iterable<Object> headers = this.getHeaders("Prefer");
+      for (Object obj : headers) {
+        Iterable<Preference> list = Preference.parse(obj.toString());
+        for (Preference link : list)
+          links.add(link);
+      }
+      return links;
+    }
+    
+    public Iterable<Preference> getPreferApplied() {
+      List<Preference> links = new ArrayList<Preference>();
+      Iterable<Object> headers = this.getHeaders("Preference-Applied");
+      for (Object obj : headers) {
+        Iterable<Preference> list = Preference.parse(obj.toString());
+        for (Preference link : list)
+          links.add(link);
+      }
+      return links;
+    }
+}

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

Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractRequest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractRequest.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractRequest.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractRequest.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,67 @@
+/*
+ * 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.Date;
+
+import org.apache.abdera2.common.http.Authentication;
+import org.apache.abdera2.common.http.EntityTag;
+
+public abstract class AbstractRequest extends AbstractMessage implements Request {
+
+    protected long max_stale = -1;
+    protected long min_fresh = -1;
+
+    public String getAccept() {
+        return getHeader("Accept");
+    }
+
+    public String getAcceptCharset() {
+        return getHeader("Accept-Charset");
+    }
+
+    public String getAcceptEncoding() {
+        return getHeader("Accept-Encoding");
+    }
+
+    public String getAcceptLanguage() {
+        return getHeader("Accept-Language");
+    }
+
+    public Iterable<Authentication> getAuthentication() {
+        String auth =  getHeader("Authorization");
+        return auth != null ? Authentication.parse(auth) : null;
+    }
+    
+    public Iterable<EntityTag> getIfMatch() {
+        return EntityTag.parseTags(getHeader("If-Match"));
+    }
+
+    public Date getIfModifiedSince() {
+        return getDateHeader("If-Modified-Since");
+    }
+
+    public Iterable<EntityTag> getIfNoneMatch() {
+        return EntityTag.parseTags(getHeader("If-None-Match"));
+    }
+
+    public Date getIfUnmodifiedSince() {
+        return getDateHeader("If-Unmodified-Since");
+    }
+
+}

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

Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractResponse.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractResponse.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractResponse.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractResponse.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,77 @@
+/*
+ * 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.Date;
+
+import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.common.http.Authentication;
+import org.apache.abdera2.common.http.EntityTag;
+import org.apache.abdera2.common.http.ResponseType;
+
+public abstract class AbstractResponse extends AbstractMessage implements Response {
+
+    public long getAge() {
+        String value = getHeader("Age");
+        try {
+            return (value != null) ? Long.parseLong(value) : -1;
+        } catch (NumberFormatException e) {
+            return -1;
+        }
+    }
+
+    public String getAllow() {
+        return getHeader("Allow");
+    }
+
+    public long getContentLength() {
+        String value = getHeader("Content-Length");
+        try {
+            return (value != null) ? Long.parseLong(value) : -1;
+        } catch (NumberFormatException e) {
+            return -1;
+        }
+    }
+
+    public EntityTag getEntityTag() {
+        String etag = getHeader("ETag");
+        return (etag != null) ? EntityTag.parse(getHeader("ETag")) : null;
+    }
+
+    public Date getExpires() {
+        return getDateHeader("Expires");
+    }
+
+    public Date getLastModified() {
+        return getDateHeader("Last-Modified");
+    }
+
+    public IRI getLocation() {
+        String l = getHeader("Location");
+        return l != null ? new IRI(l) : null;
+    }
+
+    public ResponseType getType() {
+        return ResponseType.select(getStatus());
+    }
+
+    public Iterable<Authentication> getAuthentication() {
+      String auth =  getHeader("WWW-Authenticate");
+      return auth != null ? Authentication.parse(auth) : null;
+  }
+}

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

Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractResponseContext.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractResponseContext.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractResponseContext.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractResponseContext.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,273 @@
+/*
+ * 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.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.activation.MimeType;
+
+
+import org.apache.abdera2.common.Localizer;
+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.http.CacheControl;
+import org.apache.abdera2.common.http.EntityTag;
+import org.apache.abdera2.common.http.Preference;
+import org.apache.abdera2.common.http.WebLink;
+
+@SuppressWarnings("unchecked")
+public abstract class AbstractResponseContext extends AbstractResponse implements ResponseContext {
+
+    protected static final String[] EMPTY = new String[0];
+
+    protected int status = 0;
+    protected String status_text = null;
+    protected boolean binary = false;
+
+    protected Map<String, Iterable<Object>> headers = null;
+
+    public <T extends ResponseContext>T setBinary(boolean binary) {
+        this.binary = binary;
+        return (T)this;
+    }
+
+    public boolean isBinary() {
+        return binary;
+    }
+
+    public <T extends ResponseContext>T setCacheControl(CacheControl cc) {
+      return setCacheControl(cc.toString());
+    }
+    
+    public <T extends ResponseContext>T setCacheControl(String cc) {
+      return this.setHeader("Cache-Control", cc);
+    }
+    
+    public <T extends ResponseContext>T removeHeader(String name) {
+        getHeaders().remove(name);
+        return (T)this;
+    }
+
+    public <T extends ResponseContext>T setEncodedHeader(String name, String charset, String value) {
+        return setHeader(name, Codec.encode(value, charset));
+    }
+
+    public <T extends ResponseContext>T setEncodedHeader(String name, String charset, String... vals) {
+        Object[] evals = new Object[vals.length];
+        for (int n = 0; n < vals.length; n++) {
+            evals[n] = Codec.encode(vals[n], charset);
+        }
+        return setHeader(name, evals);
+    }
+
+    public <T extends ResponseContext>T setEscapedHeader(String name, Profile profile, String value) {
+        return setHeader(name, UrlEncoding.encode(value, profile));
+    }
+
+    public <T extends ResponseContext>T setHeader(String name, Object value) {
+        return setHeader(name, new Object[] {value});
+    }
+
+    public <T extends ResponseContext>T setHeader(String name, Object... vals) {
+        Map<String, Iterable<Object>> headers = getHeaders();
+        Set<Object> values = new HashSet<Object>();
+        for (Object value : vals)
+            values.add(value);
+        headers.put(name, values);
+        return (T)this;
+    }
+
+    public <T extends ResponseContext>T addEncodedHeader(String name, String charset, String value) {
+        return addHeader(name, Codec.encode(value, charset));
+    }
+
+    public <T extends ResponseContext>T addEncodedHeaders(String name, String charset, String... vals) {
+        for (String value : vals) {
+            addHeader(name, Codec.encode(value, charset));
+        }
+        return (T)this;
+    }
+
+    public <T extends ResponseContext>T addHeader(String name, Object value) {
+        return addHeaders(name, new Object[] {value});
+    }
+
+    public <T extends ResponseContext>T addHeaders(String name, Object... vals) {
+        Map<String, Iterable<Object>> headers = getHeaders();
+        Iterable<Object> values = headers.get(name);
+        Set<Object> l = null;
+        if (values == null)
+            l = new HashSet<Object>();
+        else
+            l = (Set<Object>)values;
+        for (Object value : vals) {
+            l.add(value);
+        }
+        headers.put(name, l);
+        return (T)this;
+    }
+
+    public Map<String, Iterable<Object>> getHeaders() {
+        if (headers == null)
+            headers = new HashMap<String, Iterable<Object>>();
+        return headers;
+    }
+
+    public Date getDateHeader(String name) {
+        Map<String, Iterable<Object>> headers = getHeaders();
+        Iterable<Object> values = headers.get(name);
+        if (values != null) {
+            for (Object value : values) {
+                if (value instanceof Date)
+                    return (Date)value;
+            }
+        }
+        return null;
+    }
+
+    public String getHeader(String name) {
+        Map<String, Iterable<Object>> headers = getHeaders();
+        Iterable<Object> values = headers.get(name);
+        if (values != null)
+          for (Object val : values)
+            return val.toString();
+        return null;
+    }
+
+    public Iterable<Object> getHeaders(String name) {
+        Map<String, Iterable<Object>> headers = getHeaders();
+        return headers.get(name);
+    }
+
+    public Iterable<String> getHeaderNames() {
+        Map<String, Iterable<Object>> headers = getHeaders();
+        return headers.keySet();
+    }
+
+    public <T extends ResponseContext>T setAge(long age) {
+        return (T)(age == -1 ? removeHeader("Age") : setHeader("Age", String.valueOf(age)));
+    }
+
+    public <T extends ResponseContext>T setContentLanguage(String language) {
+        return (T)(language == null ? removeHeader("Content-Language") : setHeader("Content-Language", language));
+    }
+
+    public <T extends ResponseContext>T setContentLength(long length) {
+        return (T)(length == -1 ? removeHeader("Content-Length") : setHeader("Content-Length", String.valueOf(length)));
+    }
+
+    public <T extends ResponseContext>T setContentLocation(String uri) {
+        return (T)(uri == null ? removeHeader("Content-Location") : setHeader("Content-Location", uri));
+    }
+
+    public <T extends ResponseContext>T setSlug(String slug) {
+        if (slug == null) {
+            return removeHeader("Slug");
+        }
+        if (slug.indexOf((char)10) > -1 || slug.indexOf((char)13) > -1)
+            throw new IllegalArgumentException(Localizer.get("SLUG.BAD.CHARACTERS"));
+        return setEscapedHeader("Slug", Profile.PATHNODELIMS, slug);
+    }
+
+    public <T extends ResponseContext>T setContentType(String type) {
+        return setContentType(type, null);
+    }
+
+    public <T extends ResponseContext>T setContentType(String type, String charset) {
+        if (type == null) {
+            return removeHeader("Content-Type");
+        }
+        try {
+            MimeType mimeType = new MimeType(type);
+            if (charset != null)
+                mimeType.setParameter("charset", charset);
+            return setHeader("Content-Type", mimeType.toString());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public <T extends ResponseContext>T setEntityTag(String etag) {
+        return (T)(etag != null ? setEntityTag(new EntityTag(etag)) : removeHeader("ETag"));
+    }
+
+    public <T extends ResponseContext>T setEntityTag(EntityTag etag) {
+        return (T)(etag == null ? removeHeader("ETag") : setHeader("ETag", etag.toString()));
+    }
+
+    public <T extends ResponseContext>T setExpires(Date date) {
+        return (T)(date == null ? removeHeader("Expires") : setHeader("Expires", date));
+    }
+
+    public <T extends ResponseContext>T setLastModified(Date date) {
+        return (T)(date == null ? removeHeader("Last-Modified") : setHeader("Last-Modified", date));
+    }
+
+    public <T extends ResponseContext>T setLocation(String uri) {
+        return (T)(uri == null ? removeHeader("Location") : setHeader("Location", uri));
+    }
+
+    public int getStatus() {
+        return status;
+    }
+
+    public <T extends ResponseContext>T setStatus(int status) {
+        this.status = status;
+        return (T)this;
+    }
+
+    public String getStatusText() {
+        return status_text;
+    }
+
+    public <T extends ResponseContext>T setStatusText(String text) {
+        this.status_text = text;
+        return (T)this;
+    }
+
+    public <T extends ResponseContext>T setAllow(String method) {
+        return setHeader("Allow", method);
+    }
+
+    public <T extends ResponseContext>T setAllow(String... methods) {
+        StringBuilder buf = new StringBuilder();
+        for (String method : methods) {
+            if (buf.length() > 0)
+                buf.append(", ");
+            buf.append(method);
+        }
+        return setAllow(buf.toString());
+    }
+
+    public <T extends ResponseContext>T setWebLinks(WebLink link, WebLink... links) {
+      return setHeader("Link", WebLink.toString(link,links));
+    }
+    
+    public <B extends ResponseContext>B setPrefer(Preference pref, Preference... prefs) {
+      return setHeader("Prefer", Preference.toString(pref,prefs));
+    }
+    
+    public <B extends ResponseContext>B setPreferApplied(Preference pref, Preference... prefs) {
+      return setHeader("Preference-Applied", Preference.toString(pref,prefs));
+    }
+}

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

Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractServiceManager.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractServiceManager.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractServiceManager.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractServiceManager.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,81 @@
+/*
+ * 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.Map;
+
+import org.apache.abdera2.common.Discover;
+import org.apache.abdera2.common.Localizer;
+import org.apache.abdera2.common.protocol.servlet.async.DefaultProcessor;
+import org.apache.abdera2.common.protocol.servlet.async.DefaultTaskExecutor;
+import org.apache.abdera2.common.protocol.servlet.async.ProcessorQueue;
+import org.apache.abdera2.common.protocol.servlet.async.TaskExecutor;
+import org.apache.abdera2.common.pusher.ChannelManager;
+import org.apache.abdera2.common.pusher.SimpleChannelManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * The ServiceManager is used by the AbderaServlet to bootstrap the server instance. There should be little to no reason
+ * why an end user would need to use this class directly.
+ */
+public abstract class AbstractServiceManager<P extends Provider> 
+  implements ServiceManager<P> {
+
+    private final static Log log = LogFactory.getLog(AbstractServiceManager.class);
+
+    protected AbstractServiceManager() {}
+
+    /* (non-Javadoc)
+     * @see org.apache.abdera2.protocol.server.IServiceManager#newProcessorQueue(java.util.Map)
+     */
+    public ProcessorQueue newProcessorQueue(Map<String, String> properties) {
+      String instance = properties.get(PROCESSORQUEUE);
+      if (instance == null)
+        instance = DefaultProcessor.class.getName();
+      log.debug(Localizer.sprintf("CREATING.NEW.INSTANCE", "ProcessorQueue"));
+      ProcessorQueue queue = (ProcessorQueue)Discover.locate(ProcessorQueue.class, instance);
+      return queue;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.abdera2.protocol.server.IServiceManager#newTaskExecutor(java.util.Map)
+     */
+    public TaskExecutor newTaskExecutor(Map<String, String> properties) {
+      String instance = properties.get(TASKEXECUTOR);
+      if (instance == null)
+        instance = DefaultTaskExecutor.class.getName();
+      log.debug(Localizer.sprintf("CREATING.NEW.INSTANCE", "TaskExecutor"));
+      TaskExecutor exec = (TaskExecutor)Discover.locate(TaskExecutor.class, instance);
+      exec.init(properties);
+      return exec;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.abdera2.protocol.server.IServiceManager#newChannelManager(java.util.Map)
+     */
+    public ChannelManager newChannelManager(Map<String, String> properties) {
+      String instance = properties.get(CHANNELMANAGER);
+      if (instance == null)
+        instance = SimpleChannelManager.class.getName();
+      log.debug(Localizer.sprintf("CREATING.NEW.INSTANCE", "ChannelManager"));
+      ChannelManager cm = (ChannelManager)Discover.locate(ChannelManager.class, instance);
+      cm.init(properties);
+      return cm;
+    }
+}

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

Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractWorkspaceManager.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractWorkspaceManager.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractWorkspaceManager.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractWorkspaceManager.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,58 @@
+/*
+ * 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.Collection;
+import java.util.Date;
+import java.util.HashSet;
+
+import org.apache.abdera2.common.http.EntityTag;
+
+/**
+ * Base implementation for WorkspaceManager implementations
+ */
+public abstract class AbstractWorkspaceManager 
+  implements WorkspaceManager {
+
+    protected Collection<WorkspaceInfo> workspaces;
+    public static final String COLLECTION_ADAPTER_ATTRIBUTE = "collectionProvider";
+
+    public Collection<WorkspaceInfo> getWorkspaces(RequestContext request) {
+        return workspaces;
+    }
+
+    public void setWorkspaces(Collection<WorkspaceInfo> workspaces) {
+        this.workspaces = workspaces;
+    }
+
+    public void addWorkspace(WorkspaceInfo workspace) {
+        if (workspaces == null) {
+            workspaces = new HashSet<WorkspaceInfo>();
+        }
+        workspaces.add(workspace);
+    }
+    
+    public Date getLastModified() {
+      return new Date();
+    }
+    
+    public EntityTag getEntityTag() { 
+      return null;
+    }
+
+}

Propchange: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractWorkspaceManager.java
------------------------------------------------------------------------------
    svn:executable = *

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

Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractWorkspaceProvider.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractWorkspaceProvider.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractWorkspaceProvider.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractWorkspaceProvider.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,80 @@
+/*
+ * 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.Collection;
+import java.util.Date;
+import java.util.HashSet;
+
+import org.apache.abdera2.common.http.EntityTag;
+import org.apache.abdera2.common.misc.Resolver;
+
+/**
+ * An abstract base Provider implementation that implements the WorkspaceManager interface. This is intended to be used
+ * by Provider's that do not wish to use a separate WorkspaceManager object.
+ */
+public abstract class AbstractWorkspaceProvider
+    extends BaseProvider 
+      implements WorkspaceManager {
+
+    protected Resolver<Target,RequestContext> targetResolver;
+    protected TargetBuilder<?> targetBuilder;
+    protected Collection<WorkspaceInfo> workspaces;
+
+    protected WorkspaceManager getWorkspaceManager(RequestContext request) {
+      return this;
+    }
+
+    protected Resolver<Target,RequestContext> getTargetResolver(RequestContext request) {
+        return targetResolver;
+    }
+
+    @SuppressWarnings("rawtypes")
+    protected TargetBuilder getTargetBuilder(Request request) {
+        return (TargetBuilder)targetBuilder;
+    }
+
+    protected void setTargetBuilder(TargetBuilder<?> targetBuilder) {
+        this.targetBuilder = targetBuilder;
+    }
+
+    protected void setTargetResolver(Resolver<Target,RequestContext> targetResolver) {
+        this.targetResolver = targetResolver;
+    }
+
+    public Collection<WorkspaceInfo> getWorkspaces(RequestContext request) {
+        return workspaces;
+    }
+
+    public void addWorkspace(WorkspaceInfo workspace) {
+        if (workspaces == null) {
+            workspaces = new HashSet<WorkspaceInfo>();
+        }
+        workspaces.add(workspace);
+    }
+
+    // JIRA: https://issues.apache.org/jira/browse/ABDERA-255
+    public EntityTag getEntityTag() {
+      return null;
+    }
+    
+    // JIRA: https://issues.apache.org/jira/browse/ABDERA-255
+    public Date getLastModified() {
+      return new Date();
+    }
+}

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

Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/BaseProvider.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/BaseProvider.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/BaseProvider.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/BaseProvider.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,185 @@
+/*
+ * 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.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.security.auth.Subject;
+import org.apache.abdera2.common.misc.Resolver;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Base Provider implementation that provides the core implementation details for all Providers. This class provides the
+ * basic request routing logic.
+ */
+@SuppressWarnings({"unchecked","rawtypes"})
+public abstract class BaseProvider
+  implements Provider {
+
+    private final static Log log = LogFactory.getLog(BaseProvider.class);
+    protected Map<String, String> properties;
+    protected Set<Filter> filters = 
+      new LinkedHashSet<Filter>();
+    protected Map<TargetType, RequestProcessor> requestProcessors = 
+      new HashMap<TargetType, RequestProcessor>();
+
+    public void init(Map<String,String> properties) {
+      this.properties = properties != null ? properties : new HashMap<String,String>();
+    }
+
+    public String getProperty(String name) {
+        return properties.get(name);
+    }
+
+    public Iterable<String> getPropertyNames() {
+        return properties.keySet();
+    }
+
+    public Subject resolveSubject(RequestContext request) {
+        Resolver<Subject,Request> subjectResolver = getSubjectResolver(request);
+        return subjectResolver != null ? subjectResolver.resolve(request) : null;
+    }
+
+    public Target resolveTarget(RequestContext request) {
+        Resolver<Target,RequestContext> targetResolver = getTargetResolver(request);
+        return targetResolver != null ? targetResolver.resolve(request) : null;
+    }
+
+    public String urlFor(Request request, Object key, Object param) {
+        TargetBuilder tm = getTargetBuilder(request);
+        return tm != null ? tm.urlFor(request, key, param) : null;
+    }
+
+    protected Resolver<Subject,Request> getSubjectResolver(RequestContext request) {
+        return new SimpleSubjectResolver();
+    }
+
+    protected abstract TargetBuilder getTargetBuilder(Request request);
+
+    protected abstract Resolver<Target, RequestContext> getTargetResolver(RequestContext request);
+
+    public <S extends ResponseContext>S process(RequestContext request) {
+        Target target = request.getTarget();
+        if (target == null || target.getType() == TargetType.TYPE_NOT_FOUND) {
+            return (S)ProviderHelper.notfound(request);
+        }
+
+        TargetType type = target.getType();
+        log.debug(String.format("Processing [%s] request for Target [%s] of Type [%s]",request.getMethod(),target.getIdentity(),type.toString()));
+        RequestProcessor processor = 
+          (RequestProcessor) this.requestProcessors.get(type);
+        if (processor == null) {
+            return (S)ProviderHelper.notfound(request);
+        }
+
+        WorkspaceManager wm = getWorkspaceManager(request);
+        CollectionAdapter adapter = wm.getCollectionAdapter(request);
+        Transactional transaction = 
+          adapter instanceof Transactional ? (Transactional)adapter : null;
+        S response = null;
+        try {
+            transactionStart(transaction, request);
+            response = (S)processor.process(request, wm, adapter);
+            response = (S)(response != null ? response : processExtensionRequest(request, adapter));
+        } catch (Throwable e) {
+            if (e instanceof ResponseContextException) {
+                ResponseContextException rce = (ResponseContextException)e;
+                if (rce.getStatusCode() >= 400 && rce.getStatusCode() < 500) {
+                    // don't report routine 4xx HTTP errors
+                    log.info(e);
+                } else {
+                    log.error(e);
+                }
+            } else {
+                log.error(e);
+            }
+            transactionCompensate(transaction, request, e);
+            response = (S)createErrorResponse(request, e);
+            return response;
+        } finally {
+            transactionEnd(transaction, request, response);
+        }
+        return (S)(response != null ? response : ProviderHelper.badrequest(request));
+    }
+
+    /**
+     * Subclass to customize the kind of error response to return
+     */
+    protected ResponseContext createErrorResponse(RequestContext request, Throwable e) {
+        return ProviderHelper.servererror(request, e);
+    }
+
+    protected void transactionCompensate(Transactional transactional, RequestContext request, Throwable e) {
+        if (transactional != null) {
+            transactional.compensate(request, e);
+        }
+    }
+
+    protected void transactionEnd(Transactional transactional, RequestContext request, ResponseContext response) {
+        if (transactional != null) {
+            transactional.end(request, response);
+        }
+    }
+
+    protected void transactionStart(Transactional transactional, RequestContext request)
+        throws ResponseContextException {
+        if (transactional != null) {
+            transactional.start(request);
+        }
+    }
+
+    protected ResponseContext processExtensionRequest(RequestContext context, CollectionAdapter adapter) {
+        return adapter.extensionRequest(context);
+    }
+
+    protected abstract WorkspaceManager getWorkspaceManager(RequestContext request);
+
+    public void setFilters(Collection<Filter> filters) {
+        this.filters = new LinkedHashSet<Filter>(filters);
+    }
+
+    public Iterable<Filter> getFilters(RequestContext request) {
+        return filters;
+    }
+
+    public void addFilter(Filter... filters) {
+        for (Filter filter : filters) {
+            this.filters.add(filter);
+        }
+    }
+
+    public void setRequestProcessors(Map<TargetType, RequestProcessor> requestProcessors) {
+        this.requestProcessors.clear();
+        this.requestProcessors.putAll(requestProcessors);
+    }
+
+    public void addRequestProcessors(Map<TargetType, RequestProcessor> requestProcessors) {
+        this.requestProcessors.putAll(requestProcessors);
+    }
+
+    public Map<TargetType, RequestProcessor> getRequestProcessors() {
+        return Collections.unmodifiableMap(this.requestProcessors);
+    }
+    
+}

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

Added: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/BaseRequestContextWrapper.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/BaseRequestContextWrapper.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/BaseRequestContextWrapper.java (added)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/BaseRequestContextWrapper.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,251 @@
+/*
+ * 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.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.security.Principal;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+import javax.activation.MimeType;
+import javax.security.auth.Subject;
+
+import org.apache.abdera2.common.iri.IRI;
+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;
+
+@SuppressWarnings("unchecked")
+public class BaseRequestContextWrapper
+  implements RequestContext{
+
+    protected final RequestContext request;
+
+    public BaseRequestContextWrapper(RequestContext request) {
+        this.request = request;
+    }
+
+    public Object getAttribute(Scope scope, String name) {
+        return request.getAttribute(scope, name);
+    }
+
+    public Iterable<String> getAttributeNames(Scope scope) {
+        return request.getAttributeNames(scope);
+    }
+
+    public IRI getBaseUri() {
+        return request.getBaseUri();
+    }
+
+    public String getContextPath() {
+        return request.getContextPath();
+    }
+
+    public InputStream getInputStream() throws IOException {
+        return request.getInputStream();
+    }
+
+    public String getMethod() {
+        return request.getMethod();
+    }
+
+    public String getParameter(String name) {
+        return request.getParameter(name);
+    }
+
+    public Iterable<String> getParameterNames() {
+        return request.getParameterNames();
+    }
+
+    public List<String> getParameters(String name) {
+        return request.getParameters(name);
+    }
+
+    public Locale getPreferredLocale() {
+        return request.getPreferredLocale();
+    }
+
+    public Iterable<Locale> getPreferredLocales() {
+        return request.getPreferredLocales();
+    }
+
+    public Principal getPrincipal() {
+        return request.getPrincipal();
+    }
+
+    public <T>T getProperty(Property property) {
+        return request.getProperty(property);
+    }
+
+    public <P extends Provider>P getProvider() {
+        return request.getProvider();
+    }
+
+    public Reader getReader() throws IOException {
+        return request.getReader();
+    }
+
+    public IRI getResolvedUri() {
+        return request.getResolvedUri();
+    }
+
+    public Subject getSubject() {
+        return request.getSubject();
+    }
+
+    public Target getTarget() {
+        return request.getTarget();
+    }
+
+    public String getTargetPath() {
+        return request.getTargetPath();
+    }
+
+    public IRI getUri() {
+        return request.getUri();
+    }
+
+    public boolean isUserInRole(String role) {
+        return request.isUserInRole(role);
+    }
+
+    public <T extends RequestContext>T setAttribute(Scope scope, String name, Object value) {
+        request.setAttribute(scope, name, value);
+        return (T)this;
+    }
+
+    public <T extends RequestContext>T setAttribute(String name, Object value) {
+        request.setAttribute(name, value);
+        return (T)this;
+    }
+
+    public String getAccept() {
+        return request.getAccept();
+    }
+
+    public String getAcceptCharset() {
+        return request.getAcceptCharset();
+    }
+
+    public String getAcceptEncoding() {
+        return request.getAcceptEncoding();
+    }
+
+    public String getAcceptLanguage() {
+        return request.getAcceptLanguage();
+    }
+
+    public Iterable<Authentication> getAuthentication() {
+        return request.getAuthentication();
+    }
+
+    public Iterable<EntityTag> getIfMatch() {
+        return request.getIfMatch();
+    }
+
+    public Date getIfModifiedSince() {
+        return request.getIfModifiedSince();
+    }
+
+    public Iterable<EntityTag> getIfNoneMatch() {
+        return request.getIfNoneMatch();
+    }
+
+    public Date getIfUnmodifiedSince() {
+        return request.getIfUnmodifiedSince();
+    }
+
+    public CacheControl getCacheControl() {
+        return request.getCacheControl();
+    }
+
+    public String getContentLanguage() {
+        return request.getContentLanguage();
+    }
+
+    public IRI getContentLocation() {
+        return request.getContentLocation();
+    }
+
+    public MimeType getContentType() {
+        return request.getContentType();
+    }
+
+    public Date getDateHeader(String name) {
+        return request.getDateHeader(name);
+    }
+
+    public String getDecodedHeader(String name) {
+        return request.getDecodedHeader(name);
+    }
+
+    public Iterable<String> getDecodedHeaders(String name) {
+        return request.getDecodedHeaders(name);
+    }
+
+    public String getHeader(String name) {
+        return request.getHeader(name);
+    }
+
+    public Iterable<String> getHeaderNames() {
+        return request.getHeaderNames();
+    }
+
+    public Iterable<Object> getHeaders(String name) {
+        return request.getHeaders(name);
+    }
+
+    public String getSlug() {
+        return request.getSlug();
+    }
+
+    public String urlFor(Object key, Object param) {
+        return getProvider().urlFor(this, key, param);
+    }
+
+    public String getTargetBasePath() {
+        return request.getTargetBasePath();
+    }
+
+    public String absoluteUrlFor(Object key, Object param) {
+        return request.getResolvedUri().resolve(urlFor(key, param)).toString();
+    }
+
+    public Iterator<Property> iterator() {
+      return request.iterator();
+    }
+
+    public Iterable<WebLink> getWebLinks() {
+      return request.getWebLinks();
+    }
+
+    public Iterable<Preference> getPrefer() {
+      return request.getPrefer();
+    }
+    
+    public Iterable<Preference> getPreferApplied() {
+      return request.getPreferApplied();
+    }
+
+}

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



Mime
View raw message