abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r615396 - in /incubator/abdera/java/branches/server_refactor_all: ./ dependencies/i18n/src/main/java/org/apache/abdera/i18n/templates/ server/src/main/java/org/apache/abdera/protocol/server/ server/src/main/java/org/apache/abdera/protocol/s...
Date Fri, 25 Jan 2008 23:27:47 GMT
Author: jmsnell
Date: Fri Jan 25 15:27:43 2008
New Revision: 615396

URL: http://svn.apache.org/viewvc?rev=615396&view=rev
Log:
add the TargetBuilder mechanism.  This allows Provider implementations to handle the details
of URI/IRI construction so CollectionAdapter implementations do not have to.

For instance:

  private String getEntryLink(RequestContext request, String entryid) {
    Map<String,String> params = new HashMap<String,String>();
    params.put("collection", request.getTarget().getParameter("collection"));
    params.put("entry", entryid);
    return request.resolveIri(TargetType.TYPE_ENTRY, params);
  }
  
A target builder is associated with the Provider implementation.  The CollectionAdapter access
the
builder via the RequestContext.  DefaultProvider and BasicProvider each come with predetermined

TargetBuilder implementations that can be overridden but aren't likely to be.  Custom Provider
implementations need to provide their own TargetBuilder.

Added:
    incubator/abdera/java/branches/server_refactor_all/dependencies/i18n/src/main/java/org/apache/abdera/i18n/templates/DelegatingContext.java
    incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/TargetBuilder.java
    incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/TemplateTargetBuilder.java
Modified:
    incubator/abdera/java/branches/server_refactor_all/.classpath
    incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/Provider.java
    incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/RequestContext.java
    incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/context/AbstractRequestContext.java
    incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/context/RequestContextWrapper.java
    incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java
    incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractWorkspaceProvider.java
    incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultProvider.java
    incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/StructuredTargetResolver.java
    incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/provider/basic/BasicProvider.java
    incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/servlet/ServletRequestContext.java
    incubator/abdera/java/branches/server_refactor_all/server/src/test/java/org/apache/abdera/protocol/server/test/custom/CustomProvider.java
    incubator/abdera/java/branches/server_refactor_all/server/src/test/java/org/apache/abdera/protocol/server/test/custom/SimpleAdapter.java

Modified: incubator/abdera/java/branches/server_refactor_all/.classpath
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor_all/.classpath?rev=615396&r1=615395&r2=615396&view=diff
==============================================================================
--- incubator/abdera/java/branches/server_refactor_all/.classpath (original)
+++ incubator/abdera/java/branches/server_refactor_all/.classpath Fri Jan 25 15:27:43 2008
@@ -1,98 +1,99 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="spring/src/test/java"/>
+	<classpathentry kind="src" path="dependencies/i18n/src/main/resources"/>
+	<classpathentry kind="src" path="dependencies/i18n/src/main/java"/>
+	<classpathentry kind="src" path="core/src/main/java"/>
+	<classpathentry kind="src" path="core/src/main/resources"/>
+	<classpathentry kind="src" path="core/src/test/java"/>
+	<classpathentry kind="src" path="core/src/test/resources"/>
+	<classpathentry kind="src" path="parser/src/main/java"/>
 	<classpathentry kind="src" path="parser/src/main/resources"/>
+	<classpathentry kind="src" path="parser/src/test/java"/>
+	<classpathentry kind="src" path="parser/src/test/resources"/>
+	<classpathentry kind="src" path="client/src/main/java"/>
+	<classpathentry kind="src" path="client/src/test/java"/>
+	<classpathentry kind="src" path="protocol/src/main/resources"/>
+	<classpathentry kind="src" path="protocol/src/main/java"/>
+	<classpathentry kind="src" path="dependencies/i18n/src/test/java"/>
+	<classpathentry kind="src" path="server/src/main/java"/>
+	<classpathentry kind="src" path="server/src/test/java"/>
+	<classpathentry kind="src" path="server/src/test/resources"/>
+	<classpathentry kind="src" path="security/src/main/java"/>
+	<classpathentry kind="src" path="security/src/test/java"/>
+	<classpathentry kind="src" path="security/src/test/resources"/>
+	<classpathentry kind="src" path="extensions/main/src/main/resources"/>
 	<classpathentry kind="src" path="extensions/geo/src/test/java"/>
 	<classpathentry kind="src" path="extensions/gdata/src/test/java"/>
-	<classpathentry kind="src" path="core/src/main/resources"/>
 	<classpathentry kind="src" path="extensions/opensearch/src/main/java"/>
+	<classpathentry kind="src" path="extensions/opensearch/src/test/java"/>
 	<classpathentry kind="src" path="extensions/opensearch/src/test/resources"/>
-	<classpathentry kind="src" path="jcr/src/test/resources"/>
-	<classpathentry kind="src" path="jcr/src/main/java"/>
 	<classpathentry kind="src" path="extensions/wsse/src/main/resources"/>
 	<classpathentry kind="src" path="extensions/sharing/src/test/java"/>
-	<classpathentry kind="src" path="examples/src/main/java"/>
-	<classpathentry kind="src" path="server/src/test/java"/>
-	<classpathentry kind="src" path="dependencies/i18n/src/test/java"/>
 	<classpathentry kind="src" path="extensions/json/src/main/java"/>
 	<classpathentry kind="src" path="extensions/json/src/test/resources"/>
