chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r787180 - in /incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src: main/java/org/apache/chemistry/atompub/server/ main/java/org/apache/chemistry/atompub/server/jaxrs/ main/java/org/apache/chemistry/atompub/server/servlet/ test/...
Date Mon, 22 Jun 2009 09:29:46 GMT
Author: fguillaume
Date: Mon Jun 22 09:29:45 2009
New Revision: 787180

URL: http://svn.apache.org/viewvc?rev=787180&view=rev
Log:
Fixed servlet/context path issues. Added content size header.

Added:
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/ServletRegexTargetResolver.java
  (with props)
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/SizedMediaResponseContext.java
  (with props)
Modified:
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISProvider.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISWorkspaceManager.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/jaxrs/AbderaResource.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/jaxrs/AbderaResponseProvider.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/servlet/CMISServlet.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/TestAtomPubAbderaServlet.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/TestAtomPubJaxrs.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/resources/jaxrs/web.xml

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java?rev=787180&r1=787179&r2=787180&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
Mon Jun 22 09:29:45 2009
@@ -25,6 +25,7 @@
 
 import org.apache.abdera.factory.Factory;
 import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.model.AtomDate;
 import org.apache.abdera.model.Content;
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Entry;
@@ -37,6 +38,7 @@
 import org.apache.abdera.protocol.server.context.AbstractResponseContext;
 import org.apache.abdera.protocol.server.context.BaseResponseContext;
 import org.apache.abdera.protocol.server.context.ResponseContextException;
+import org.apache.abdera.util.EntityTag;
 import org.apache.chemistry.BaseType;
 import org.apache.chemistry.ObjectEntry;
 import org.apache.chemistry.Property;
@@ -228,6 +230,11 @@
         return null;
     }
 
+    public long getContentSize(ObjectEntry object) {
+        Integer value = (Integer) object.getValue(Property.CONTENT_STREAM_LENGTH);
+        return value == null ? -1 : value.longValue();
+    }
+
     @Override
     public String getContentType(ObjectEntry object) {
         return (String) object.getValue(Property.CONTENT_STREAM_MIME_TYPE);
@@ -264,6 +271,19 @@
         }
     }
 