-	<classpathentry kind="src" path="extensions/main/src/main/resources"/>
 	<classpathentry kind="src" path="extensions/oauth/src/test/java"/>
-	<classpathentry kind="src" path="parser/src/test/resources"/>
-	<classpathentry kind="src" path="parser/src/main/java"/>
 	<classpathentry kind="src" path="extensions/converters/src/main/java"/>
-	<classpathentry kind="src" path="core/src/main/java"/>
-	<classpathentry kind="src" path="core/src/test/resources"/>
+	<classpathentry kind="src" path="extensions/converters/src/test/java"/>
 	<classpathentry kind="src" path="extensions/media/src/main/resources"/>
-	<classpathentry kind="src" path="extensions/opensearch/src/test/java"/>
-	<classpathentry kind="src" path="jcr/src/test/java"/>
+	<classpathentry kind="src" path="extensions/media/src/main/java"/>
+	<classpathentry kind="src" path="extensions/media/src/test/resources"/>
 	<classpathentry kind="src" path="extensions/wsse/src/main/java"/>
 	<classpathentry kind="src" path="extensions/json/src/test/java"/>
 	<classpathentry kind="src" path="extensions/main/src/main/java"/>
 	<classpathentry kind="src" path="extensions/main/src/test/resources"/>
-	<classpathentry kind="src" path="security/src/test/resources"/>
-	<classpathentry kind="src" path="security/src/main/java"/>
-	<classpathentry kind="src" path="parser/src/test/java"/>
-	<classpathentry kind="src" path="extensions/converters/src/test/java"/>
-	<classpathentry kind="src" path="core/src/test/java"/>
-	<classpathentry kind="src" path="extensions/media/src/main/java"/>
-	<classpathentry kind="src" path="extensions/media/src/test/resources"/>
-	<classpathentry kind="src" path="client/src/main/java"/>
-	<classpathentry kind="src" path="contrib/rss/src/main/resources"/>
 	<classpathentry kind="src" path="extensions/html/src/main/resources"/>
 	<classpathentry kind="src" path="extensions/main/src/test/java"/>
-	<classpathentry kind="src" path="security/src/test/java"/>
-	<classpathentry kind="src" path="extensions/media/src/test/java"/>
-	<classpathentry kind="src" path="spring/src/main/resources"/>
 	<classpathentry kind="src" path="extensions/geo/src/main/resources"/>
 	<classpathentry kind="src" path="extensions/gdata/src/main/resources"/>
-	<classpathentry kind="src" path="client/src/test/java"/>
-	<classpathentry kind="src" path="protocol/src/main/resources"/>
 	<classpathentry kind="src" path="extensions/sharing/src/main/resources"/>
-	<classpathentry kind="src" path="contrib/rss/src/main/java"/>
-	<classpathentry kind="src" path="contrib/rss/src/test/resources"/>
 	<classpathentry kind="src" path="extensions/html/src/main/java"/>
 	<classpathentry kind="src" path="extensions/html/src/test/resources"/>
-	<classpathentry kind="src" path="dependencies/i18n/src/main/resources"/>
-	<classpathentry kind="src" path="extensions/oauth/src/main/resources"/>
-	<classpathentry kind="src" path="spring/src/test/resources"/>
-	<classpathentry kind="src" path="spring/src/main/java"/>
 	<classpathentry kind="src" path="extensions/geo/src/test/resources"/>
 	<classpathentry kind="src" path="extensions/geo/src/main/java"/>
 	<classpathentry kind="src" path="extensions/gdata/src/test/resources"/>
 	<classpathentry kind="src" path="extensions/gdata/src/main/java"/>
 	<classpathentry kind="src" path="extensions/opensearch/src/main/resources"/>
-	<classpathentry kind="src" path="protocol/src/main/java"/>
-	<classpathentry kind="src" path="jcr/src/main/resources"/>
+	<classpathentry kind="src" path="extensions/json/src/main/resources"/>
+	<classpathentry kind="src" path="extensions/oauth/src/main/java"/>
+	<classpathentry kind="src" path="extensions/oauth/src/test/resources"/>
+	<classpathentry kind="src" path="extensions/media/src/test/java"/>
+	<classpathentry kind="src" path="extensions/oauth/src/main/resources"/>
 	<classpathentry kind="src" path="extensions/sharing/src/test/resources"/>
 	<classpathentry kind="src" path="extensions/sharing/src/main/java"/>
+	<classpathentry kind="src" path="extensions/html/src/test/java"/>
+	<classpathentry kind="src" path="examples/src/main/java"/>
 	<classpathentry kind="src" path="examples/src/main/resources"/>
+	<classpathentry kind="src" path="jcr/src/main/java"/>
+	<classpathentry kind="src" path="jcr/src/main/resources"/>
+	<classpathentry kind="src" path="jcr/src/test/java"/>
+	<classpathentry kind="src" path="jcr/src/test/resources"/>
+	<classpathentry kind="src" path="spring/src/main/java"/>
+	<classpathentry kind="src" path="spring/src/main/resources"/>
+	<classpathentry kind="src" path="spring/src/test/java"/>
+	<classpathentry kind="src" path="spring/src/test/resources"/>
+	<classpathentry kind="src" path="contrib/rss/src/main/java"/>
+	<classpathentry kind="src" path="contrib/rss/src/main/resources"/>
 	<classpathentry kind="src" path="contrib/rss/src/test/java"/>
-	<classpathentry kind="src" path="extensions/html/src/test/java"/>
-	<classpathentry kind="src" path="server/src/test/resources"/>
-	<classpathentry kind="src" path="server/src/main/java"/>
-	<classpathentry kind="src" path="dependencies/i18n/src/main/java"/>
-	<classpathentry kind="src" path="extensions/json/src/main/resources"/>
-	<classpathentry kind="src" path="extensions/oauth/src/main/java"/>
-	<classpathentry kind="src" path="extensions/oauth/src/test/resources"/>
+	<classpathentry kind="src" path="contrib/rss/src/test/resources"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="lib" path="dependencies/axiom-api-1.2.5.jar"/>
-	<classpathentry kind="lib" path="dependencies/axiom-impl-1.2.5.jar"/>
-	<classpathentry kind="lib" path="dependencies/bcprov-jdk15-137.jar"/>
-	<classpathentry kind="lib" path="dependencies/commons-codec-1.3.jar"/>
-	<classpathentry kind="lib" path="dependencies/commons-httpclient-3.1.jar"/>
-	<classpathentry kind="lib" path="dependencies/commons-logging-1.0.4.jar"/>
-	<classpathentry kind="lib" path="dependencies/geronimo-activation_1.0.2_spec-1.1.jar"/>
-	<classpathentry kind="lib" path="dependencies/geronimo-servlet_2.4_spec-1.0.jar"/>
-	<classpathentry kind="lib" path="dependencies/htmlparser-1.0.5.jar"/>
-	<classpathentry kind="lib" path="dependencies/jaxen-1.1.1.jar"/>
-	<classpathentry kind="lib" path="dependencies/jetty-6.1.3.jar"/>
-	<classpathentry kind="lib" path="dependencies/jetty-util-6.1.3.jar"/>
-	<classpathentry kind="lib" path="dependencies/junit-4.3.jar"/>
-	<classpathentry kind="lib" path="dependencies/log4j-1.2.14.jar"/>
-	<classpathentry kind="lib" path="dependencies/serializer.jar"/>
-	<classpathentry kind="lib" path="dependencies/stax-api-1.0.1.jar"/>
-	<classpathentry kind="lib" path="dependencies/wstx-asl-3.2.1.jar"/>
-	<classpathentry kind="lib" path="dependencies/xmlsec-1.4.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/axiom-api-1.2.5.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/axiom-impl-1.2.5.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/bcprov-jdk15-137.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/commons-codec-1.3.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/commons-httpclient-3.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/commons-logging-1.0.4.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/geronimo-activation_1.0.2_spec-1.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/geronimo-servlet_2.4_spec-1.0.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/htmlparser-1.0.5.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/jaxen-1.1.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/jetty-6.1.3.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/jetty-util-6.1.3.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/junit-4.3.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/log4j-1.2.14.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/serializer.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/stax-api-1.0.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/wstx-asl-3.2.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="dependencies/xmlsec-1.4.1.jar"/>
+	<classpathentry exported="true" kind="con" path="org.eclipse.jdt.USER_LIBRARY/spring"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>

Added: incubator/abdera/java/branches/server_refactor_all/dependencies/i18n/src/main/java/org/apache/abdera/i18n/templates/DelegatingContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor_all/dependencies/i18n/src/main/java/org/apache/abdera/i18n/templates/DelegatingContext.java?rev=615396&view=auto
==============================================================================
--- incubator/abdera/java/branches/server_refactor_all/dependencies/i18n/src/main/java/org/apache/abdera/i18n/templates/DelegatingContext.java
(added)
+++ incubator/abdera/java/branches/server_refactor_all/dependencies/i18n/src/main/java/org/apache/abdera/i18n/templates/DelegatingContext.java
Fri Jan 25 15:27:43 2008
@@ -0,0 +1,23 @@
+package org.apache.abdera.i18n.templates;
+
+import java.util.Iterator;
+
+@SuppressWarnings("unchecked")
+public abstract class DelegatingContext 
+  extends CachingContext {
+
+  protected final Context subcontext;
+  
+  protected DelegatingContext(Context subcontext) {
+    this.subcontext = subcontext;
+  }
+  
+  protected <T> T resolveActual(String var) {
+    return (T)this.subcontext.resolve(var);
+  }
+
+  public Iterator<String> iterator() {
+    return this.subcontext.iterator();
+  }
+
+}

Modified: incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/Provider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/Provider.java?rev=615396&r1=615395&r2=615396&view=diff
==============================================================================
--- incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/Provider.java
(original)
+++ incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/Provider.java
Fri Jan 25 15:27:43 2008
@@ -38,6 +38,8 @@
   
   Target resolveTarget(RequestContext request);
   
+  String resolveIri(RequestContext request, Object key, Object param);
+ 
   ResponseContext process(RequestContext request);
   
   Filter[] getFilters(RequestContext request);

Modified: incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/RequestContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/RequestContext.java?rev=615396&r1=615395&r2=615396&view=diff
==============================================================================
--- incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/RequestContext.java
(original)
+++ incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/RequestContext.java
Fri Jan 25 15:27:43 2008
@@ -105,4 +105,15 @@
    * (everything after the context path)
    */
   String getTargetPath();