+    // override to use a custom SizedMediaResponseContext
+    @Override
+    protected ResponseContext buildGetMediaResponse(String id,
+            ObjectEntry entryObj) throws ResponseContextException {
+        Date updated = getUpdated(entryObj);
+        SizedMediaResponseContext ctx = new SizedMediaResponseContext(
+                getMediaStream(entryObj), updated, 200);
+        ctx.setSize(getContentSize(entryObj));
+        ctx.setContentType(getContentType(entryObj));
+        ctx.setEntityTag(EntityTag.generate(id, AtomDate.format(updated)));
+        return ctx;
+    }
+
     @Override
     public String getName(ObjectEntry object) {
         throw new UnsupportedOperationException(); // unused

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISProvider.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISProvider.java?rev=787180&r1=787179&r2=787180&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISProvider.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISProvider.java
Mon Jun 22 09:29:45 2009
@@ -50,7 +50,7 @@
         this.repository = repository;
 
         targetBuilder = new TemplateTargetBuilder();
-        targetResolver = new RegexTargetResolver();
+        targetResolver = new ServletRegexTargetResolver();
 
         // service
         targetBuilder.setTemplate(TargetType.TYPE_SERVICE,

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISWorkspaceManager.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISWorkspaceManager.java?rev=787180&r1=787179&r2=787180&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISWorkspaceManager.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISWorkspaceManager.java
Mon Jun 22 09:29:45 2009
@@ -35,7 +35,9 @@
 
     public CollectionAdapter getCollectionAdapter(RequestContext request) {
         Repository repository = provider.getRepository();
-        String path = request.getTargetPath();
+        String uri = request.getUri().toString();
+        String spath = request.getTargetBasePath();
+        String path = spath == null ? uri : uri.substring(spath.length());
         String paths = path + '/';
         if (paths.startsWith("/types/") || paths.startsWith("/types?")) {
             return new CMISTypesCollection(null, repository);

Added: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/ServletRegexTargetResolver.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/ServletRegexTargetResolver.java?rev=787180&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/ServletRegexTargetResolver.java
(added)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/ServletRegexTargetResolver.java
Mon Jun 22 09:29:45 2009
@@ -0,0 +1,54 @@
+/*
+ * Licensed 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.
+ *
+ * Authors:
+ *     Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry.atompub.server;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.abdera.protocol.Request;
+import org.apache.abdera.protocol.server.RequestContext;
+import org.apache.abdera.protocol.server.Target;
+import org.apache.abdera.protocol.server.TargetType;
+import org.apache.abdera.protocol.server.impl.RegexTargetResolver;
+
+/**
+ * Regex target resolver that doesn't need an explicit servlet path in the
+ * patterns.
+ * <p>
+ * It checks the patterns using only the part of the path *after* the servlet
+ * path.
+ */
+public class ServletRegexTargetResolver extends RegexTargetResolver {
+
+    @Override
+    public Target resolve(Request request) {
+        RequestContext context = (RequestContext) request;
+        String uri = context.getUri().toString();
+        String spath = context.getTargetBasePath();
+        String path = spath == null ? uri : uri.substring(spath.length());
+        for (Pattern pattern : patterns.keySet()) {
+            Matcher matcher = pattern.matcher(path);
+            if (matcher.matches()) {
+                TargetType type = this.patterns.get(pattern);
+                String[] fields = this.fields.get(pattern);
+                return getTarget(type, context, matcher, fields);
+            }
+        }
+        return null;
+    }
+
+}

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/ServletRegexTargetResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/ServletRegexTargetResolver.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/ServletRegexTargetResolver.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/SizedMediaResponseContext.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/SizedMediaResponseContext.java?rev=787180&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/SizedMediaResponseContext.java
(added)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/SizedMediaResponseContext.java
Mon Jun 22 09:29:45 2009
@@ -0,0 +1,43 @@
+/*
+ * Licensed 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.
+ *
+ * Authors:
+ *     Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry.atompub.server;
+
+import java.io.InputStream;
+import java.util.Date;
+
+import org.apache.abdera.protocol.server.context.MediaResponseContext;
+
+/**
+ * An Abdera {@link MediaResponseContext} that knows the size of the stream.
+ */
+public class SizedMediaResponseContext extends MediaResponseContext {
+
+    protected long size;
+
+    public SizedMediaResponseContext(InputStream in, Date lastmodified, int status) {
+        super(in, lastmodified, status);
+    }
+
+    public void setSize(long size) {
+        this.size = size;
+    }
+
+    public long getSize() {
+        return size;
+    }
+
+}

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/SizedMediaResponseContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/SizedMediaResponseContext.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/SizedMediaResponseContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/jaxrs/AbderaResource.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/jaxrs/AbderaResource.java?rev=787180&r1=787179&r2=787180&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/jaxrs/AbderaResource.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/jaxrs/AbderaResource.java
Mon Jun 22 09:29:45 2009
@@ -19,11 +19,14 @@
 import java.util.HashMap;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
 import javax.ws.rs.GET;
+import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
 
 import org.apache.abdera.protocol.server.CollectionAdapter;
 import org.apache.abdera.protocol.server.RequestContext;
@@ -39,6 +42,9 @@
 /**
  * A JAX-RS Resource that dispatches to the underlying Abdera
  * {@link CMISProvider}.
+ * <p>
+ * In some contexts (Nuxeo WebEngine), the path of this resource is injected by
+ * the framework, so no @Path annotation must be specified.
  */
 public class AbderaResource {
 
@@ -49,6 +55,9 @@
     @Context
     protected HttpServletRequest httpRequest;
 
+    @Context
+    protected UriInfo ui;
+
     // TODO inject repository somehow
     public static Repository repository;
 
@@ -63,8 +72,40 @@
         }
     }
 
-    protected ServletRequestContext getRequestContext() {
-        return new ServletRequestContext(provider, httpRequest);
+    /**
+     * Gets a {@link ServletRequestContext} wrapping the httpRequest but
+     * pretending that this Resource's path is part of the servlet path.
+     *
+     * @param segments the number of segments of the method invoking this, used
+     *            to determine the Resource path
+     */
+    protected ServletRequestContext getRequestContext(int segments) {
+        // actual servlet path
+        String spath = httpRequest.getServletPath();
+        // find this Resource path (remove some segments from it)
+        String rpath = ui.getPath();
+        while (segments > 0) {
+            segments--;
+            if (rpath.contains("/")) {
+                rpath = rpath.substring(0, rpath.lastIndexOf('/'));
+            }
+        }
+        HttpServletRequest wrapper;
+        if (rpath.length() == 0) {
+            // no resource path to fake
+            wrapper = httpRequest;
+        } else {
+            // this gives the pretend servlet path
+            final String pspath = spath + rpath;
+            // wrap HttpServletRequest to pretend to have this servlet path
+            wrapper = new HttpServletRequestWrapper(httpRequest) {
+                @Override
+                public String getServletPath() {
+                    return pspath;
+                }
+            };
+        }
+        return new ServletRequestContext(provider, wrapper);
     }
 
     protected CollectionAdapter getAbderaCollectionAdapter(
@@ -73,14 +114,14 @@
                 requestContext);
     }
 
-    protected Response getAbderaFeed() {
-        RequestContext requestContext = getRequestContext();
+    protected Response getAbderaFeed(int skipSegments) {
+        RequestContext requestContext = getRequestContext(skipSegments);
         CollectionAdapter adapter = getAbderaCollectionAdapter(requestContext);
         return Response.ok(adapter.getFeed(requestContext)).build();
     }
 
-    protected Response getAbderaEntry() {
-        RequestContext requestContext = getRequestContext();
+    protected Response getAbderaEntry(int skipSegments) {
+        RequestContext requestContext = getRequestContext(skipSegments);
         CollectionAdapter adapter = getAbderaCollectionAdapter(requestContext);
         return Response.ok(adapter.getEntry(requestContext)).build();
     }
@@ -89,7 +130,7 @@
     @Produces("application/atomsvc+xml")
     @Path("repository")
     public Response doGetRepository(@Context HttpServletRequest httpRequest) {
-        RequestContext requestContext = getRequestContext();
+        RequestContext requestContext = getRequestContext(1);
         ResponseContext responseContext = provider.getServiceDocument(requestContext);
         return Response.ok(responseContext).build();
     }
@@ -98,7 +139,7 @@
     @Produces("application/atom+xml;type=feed")
     @Path("types")
     public Response doGetTypes() {
-        return getAbderaFeed();
+        return getAbderaFeed(1);
     }
 
     @GET
@@ -106,7 +147,7 @@
     @Path("children/{objectid}")
     public Response doGetChildren() {
         // objectid decoded by Abdera getCollectionAdapter
-        return getAbderaFeed();
+        return getAbderaFeed(2);
     }
 
     @GET
@@ -114,25 +155,18 @@
     @Path("object/{objectid}")
     public Response doGetObject() {
         // objectid decoded by Abdera getCollectionAdapter
-        return getAbderaEntry();
+        return getAbderaEntry(2);
     }
 
     @GET
     @Path("file/{objectid}")
     public Response doGetFile() {
         // objectid decoded by Abdera getCollectionAdapter
-        RequestContext requestContext = getRequestContext();
+        RequestContext requestContext = getRequestContext(2);
         AbstractCollectionAdapter adapter = (AbstractCollectionAdapter) getAbderaCollectionAdapter(requestContext);
         ResponseContext responseContext = adapter.getMedia(requestContext);
         String contentType = responseContext.getHeader("Content-Type");
         return Response.ok(responseContext).type(contentType).build();
     }
 
-    // @PUT
-    // @Path("object/{objectid}}")
-    // @Consumes("application/atom+xml;type=entry")
-    // public Response doPut(@PathParam("objectid") String objectid) {
-    // return AbderaProvider.putEntry(ctx, getCollectionAdapter());
-    // }
-
 }

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/jaxrs/AbderaResponseProvider.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/jaxrs/AbderaResponseProvider.java?rev=787180&r1=787179&r2=787180&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/jaxrs/AbderaResponseProvider.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/jaxrs/AbderaResponseProvider.java
Mon Jun 22 09:29:45 2009
@@ -21,6 +21,7 @@
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 
+import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
@@ -28,16 +29,24 @@
 import javax.ws.rs.ext.Provider;
 
 import org.apache.abdera.protocol.server.ResponseContext;
+import org.apache.chemistry.atompub.server.SizedMediaResponseContext;
 
 /**
  * A JAX-RS MessageBodyWriter that knows how to write an Abdera ResponseContext.
  */
+// @Produces of text/plain is needed otherwise RESTEasy will use its
+// DefaultTextPlain writer to write text/plain objects and the ResponseContext
+// is not written correctly.
 @Provider
+@Produces( { "*/*", "text/plain" })
 public class AbderaResponseProvider implements
         MessageBodyWriter<ResponseContext> {
 
     public long getSize(ResponseContext responseContext, Class<?> type,
             Type genericType, Annotation[] annotations, MediaType mediaType) {
+        if (responseContext instanceof SizedMediaResponseContext) {
+            return ((SizedMediaResponseContext) responseContext).getSize();
+        }
         return -1;
     }
 

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/servlet/CMISServlet.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/servlet/CMISServlet.java?rev=787180&r1=787179&r2=787180&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/servlet/CMISServlet.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/servlet/CMISServlet.java
Mon Jun 22 09:29:45 2009
@@ -36,9 +36,6 @@
 
     private Repository repository;
 
-    public CMISServlet() {
-    }
-
     public CMISServlet(Repository repository) {
         this.repository = repository;
     }

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java?rev=787180&r1=787179&r2=787180&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java
Mon Jun 22 09:29:45 2009
@@ -61,9 +61,10 @@
 
     protected static final int PORT = (int) (8500 + System.currentTimeMillis() % 100);
 
-    protected static final String SERVLET_PATH = "/cmis";
+    protected static final String CONTEXT_PATH = "/ctx";
 
-    protected static final String CMIS_SERVICE = "/repository";
+    // also in web.xml for JAX-RS
+    protected static final String SERVLET_PATH = "/cmis";
 
     @Override
     public void setUp() throws Exception {
@@ -144,10 +145,10 @@
     }
 
     public void testConnect() throws Exception {
-        String base = "http://localhost:" + PORT + SERVLET_PATH;
+        String base = "http://localhost:" + PORT + CONTEXT_PATH + SERVLET_PATH;
         ClientResponse resp;
 
-        resp = client.get(base + CMIS_SERVICE);
+        resp = client.get(base + "/repository");
         assertEquals(200, resp.getStatus());
         Service root = (Service) resp.getDocument().getRoot();
         Workspace workspace = root.getWorkspaces().get(0);

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/TestAtomPubAbderaServlet.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/TestAtomPubAbderaServlet.java?rev=787180&r1=787179&r2=787180&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/TestAtomPubAbderaServlet.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/TestAtomPubAbderaServlet.java
Mon Jun 22 09:29:45 2009
@@ -33,8 +33,8 @@
         server = new Server(PORT);
         Servlet servlet = new CMISServlet(repository);
         ServletHolder servletHolder = new ServletHolder(servlet);
-        Context context = new Context(server, SERVLET_PATH, Context.SESSIONS);
-        context.addServlet(servletHolder, "/*");
+        Context context = new Context(server, CONTEXT_PATH, Context.SESSIONS);
+        context.addServlet(servletHolder, SERVLET_PATH + "/*");
         server.start();
     }
 

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/TestAtomPubJaxrs.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/TestAtomPubJaxrs.java?rev=787180&r1=787179&r2=787180&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/TestAtomPubJaxrs.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/TestAtomPubJaxrs.java
Mon Jun 22 09:29:45 2009
@@ -39,7 +39,7 @@
     public void startServer() throws Exception {
         AbderaResource.repository = repository; // TODO inject differently
         server = new Server(PORT);
-        server.setHandler(new WebAppContext(server, makeWar(), SERVLET_PATH));
+        server.setHandler(new WebAppContext(server, makeWar(), CONTEXT_PATH));
         server.start();
     }
 

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/resources/jaxrs/web.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/resources/jaxrs/web.xml?rev=787180&r1=787179&r2=787180&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/resources/jaxrs/web.xml
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/resources/jaxrs/web.xml
Mon Jun 22 09:29:45 2009
@@ -14,6 +14,6 @@
 
   <servlet-mapping>
     <servlet-name>cxfjaxrs</servlet-name>
-    <url-pattern>/*</url-pattern> <!-- context defined in code -->
+    <url-pattern>/cmis/*</url-pattern> <!-- also in AtomPubServerTestCase
-->
   </servlet-mapping>
 </web-app>



Mime
View raw message