+  
+  /**
+   * Returns the subset of the request URI that is the base of the target path
+   * (e.g. HttpServletRequest.getServletPath())
+   * @return
+   */
+  String getTargetBasePath();
+  
+  String resolveIri(Object key, Object param);
+  
+  String resolveAbsoluteIri(Object key, Object param);
 }

Added: incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/TargetBuilder.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/TargetBuilder.java?rev=615396&view=auto
==============================================================================
--- incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/TargetBuilder.java
(added)
+++ incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/TargetBuilder.java
Fri Jan 25 15:27:43 2008
@@ -0,0 +1,14 @@
+package org.apache.abdera.protocol.server;
+
+
+/**
+ * The TargetBuilder component is responsible for constructing appropriate 
+ * IRIs/URIs for various kinds of targets based on specified input parameters.
+ * The input params are specific to the Target Manager implementation.
+ *
+ */
+public interface TargetBuilder {
+
+  String resolveIri(RequestContext context, Object key, Object param);
+  
+}

Modified: incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/context/AbstractRequestContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/context/AbstractRequestContext.java?rev=615396&r1=615395&r2=615396&view=diff
==============================================================================
--- incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/context/AbstractRequestContext.java
(original)
+++ incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/context/AbstractRequestContext.java
Fri Jan 25 15:27:43 2008
@@ -156,4 +156,17 @@
   public RequestContext setAttribute(String name, Object value) {
     return setAttribute(Scope.REQUEST, name, value);
   }
+
+  public String resolveIri(
+    Object key, 
+    Object param) {
+      return provider.resolveIri(this, key, param);
+  }
+ 
+  public String resolveAbsoluteIri(
+    Object key,
+    Object param) {
+      return getResolvedUri().resolve(
+        resolveIri(key,param)).toString();
+    }
 }

Modified: incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/context/RequestContextWrapper.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/context/RequestContextWrapper.java?rev=615396&r1=615395&r2=615396&view=diff
==============================================================================
--- incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/context/RequestContextWrapper.java
(original)
+++ incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/context/RequestContextWrapper.java
Fri Jan 25 15:27:43 2008
@@ -274,5 +274,20 @@
   public boolean isNoTransform() {
     return request.isNoTransform();
   }
+
+  public String resolveIri(Object key, Object param) {
+    return getProvider().resolveIri(this, key, param);
+  }
+
+  public String getTargetBasePath() {
+    return request.getTargetBasePath();
+  }
+
+  public String resolveAbsoluteIri(
+    Object key,
+    Object param) {
+      return request.getResolvedUri().resolve(
+        resolveIri(key,param)).toString();
+  }
   
 }

Modified: incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java?rev=615396&r1=615395&r2=615396&view=diff
==============================================================================
--- incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java
(original)
+++ incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java
Fri Jan 25 15:27:43 2008
@@ -38,6 +38,7 @@
 import org.apache.abdera.protocol.server.RequestContext;
 import org.apache.abdera.protocol.server.ResponseContext;
 import org.apache.abdera.protocol.server.Target;
+import org.apache.abdera.protocol.server.TargetBuilder;
 import org.apache.abdera.protocol.server.TargetType;
 import org.apache.abdera.protocol.server.Transactional;
 import org.apache.abdera.protocol.server.WorkspaceInfo;
@@ -85,10 +86,20 @@
       targetResolver.resolve(request) : null;
   }
 
+  public String resolveIri(
+    RequestContext request, 
+    Object key, 
+    Object param) {
+      TargetBuilder tm = getTargetBuilder(request);
+      return tm != null ? tm.resolveIri(request, key, param) : null;
+  }
+  
   protected Resolver<Subject> getSubjectResolver(RequestContext request) {
     return new SimpleSubjectResolver();
   }
-    
+
+  protected abstract TargetBuilder getTargetBuilder(RequestContext request);
+  
   protected abstract Resolver<Target> getTargetResolver(RequestContext request);
 
   public ResponseContext process(

Modified: incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractWorkspaceProvider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractWorkspaceProvider.java?rev=615396&r1=615395&r2=615396&view=diff
==============================================================================
--- incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractWorkspaceProvider.java
(original)
+++ incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractWorkspaceProvider.java
Fri Jan 25 15:27:43 2008
@@ -6,6 +6,7 @@
 import org.apache.abdera.protocol.Resolver;
 import org.apache.abdera.protocol.server.RequestContext;
 import org.apache.abdera.protocol.server.Target;
+import org.apache.abdera.protocol.server.TargetBuilder;
 import org.apache.abdera.protocol.server.WorkspaceInfo;
 import org.apache.abdera.protocol.server.WorkspaceManager;
 
@@ -14,6 +15,7 @@
   implements WorkspaceManager {
   
   protected Resolver<Target> targetResolver;
+  protected TargetBuilder targetBuilder;
   protected Collection<WorkspaceInfo> workspaces;
 
   protected WorkspaceManager getWorkspaceManager(
@@ -24,6 +26,15 @@
   protected Resolver<Target> getTargetResolver(
     RequestContext request) {
       return targetResolver;
+  }
+  
+  protected TargetBuilder getTargetBuilder(
+    RequestContext request) {
+      return targetBuilder;
+  }
+
+  protected void setTargetBuilder(TargetBuilder targetBuilder) {
+    this.targetBuilder = targetBuilder;
   }
   
   protected void setTargetResolver(Resolver<Target> targetResolver) {

Modified: incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultProvider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultProvider.java?rev=615396&r1=615395&r2=615396&view=diff
==============================================================================
--- incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultProvider.java
(original)
+++ incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultProvider.java
Fri Jan 25 15:27:43 2008
@@ -24,6 +24,7 @@
 import org.apache.abdera.protocol.Resolver;
 import org.apache.abdera.protocol.server.RequestContext;
 import org.apache.abdera.protocol.server.Target;
+import org.apache.abdera.protocol.server.TargetBuilder;
 import org.apache.abdera.protocol.server.WorkspaceInfo;
 import org.apache.abdera.protocol.server.WorkspaceManager;
 
@@ -87,5 +88,9 @@
     for (WorkspaceInfo w : workspaces) {
       ((DefaultWorkspaceManager)getWorkspaceManager()).addWorkspace(w);
     }
+  }
+
+  protected TargetBuilder getTargetBuilder(RequestContext request) {
+    return (TargetBuilder)targetResolver;
   }
 }

Modified: incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/StructuredTargetResolver.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/StructuredTargetResolver.java?rev=615396&r1=615395&r2=615396&view=diff
==============================================================================
--- incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/StructuredTargetResolver.java
(original)
+++ incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/StructuredTargetResolver.java
Fri Jan 25 15:27:43 2008
@@ -17,9 +17,13 @@
 */
 package org.apache.abdera.protocol.server.impl;
 
+import java.util.Iterator;
+import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.apache.abdera.i18n.templates.Context;
+import org.apache.abdera.i18n.templates.DelegatingContext;
 import org.apache.abdera.i18n.text.UrlEncoding;
 import org.apache.abdera.protocol.Request;
 import org.apache.abdera.protocol.Resolver;
@@ -35,7 +39,9 @@
 /**
  * Resolves targets based on a simple assumed URI structure. 
  */
-public class StructuredTargetResolver implements Resolver<Target> {
+public class StructuredTargetResolver
+  extends TemplateTargetBuilder
+  implements Resolver<Target> {
 
   public static final String COLLECTION_PROVIDER_ATTRIBUTE = "collectionProvider";
   public static final String URI_PARAMETER_ATTRIBUTE_PREFIX = "uriParameter";
@@ -46,6 +52,10 @@
   
   public StructuredTargetResolver(WorkspaceManager workspaceManager) {
     this.workspaceManager = workspaceManager;
+    setTemplate(TargetType.TYPE_SERVICE, "{target_base}");
+    setTemplate(TargetType.TYPE_COLLECTION, "{target_base}/{collection}");
+    setTemplate(TargetType.TYPE_CATEGORIES, "{target_base}/{collection};categories");
+    setTemplate(TargetType.TYPE_ENTRY, "{target_base}/{collection}/{entryid}");
   }
 
   public StructuredTargetResolver(WorkspaceManager workspaceManager, String servicesPattern)
{
@@ -128,5 +138,49 @@
     } else {
       return TargetType.TYPE_ENTRY;
     }
+  }
+
+  public String resolveIri(
+    RequestContext request, 
+    Object key, 
+    Object param) {
+      CollectionInfo ci = 
+        (CollectionInfo) request.getAttribute(
+          Scope.REQUEST, 
+          COLLECTION_PROVIDER_ATTRIBUTE);
+      String collection = ci != null ? ci.getHref(request) : null;
+      Context context = 
+        new StructuredContext(
+          TemplateTargetBuilder.getContext(request, param), 
+          collection);
+      return super.resolveIri(request, key, context);
+  }
+  
+  @SuppressWarnings("unchecked")
+  private static class StructuredContext 
+    extends DelegatingContext {
+
+    private static final long serialVersionUID = 1L;
+    private final String collection;
+    
+    protected StructuredContext(
+      Context subcontext,
+      String collection) {
+        super(subcontext);
+        this.collection = collection;
+    }
+
+    public Iterator<String> iterator() {
+      List<String> list = TemplateTargetBuilder.asList(super.iterator());
+      if (!list.contains("collection")) list.add("collection");
+      return list.iterator();
+    }
+
+    protected <T> T resolveActual(String var) {
+      if (var.equalsIgnoreCase("collection")) 
+        return (T)collection;
+      return (T)super.resolveActual(var);
+    }
+
   }
 }

Added: incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/TemplateTargetBuilder.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/TemplateTargetBuilder.java?rev=615396&view=auto
==============================================================================
--- incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/TemplateTargetBuilder.java
(added)
+++ incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/impl/TemplateTargetBuilder.java
Fri Jan 25 15:27:43 2008
@@ -0,0 +1,220 @@
+package org.apache.abdera.protocol.server.impl;
+
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import org.apache.abdera.i18n.templates.Context;
+import org.apache.abdera.i18n.templates.DelegatingContext;
+import org.apache.abdera.i18n.templates.HashMapContext;
+import org.apache.abdera.i18n.templates.ObjectContext;
+import org.apache.abdera.i18n.templates.Template;
+import org.apache.abdera.protocol.server.RequestContext;
+import org.apache.abdera.protocol.server.Target;
+import org.apache.abdera.protocol.server.TargetBuilder;
+import org.apache.abdera.protocol.server.TargetType;
+import org.apache.abdera.protocol.server.RequestContext.Scope;
+
+@SuppressWarnings("unchecked") 
+public class TemplateTargetBuilder 
+  implements TargetBuilder {
+
+  protected final Map<Object,Template> templates 
+    = new HashMap<Object,Template>();
+  
+  public TemplateTargetBuilder() {}
+  
+  public TemplateTargetBuilder(Map<TargetType,Template> templates) {
+    this.templates.putAll(templates);
+  }
+  
+  public TemplateTargetBuilder setTemplate(Object key, String template) {
+    return setTemplate(key, new Template(template));
+  }
+  
+  public TemplateTargetBuilder setTemplate(Object key, Template template) {
+    templates.put(key,template);
+    return this;
+  }
+
+  public static Context getContext(RequestContext request, Object param) {
+    Context context = null;
+    if (param != null) {
+      if (param instanceof Map) {
+        context = new HashMapContext((Map<String,Object>)param, true);
+      } else if (param instanceof Context) {
+        context = (Context)param;
+      } else {
+        context = new ObjectContext(param,true);
+      }
+    }
+    return new TemplateContext(request, context);
+  }
+  
+  public static <T>List<T> asList(Iterator<T> i) {
+    List<T> list = new ArrayList<T>();
+    while(i.hasNext()) 
+      list.add(i.next());
+    return list;
+  }
+  
+  public String resolveIri(
+    RequestContext request, 
+    Object key, 
+    Object param) {
+      Template template = templates.get(key);
+      return template != null ? template.expand(getContext(request,param)) : null;
+  }
+
+  public static class TemplateContext 
+    extends DelegatingContext {
+
+    private static final long serialVersionUID = 4332356546022014897L;
+    
+    private final RequestContext request;
+    
+    public TemplateContext(
+      RequestContext request,
+      Context subcontext) {
+        super(subcontext);
+        this.request = request;
+    }
+
+    protected <T> T resolveActual(
+      String var) {
+        Variable variable = Variable.get(var);
+        if (variable == null) 
+          return (T)subcontext.resolve(var);
+        switch(variable) {
+          case REQUEST_URI:
+            return (T) request.getUri().toString();
+          case REQUEST_RESOLVED_URI:
+            return (T) request.getResolvedUri().toString();
+          case REQUEST_CONTENT_TYPE:
+            return (T) request.getContentType().toString();
+          case REQUEST_CONTEXT_PATH:
+            return (T) request.getContextPath();
+          case REQUEST_PARAMETER:
+            String name = Variable.REQUEST_PARAMETER.label(var);
+            return (T) request.getParameter(name);
+          case REQUEST_LANGUAGE:
+            return (T) request.getAcceptLanguage();
+          case REQUEST_CHARSET:
+            return (T) request.getAcceptCharset();
+          case REQUEST_USER: 
+            Principal p = request.getPrincipal();
+            return p != null ? (T)p.getName() : null;
+          case REQUEST_ATTRIBUTE_SESSION:
+            name = Variable.REQUEST_ATTRIBUTE_SESSION.label(var);
+            return (T) request.getAttribute(Scope.SESSION, name);
+          case REQUEST_ATTRIBUTE_REQUEST: 
+            name = Variable.REQUEST_ATTRIBUTE_REQUEST.label(var);
+            return (T) request.getAttribute(Scope.REQUEST, name);
+          case REQUEST_HEADER:
+            name = Variable.REQUEST_HEADER.label(var);
+            return (T) request.getHeader(name);
+          case TARGET_PARAMETER:
+            name = Variable.TARGET_PARAMETER.label(var);
+            return (T) request.getTarget().getParameter(name);
+          case TARGET_IDENTITY:
+            return (T) request.getTarget().getIdentity();
+          case TARGET_PATH:
+            return (T) request.getTargetPath();
+          case TARGET_BASE:
+            return (T) request.getTargetBasePath();
+          default: 
+            return (T)subcontext.resolve(var);
+        }
+    }
+
+    public Iterator<String> iterator() {
+      List<String> vars = new ArrayList<String>();
+      for (String var : subcontext)
+        vars.add(var);      
+      for (String var : request.getParameterNames()) 
+        vars.add(toVar(Variable.REQUEST_PARAMETER,var));      
+      for (String var : request.getAttributeNames(Scope.SESSION))
+        vars.add(toVar(Variable.REQUEST_ATTRIBUTE_SESSION,var));      
+      for (String var : request.getAttributeNames(Scope.REQUEST))
+        vars.add(toVar(Variable.REQUEST_ATTRIBUTE_REQUEST,var));      
+      for (String var : request.getHeaderNames()) 
+        vars.add(toVar(Variable.REQUEST_HEADER, var));        
+      Target target = request.getTarget();
+      for (String var : target.getParameterNames())
+        vars.add(toVar(Variable.TARGET_PARAMETER, var));      
+      vars.add(Variable.REQUEST_CONTEXT_PATH.name().toLowerCase());
+      vars.add(Variable.REQUEST_CONTENT_TYPE.name().toLowerCase());
+      vars.add(Variable.REQUEST_URI.name().toLowerCase());
+      vars.add(Variable.REQUEST_RESOLVED_URI.name().toLowerCase());
+      vars.add(Variable.REQUEST_LANGUAGE.name().toLowerCase());
+      vars.add(Variable.REQUEST_CHARSET.name().toLowerCase());
+      vars.add(Variable.REQUEST_USER.name().toLowerCase());
+      vars.add(Variable.TARGET_IDENTITY.name().toLowerCase());
+      vars.add(Variable.TARGET_PATH.name().toLowerCase());
+      vars.add(Variable.TARGET_BASE.name().toLowerCase());
+      return vars.iterator();
+    }
+  }
+  
+  private static String toVar(Variable variable, String label) {
+    return variable.name().toLowerCase() + "_" + label;
+  }
+  
+  public static enum Variable {
+    REQUEST_CONTEXT_PATH,
+    REQUEST_CONTENT_TYPE,
+    REQUEST_URI,
+    REQUEST_RESOLVED_URI,
+    REQUEST_PARAMETER,
+    REQUEST_LANGUAGE,
+    REQUEST_CHARSET,
+    REQUEST_USER,
+    REQUEST_ATTRIBUTE_SESSION,
+    REQUEST_ATTRIBUTE_REQUEST,
+    REQUEST_HEADER,
+    TARGET_PARAMETER,
+    TARGET_IDENTITY,
+    TARGET_PATH,
+    TARGET_BASE,
+    ;
+    
+    static Variable get(String var) {
+      if (REQUEST_PARAMETER.match(var)) {
+        return REQUEST_PARAMETER;
+      } else if (REQUEST_ATTRIBUTE_SESSION.match(var)) {
+        return REQUEST_ATTRIBUTE_SESSION;
+      } else if (REQUEST_ATTRIBUTE_REQUEST.match(var)) {
+        return REQUEST_ATTRIBUTE_REQUEST;
+      } else if (REQUEST_HEADER.match(var)) {
+        return REQUEST_HEADER;
+      } else if (TARGET_PARAMETER.match(var)) {
+        return TARGET_PARAMETER;
+      } else {
+        try {
+          return Variable.valueOf(var.toUpperCase());
+        } catch (Exception e) {
+          return null;
+        }
+      }
+    }
+    
+    private final Pattern p; 
+      
+    Variable() {
+      p = Pattern.compile("\\Q" + name() + "_\\E.*", Pattern.CASE_INSENSITIVE);
+    }
+    
+    boolean match(String var) {
+      return p.matcher(var).matches();
+    }
+    
+    String label(String var) {
+      return var.substring(name().length() + 1);
+    }
+  }
+  
+}

Modified: incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/provider/basic/BasicProvider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/provider/basic/BasicProvider.java?rev=615396&r1=615395&r2=615396&view=diff
==============================================================================
--- incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/provider/basic/BasicProvider.java
(original)
+++ incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/provider/basic/BasicProvider.java
Fri Jan 25 15:27:43 2008
@@ -24,6 +24,7 @@
 import org.apache.abdera.protocol.server.impl.AbstractWorkspaceProvider;
 import org.apache.abdera.protocol.server.impl.CollectionAdapterManager;
 import org.apache.abdera.protocol.server.impl.RegexTargetResolver;
+import org.apache.abdera.protocol.server.impl.TemplateTargetBuilder;
 
 public class BasicProvider 
   extends AbstractWorkspaceProvider {
@@ -37,6 +38,12 @@
         .setPattern("/", TargetType.TYPE_SERVICE)
         .setPattern("/" + "([^/#?]+)", TargetType.TYPE_COLLECTION, PARAM_FEED)
         .setPattern("/" + "([^/#?]+)/([^/#?]+)", TargetType.TYPE_ENTRY, PARAM_FEED, PARAM_ENTRY)
+    );
+    setTargetBuilder(
+      new TemplateTargetBuilder()
+        .setTemplate(TargetType.TYPE_SERVICE, "{target_base}/")
+        .setTemplate(TargetType.TYPE_COLLECTION, "{target_base}/{" + PARAM_FEED + "}")
+        .setTemplate(TargetType.TYPE_ENTRY, "{target_base}/{" + PARAM_FEED + "}/{" + PARAM_ENTRY
+ "}")
     );
     addWorkspace(new BasicWorkspace(this));
   }

Modified: incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/servlet/ServletRequestContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/servlet/ServletRequestContext.java?rev=615396&r1=615395&r2=615396&view=diff
==============================================================================
--- incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/servlet/ServletRequestContext.java
(original)
+++ incubator/abdera/java/branches/server_refactor_all/server/src/main/java/org/apache/abdera/protocol/server/servlet/ServletRequestContext.java
Fri Jan 25 15:27:43 2008
@@ -243,4 +243,8 @@
     List<Locale> locales = Collections.list(request.getLocales());
     return locales.toArray(new Locale[locales.size()]);
   }
+
+  public String getTargetBasePath() {
+    return request.getContextPath() + request.getServletPath();
+  }
 }

Modified: incubator/abdera/java/branches/server_refactor_all/server/src/test/java/org/apache/abdera/protocol/server/test/custom/CustomProvider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor_all/server/src/test/java/org/apache/abdera/protocol/server/test/custom/CustomProvider.java?rev=615396&r1=615395&r2=615396&view=diff
==============================================================================
--- incubator/abdera/java/branches/server_refactor_all/server/src/test/java/org/apache/abdera/protocol/server/test/custom/CustomProvider.java
(original)
+++ incubator/abdera/java/branches/server_refactor_all/server/src/test/java/org/apache/abdera/protocol/server/test/custom/CustomProvider.java
Fri Jan 25 15:27:43 2008
@@ -28,6 +28,7 @@
 import org.apache.abdera.protocol.server.impl.RegexTargetResolver;
 import org.apache.abdera.protocol.server.impl.SimpleCollectionInfo;
 import org.apache.abdera.protocol.server.impl.SimpleWorkspaceInfo;
+import org.apache.abdera.protocol.server.impl.TemplateTargetBuilder;
 
 public class CustomProvider 
   extends AbstractWorkspaceProvider {
@@ -38,7 +39,7 @@
     
     this.adapter = new SimpleAdapter();
     
-    super.setTargetResolver(      
+    setTargetResolver(      
       new RegexTargetResolver()
         .setPattern("/atom(\\?[^#]*)?", TargetType.TYPE_SERVICE)
         .setPattern("/atom/([^/#?]+);categories", TargetType.TYPE_CATEGORIES, "collection")
@@ -47,11 +48,19 @@
         .setPattern("/search", OpenSearchFilter.TYPE_OPENSEARCH_DESCRIPTION)
     );
     
+    setTargetBuilder(
+      new TemplateTargetBuilder()
+        .setTemplate(TargetType.TYPE_SERVICE, "{target_base}/atom")
+        .setTemplate(TargetType.TYPE_COLLECTION, "{target_base}/atom/{collection}{-opt|?|q,c,s,p,l,i,o}{-join|&|q,c,s,p,l,i,o}")
+        .setTemplate(TargetType.TYPE_CATEGORIES, "{target_base}/atom/{collection};categories")
+        .setTemplate(TargetType.TYPE_ENTRY, "{target_base}/atom/{collection}/{entry}")
+        .setTemplate(OpenSearchFilter.TYPE_OPENSEARCH_DESCRIPTION, "{target_base}/search")
+    );
+    
     SimpleWorkspaceInfo workspace = new SimpleWorkspaceInfo();
     workspace.setTitle("A Simple Workspace");
     workspace.addCollection(
       new SimpleCollectionInfo(
-        "feed",
         "A simple feed",
         "/atom/feed",
         "application/atom+xml;type=entry"

Modified: incubator/abdera/java/branches/server_refactor_all/server/src/test/java/org/apache/abdera/protocol/server/test/custom/SimpleAdapter.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor_all/server/src/test/java/org/apache/abdera/protocol/server/test/custom/SimpleAdapter.java?rev=615396&r1=615395&r2=615396&view=diff
==============================================================================
--- incubator/abdera/java/branches/server_refactor_all/server/src/test/java/org/apache/abdera/protocol/server/test/custom/SimpleAdapter.java
(original)
+++ incubator/abdera/java/branches/server_refactor_all/server/src/test/java/org/apache/abdera/protocol/server/test/custom/SimpleAdapter.java
Fri Jan 25 15:27:43 2008
@@ -19,6 +19,8 @@
 
 import java.io.IOException;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.apache.abdera.Abdera;
 import org.apache.abdera.i18n.text.UrlEncoding;
@@ -71,11 +73,19 @@
     Feed feed = (Feed)context.getAttribute(Scope.SESSION, "feed");
     if (feed == null) {
       feed = createFeedBase(context);
+      feed.setBaseUri(getFeedBaseUri(context));
       context.setAttribute(Scope.SESSION, "feed", feed);
     }
     return feed.getDocument();
   }
-
+ 
+  private String getFeedBaseUri(RequestContext context) {
+    Map<String,String> params = new HashMap<String,String>();
+    params.put("collection", context.getTarget().getParameter("collection"));
+    String uri = context.resolveIri(TargetType.TYPE_COLLECTION, params);
+    return context.getResolvedUri().resolve(uri).toString();
+  }
+  
   public ResponseContext getFeed(
     RequestContext request) {
       Document<Feed> feed;
@@ -136,6 +146,7 @@
           if (!ProviderHelper.isValidEntry(entry))
             return ProviderHelper.badrequest(request);
           setEntryDetails(
+            request,
             entry, 
             abdera.getFactory().newUuidUri());
           Feed feed = getFeedDocument(request).getRoot();
@@ -163,16 +174,24 @@
   }
   
   private void setEntryDetails(
+    RequestContext request,
     Entry entry, 
     String id) {
       entry.setUpdated(new Date());
       entry.setEdited(entry.getUpdated());
       entry.getIdElement().setValue(id);
       entry.addLink(
-        "/atom/feed/" + entry.getId().toASCIIString(), 
+        getEntryLink(request,entry.getId().toASCIIString()),
         "edit");
   }
   
+  private String getEntryLink(RequestContext request, String entryid) {
+    Map<String,String> params = new HashMap<String,String>();
+    params.put("collection", request.getTarget().getParameter("collection"));
+    params.put("entry", entryid);
+    return request.resolveIri(TargetType.TYPE_ENTRY, params);
+  }
+  
   public ResponseContext putEntry(
     RequestContext request) {
       Abdera abdera = request.getAbdera();
@@ -189,6 +208,7 @@
             if (!ProviderHelper.isValidEntry(entry))
               return ProviderHelper.badrequest(request);
             setEntryDetails(
+              request,
               entry, 
               orig_entry.getId().toString());
             orig_entry.discard();



Mime
View raw message