incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r591632 - in /incubator/sling/trunk/microsling/microsling-core/src: main/java/org/apache/sling/microsling/slingservlets/ test/java/org/apache/sling/microsling/integration/ test/java/org/apache/sling/microsling/integration/helpers/
Date Sat, 03 Nov 2007 15:22:56 GMT
Author: bdelacretaz
Date: Sat Nov  3 08:22:55 2007
New Revision: 591632

URL: http://svn.apache.org/viewvc?rev=591632&view=rev
Log:
SLING-92 - MicrojaxPostServlet implements the microjax POST protocol (with some TODO left)

Added:
    incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/MicrojaxPropertyValueSetter.java
Modified:
    incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/MicrojaxPostServlet.java
    incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/CreateNodeTest.java
    incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/JsonRenderingTest.java
    incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/NodetypeRenderingTest.java
    incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/SlingResourceTypeRenderingTest.java
    incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/helpers/MicroslingIntegrationTestClient.java

Modified: incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/MicrojaxPostServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/MicrojaxPostServlet.java?rev=591632&r1=591631&r2=591632&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/MicrojaxPostServlet.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/MicrojaxPostServlet.java
Sat Nov  3 08:22:55 2007
@@ -17,115 +17,255 @@
 package org.apache.sling.microsling.slingservlets;
 
 import java.io.IOException;
-import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.sling.api.HttpStatusCodeException;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.request.RequestPathInfo;
+import org.apache.sling.api.request.RequestParameter;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.servlets.SlingAllMethodsServlet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /** Servlet that implements the microjax POST "protocol", see SLING-92 */
 public class MicrojaxPostServlet extends SlingAllMethodsServlet {
     private static final long serialVersionUID = 1837674988291697074L;
+    
+    private static final Logger log = LoggerFactory.getLogger(MicrojaxPostServlet.class);
+    private final MicrojaxPropertyValueSetter propertyValueSetter = new MicrojaxPropertyValueSetter();
+    private int createNodeCounter;
 
+    /** Prefix for parameter names which control this POST
+     *  (ujax stands for "microjax", RP_ stands for "request param")
+     */
+    public static final String RP_PREFIX = "ujax_";
+    
+    /** Optional request parameter: redirect to the specified URL after POST */ 
+    public static final String RP_REDIRECT_TO =  RP_PREFIX + "redirect";
+    
+    /** Optional request parameter: delete the specified content paths */
+    public static final String RP_DELETE_PATH = RP_PREFIX + "delete";
+    
+    /** Optional request parameter: only request parameters starting with this prefix are
+     *  saved as Properties when creating a Node. Active only if at least one parameter 
+     *  starts with this prefix, and defaults to {@link DEFAULT_SAVE_PARAM_PREFIX}.
+     */
+    public static final String RP_SAVE_PARAM_PREFIX = RP_PREFIX + "saveParamPrefix";
+    
+    /** Default value for {@link RP_SAVE_PARAM_PREFIX} */
+    public static final String DEFAULT_SAVE_PARAM_PREFIX = "./";
+    
+    /** Optional request parameter: if value is 0, created node is ordered so as
+     *  to be the first child of its parent.
+     */ 
+    public static final String RP_ORDER = RP_PREFIX + "order";
+    
+    /** Code value for RP_ORDER */ 
+    public static final String ORDER_ZERO = "0";
+    
+    /** Optional request parameter: if provided, added at the end of the computed
+     *  (or supplied) redirect URL
+     */
+    public static final String RP_DISPLAY_EXTENSION = RP_PREFIX + "displayExtension";
+    
     @Override
-    protected void doPost(SlingHttpServletRequest req, SlingHttpServletResponse resp)
+    protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response)
             throws ServletException, IOException {
 
-        // require a node resource
-        Resource r = req.getResource();
-        if (!(req.getResource().getRawData() instanceof Node)
-            && !Resource.RESOURCE_TYPE_NON_EXISTING.equals(r.getResourceType()))
{
-            throw new HttpStatusCodeException(HttpServletResponse.SC_NOT_FOUND,
-                "Resource not found: " + r.getURI() + " must be missing or a Node");
-        }
-
-        String redirectPath = req.getPathInfo();
         Session s = null;
         try {
-            Node current = (Node) req.getResource().getRawData();
-            if (current == null) {
-                Resource root = req.getResourceResolver().getResource("/");
-                if (root != null) {
-                    current = (Node) root.getRawData();
-                } else {
-                    throw new ServletException("Cannot get resource for root node");
+            
+            // Where to redirect to when done
+            String redirectPath = request.getHeader("Referer");
+            
+            // select the Resource to process
+            Resource currentResource = request.getResource();
+            Node currentNode = (Node)currentResource.getRawData();
+            Node newNode = null;
+            
+            // need a Node, path and Session
+            String currentPath = null;
+            if(currentNode != null) {
+                currentPath = currentNode.getPath();
+                s = currentNode.getSession();
+            } else {
+                currentPath = request.getPathInfo();
+                // TODO not very convenient way to get a Session...
+                final Resource root = request.getResourceResolver().getResource("/");
+                final Node rootNode = (Node)root.getRawData();
+                if(rootNode == null) {
+                    throw new HttpStatusCodeException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,"Root
Node not found");
                 }
+                s = rootNode.getSession();
             }
-            s = current.getSession();
-
-            // Decide whether to create or update a node
-            // TODO: this is a simplistic way of deciding, for now: if we have
-            // no Resource or if the Node that it points to already has child nodes,
-            // we create a new node. Else we update the current node.
-            if(current.hasNodes()) {
-                final RequestPathInfo pathInfo = req.getRequestPathInfo();
-                final String parentPath = pathInfo.getResourcePath();
-                final String newNodePath = (pathInfo.getSuffix() == null)
-                        ? String.valueOf(System.currentTimeMillis())
-                        : pathInfo.getSuffix();
-                current = deepCreateNode(s, parentPath + "/" + newNodePath);
+            
+            // process deletes if any
+            final String [] pathsToDelete = request.getParameterValues(RP_DELETE_PATH);
+            if(pathsToDelete!=null) {
+                processDeletes(s, pathsToDelete, currentPath);
             }
-
-            // Copy request parameters to node properties and save
-            setPropertiesFromRequest(current, req);
+            
+            // find out the actual "save prefix" to use - only parameters starting with
+            // this prefix are saved as Properties, when creating nodes, see setPropertiesFromRequest()
+            final String savePrefix = getSavePrefix(request);
+            
+            // compute the path of the node to process, and deep-create if if needed
+            final Set<Node> changedNodes = new HashSet<Node>();
+            String pathToCreate = null;
+            if(currentNode == null) {
+                pathToCreate = request.getPathInfo();
+                if(!pathToCreate.endsWith("/")) {
+                    pathToCreate += "/";
+                }
+                pathToCreate += (createNodeCounter++) + System.currentTimeMillis();
+                
+            } else if(request.getRequestPathInfo().getSuffix() != null) {
+                // we have a suffix, that means our Resource is higher in
+                // the hierarchy than what the request path points to, we
+                // need to create the Node that the request meant to find
+                pathToCreate += request.getRequestPathInfo().getSuffix();
+                
+            }
+            if(pathToCreate!=null) {
+                newNode = currentNode = deepCreateNode(s,pathToCreate, changedNodes);
+            }
+            currentPath = currentNode.getPath();
+            
+            // process the "order" command if any
+            final String order = request.getParameter(RP_ORDER);
+            if(order!=null) {
+                processNodeOrder(currentNode,order);
+            }
+            
+            // walk the request parameters, create and save nodes and properties
+            setPropertiesFromRequest(currentNode, request, savePrefix, changedNodes);
+            
+            // sava data and find out where to redirect
             s.save();
-            redirectPath = current.getPath();
-
-        } catch (RepositoryException re) {
-            throw new ServletException("Failed to modify content: "
-                + re.getMessage(), re);
-
+            final String forcedRedirect = request.getParameter(RP_REDIRECT_TO);
+            final String redirectExtension = request.getParameter(RP_DISPLAY_EXTENSION);
+            if(forcedRedirect != null) {
+                redirectPath = forcedRedirect;
+            } else if(newNode != null) {
+                redirectPath = newNode.getPath();
+            }
+            if(redirectExtension!=null) {
+                redirectPath += redirectExtension;
+            }
+            
+            final String redirectUrl = request.getContextPath() + request.getServletPath()
+ redirectPath; 
+            if(log.isDebugEnabled()) {
+                log.debug("Redirecting to " + redirectUrl);
+            }
+            response.sendRedirect(redirectUrl);
+            
+        } catch(RepositoryException re) {
+            throw new HttpStatusCodeException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,re.toString(),re);
+            
         } finally {
             try {
                 if (s != null && s.hasPendingChanges()) {
                     s.refresh(false);
                 }
-            } catch (RepositoryException re) {
-                // TODO: might want to log, but don't further care
+            } catch(RepositoryException re) {
+                log.warn("RepositoryException in finally block: "+ re.getMessage(),re);
             }
         }
-
-        // redirect to the created node, so that it is displayed using a user-supplied extension
-        String redirectExtension = req.getParameter("slingDisplayExtension");
-        final String redirectUrl =
-            req.getContextPath() + req.getServletPath() + redirectPath
-            + (redirectExtension == null ? "" : "." + redirectExtension)
-        ;
-        resp.sendRedirect(redirectUrl);
     }
 
-    /** Set node properties from current request (only handles Strings for now) */
-    protected void setPropertiesFromRequest(Node n, HttpServletRequest req)
+    /** Set Node properties from current request 
+     *  TODO should handle file uploads as well
+     *  @return the Set of changed Nodes, if any (empty Set if none)
+     */
+    private Set<Node> setPropertiesFromRequest(Node n, SlingHttpServletRequest request,

+            String savePrefix, Set<Node> changedNodes)
             throws RepositoryException {
-        // TODO ignore sling-specific properties like slingDisplayExtension
-        for (Enumeration<?> e = req.getParameterNames(); e.hasMoreElements();) {
-            final String name = (String) e.nextElement();
-            final String[] values = req.getParameterValues(name);
-            if (values.length==1) {
-                n.setProperty(name, values[0]);
-            } else {
-                n.setProperty(name, values);
+        
+        for(Map.Entry<String, RequestParameter[]>  e : request.getRequestParameterMap().entrySet())
{
+            String name = e.getKey();
+            if(savePrefix!=null) {
+                if(!name.startsWith(savePrefix)) continue;
+                name = name.substring(savePrefix.length());
             }
+            setProperty(n,request,name,e.getValue(),changedNodes);
         }
+        
+        return changedNodes;
     }
+    
+    /** Set a single Property on node N 
+     * @throws RepositoryException */
+    private void setProperty(Node n, SlingHttpServletRequest request, String name, 
+            RequestParameter[] values, Set<Node> changedNodes) throws RepositoryException
{
+        
+        // split the relative path identifying the property to be saved
+        String proppath = name;
+
+        // @ValueFrom can be used to define mappings between form fields and JCR properties
+// TODO        
+//        final int vfIndex = name.indexOf("@ValueFrom"); 
+//        if (vfIndex >= 0) {
+//            // Indirect
+//            proppath = name.substring(0, vfIndex);
+//        } else if (name.indexOf("@") >= 0) {
+//            // skip "Hints"
+//            return;
+//        }
+
+        final String path = n.getPath();
+        String parentpath = "";
+        String propname=name;
+
+        if (propname.indexOf("/")>=0) {
+            parentpath=proppath.substring(0, name.lastIndexOf("/"));
+            propname = proppath.substring(name.lastIndexOf("/") + 1);
+        }
+
+        // if the whole thing ended in a slash -> skip
+        if (propname.equals("")) {
+            return;
+        }
+
+        // get or create the parent node
+        final Session s = n.getSession();
+        Node parent;
+        if(name.startsWith("/")) {
+            parent = deepCreateNode(s, parentpath, changedNodes);
+            changedNodes.add(parent);
+            
+        } else if (!parentpath.equals("")) {
+            parent = (Node) s.getItem(path + "/" + parentpath);
+        } else {
+            parent = (Node) s.getItem(path);
+        }
+        changedNodes.add(parent);
+        
+        // TODO String typehint = request.getParameter(proppath + "@TypeHint");
+        final String typeHint = null;
+        final boolean nodeIsNew = changedNodes.contains(parent); 
+        propertyValueSetter.setProperty(parent, propname, values, typeHint, nodeIsNew);
+}
 
     /**
      * Deep creates a node, parent-padding with nt:unstructured nodes
      *
      * @param path absolute path to node that needs to be deep-created
      */
-    protected Node deepCreateNode(Session s, String path)
+    private Node deepCreateNode(Session s, String path, Set<Node> createdNodes)
             throws RepositoryException {
+        if(log.isDebugEnabled()) {
+            log.debug("Deep-creating Node '" + path + "'");
+        }
+        
         String[] pathelems = path.substring(1).split("/");
         int i = 0;
         String mypath = "";
@@ -134,11 +274,75 @@
             String name = pathelems[i];
             mypath += "/" + name;
             if (!s.itemExists(mypath)) {
-                parent.addNode(name);
+                createdNodes.add(parent.addNode(name));
             }
             parent = (Node) s.getItem(mypath);
             i++;
         }
         return (parent);
+    }
+
+    /** Delete Items at the provided paths 
+     *  @param pathsToDelete each path that does not start with / is
+     *      prepended with currentPath 
+     */ 
+    private void processDeletes(Session s, String [] pathsToDelete, String currentPath) 
+    throws RepositoryException {
+        for(String path : pathsToDelete) {
+            if(!path.startsWith("/")) {
+                path = currentPath + "/" + path;
+            }
+            if(s.itemExists(path)) {
+                s.getItem(path).remove();
+                if(log.isDebugEnabled()) {
+                    log.debug("Deleted item " + path);
+                }
+            } else {
+                if(log.isDebugEnabled()) {
+                    log.debug("Item '" + path + "' not found for deletion, ignored");
+                }
+            }
+        }
+    }
+    
+    /** Return the "save prefix" to use, null if none */
+    private String getSavePrefix(SlingHttpServletRequest request) {
+        String prefix = request.getParameter(RP_SAVE_PARAM_PREFIX);
+        if(prefix==null) {
+            prefix = DEFAULT_SAVE_PARAM_PREFIX;
+        }
+        
+        // if no parameters start with this prefix, it is not used
+        String result = null;
+        for(String name : request.getRequestParameterMap().keySet()) {
+            if(name.startsWith(prefix)) {
+                result = prefix;
+                break;
+            }
+        }
+        
+        return result;
+    }
+    
+    /** If orderCode is ORDER_ZERO, move n so that it is the first
+     *  child of its parent 
+     * @throws RepositoryException */
+    private void processNodeOrder(Node n, String orderCode) throws RepositoryException {
+        if(ORDER_ZERO.equals(orderCode)) {
+            final String path = n.getPath();
+            final Node parent=(Node) n.getSession().getItem(path.substring(0,path.lastIndexOf('/')));
+            final String myname=path.substring(path.lastIndexOf('/')+1);
+            final String beforename=parent.getNodes().nextNode().getName();
+            parent.orderBefore(myname, beforename);
+            
+            if(log.isDebugEnabled()) {
+                log.debug("Node " + n.getPath() + " moved to be first child of its parent,
due to orderCode=" + orderCode);
+            }
+            
+        } else {
+            if(log.isDebugEnabled()) {
+                log.debug("orderCode '" + orderCode + "' invalid, ignored");
+            }
+        }
     }
 }

Added: incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/MicrojaxPropertyValueSetter.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/MicrojaxPropertyValueSetter.java?rev=591632&view=auto
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/MicrojaxPropertyValueSetter.java
(added)
+++ incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/MicrojaxPropertyValueSetter.java
Sat Nov  3 08:22:55 2007
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ */
+
+package org.apache.sling.microsling.slingservlets;
+
+import java.util.Calendar;
+
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+
+import org.apache.sling.api.request.RequestParameter;
+
+/**
+ * Sets a Property on the given Node, in some cases with a specific type and
+ * value. For example, "lastModified" with an empty value is stored as the
+ * current Date.
+ */
+class MicrojaxPropertyValueSetter {
+    public static final String CREATED_FIELD = "created";
+    public static final String CREATED_BY_FIELD = "createdBy";
+    public static final String LAST_MODIFIED_FIELD = "lastModified";
+    public static final String LAST_MODIFIED_BY_FIELD = "lastModifiedBy";
+
+    /**
+     * Set property on given node, with some automatic values when user provides
+     * the field name but no value.
+     * 
+     * html example for testing: <input type="hidden" name="dateCreated"/>
+     * <input type="hidden" name="lastModified"/> <input type="hidden"
+     * name="createdBy"/> <input type="hidden" name="lastModifiedBy"/>
+     */
+    void setProperty(Node parent, String name, RequestParameter[] values, String typehint,
boolean nodeWasJustCreated)
+            throws RepositoryException {
+
+        if (valueProvided(values)) {
+            // if user provided a value, don't mess with it
+            setPropertyAsIs(parent, name, values, typehint);
+
+        } else if (CREATED_FIELD.equals(name)) {
+            if (nodeWasJustCreated) {
+                setCurrentDate(parent, name);
+            }
+
+        } else if (CREATED_BY_FIELD.equals(name)) {
+            if (nodeWasJustCreated) {
+                setCurrentUser(parent, name);
+            }
+
+        } else if (LAST_MODIFIED_FIELD.equals(name)) {
+            setCurrentDate(parent, name);
+
+        } else if (LAST_MODIFIED_BY_FIELD.equals(name)) {
+            setCurrentUser(parent, name);
+
+        } else {
+            // no magic field, set value as provided
+            setPropertyAsIs(parent, name, values, typehint);
+        }
+    }
+
+    /** set property to the current Date */
+    private void setCurrentDate(Node parent, String name) throws RepositoryException {
+        removePropertyIfExists(parent, name);
+        parent.setProperty(name, Calendar.getInstance());
+    }
+
+    /** set property to the current User id */
+    private void setCurrentUser(Node parent, String name) throws RepositoryException {
+        removePropertyIfExists(parent, name);
+        parent.setProperty(name, parent.getSession().getUserID());
+    }
+
+    private void removePropertyIfExists(Node parent, String name) throws RepositoryException
{
+        if (parent.hasProperty(name)) {
+            Property prop = parent.getProperty(name);
+            prop.remove();
+        }
+    }
+
+    /** set property without processing, except for type hints */
+    private void setPropertyAsIs(Node parent, String name, RequestParameter[] values, String
typehint) throws RepositoryException {
+        removePropertyIfExists(parent, name);
+
+        // no explicit typehint
+        if (typehint == null) {
+            // guess type based on mvp information from property
+            // TODO: use old property definition to guess aswell
+            if (values.length > 1) {
+                final String [] stringValues = new String[values.length];
+                int i = 0;
+                for(RequestParameter p : values) {
+                    stringValues[i++] = p.getString();
+                }
+                parent.setProperty(name, stringValues);
+            } else {
+                parent.setProperty(name, values[0].getString());
+            }
+        }
+
+        // explicit typehint Date
+        if ("Date".equals(typehint)) {
+            parent.setProperty(name, values[0].getString(), PropertyType.DATE);
+        }
+
+        // TODO: accept more typehints including mvp
+        // TODO: binary support
+    }
+
+    /** true if values contains at least one non-empty value */
+    private boolean valueProvided(RequestParameter[] values) {
+        boolean result = false;
+
+        for (RequestParameter p : values) {
+            if(p!=null && p.getString()!=null) {
+                result = true;
+                break;
+            }
+        }
+
+        return result;
+    }
+
+}

Modified: incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/CreateNodeTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/CreateNodeTest.java?rev=591632&r1=591631&r2=591632&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/CreateNodeTest.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/CreateNodeTest.java
Sat Nov  3 08:22:55 2007
@@ -26,7 +26,7 @@
 public class CreateNodeTest extends MicroslingHttpTestBase {
     
     public void testCreateNode() throws IOException {
-        final String url = HTTP_BASE_URL + "/CreateNodeTest." + System.currentTimeMillis()
+ ".sling";
+        final String url = HTTP_BASE_URL + "/CreateNodeTest." + System.currentTimeMillis();
         
         // add some properties to the node
         final Map<String,String> props = new HashMap<String,String>();

Modified: incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/JsonRenderingTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/JsonRenderingTest.java?rev=591632&r1=591631&r2=591632&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/JsonRenderingTest.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/JsonRenderingTest.java
Sat Nov  3 08:22:55 2007
@@ -39,7 +39,7 @@
         testText = "This is a test " + System.currentTimeMillis();
         
         // create the test node, under a path that's specific to this class to allow collisions
-        final String url = HTTP_BASE_URL + "/" + getClass().getSimpleName() + "." + System.currentTimeMillis()
+ ".sling";
+        final String url = HTTP_BASE_URL + "/" + getClass().getSimpleName() + "." + System.currentTimeMillis();
         final Map<String,String> props = new HashMap<String,String>();
         props.put("text", testText);
         jsonUrl = testClient.createNode(url, props) + ".json";

Modified: incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/NodetypeRenderingTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/NodetypeRenderingTest.java?rev=591632&r1=591631&r2=591632&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/NodetypeRenderingTest.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/NodetypeRenderingTest.java
Sat Nov  3 08:22:55 2007
@@ -34,7 +34,7 @@
         testText = "This is a test " + System.currentTimeMillis();
 
         // create the test node, under a path that's specific to this class to allow collisions
-        final String url = HTTP_BASE_URL + "/" + getClass().getSimpleName() + "." + System.currentTimeMillis()
+ ".sling";
+        final String url = HTTP_BASE_URL + "/" + getClass().getSimpleName() + "." + System.currentTimeMillis();
         final Map<String,String> props = new HashMap<String,String>();
         props.put("text", testText);
         displayUrl = testClient.createNode(url, props);

Modified: incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/SlingResourceTypeRenderingTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/SlingResourceTypeRenderingTest.java?rev=591632&r1=591631&r2=591632&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/SlingResourceTypeRenderingTest.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/SlingResourceTypeRenderingTest.java
Sat Nov  3 08:22:55 2007
@@ -37,7 +37,7 @@
         testText = "This is a test " + System.currentTimeMillis();
         
         // create the test node, under a path that's specific to this class to allow collisions
-        final String url = HTTP_BASE_URL + "/" + getClass().getSimpleName() + "." + System.currentTimeMillis()
+ ".sling";
+        final String url = HTTP_BASE_URL + "/" + getClass().getSimpleName() + "." + System.currentTimeMillis();
         final Map<String,String> props = new HashMap<String,String>();
         props.put("slingResourceType", slingResourceType);
         props.put("text", testText);

Modified: incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/helpers/MicroslingIntegrationTestClient.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/helpers/MicroslingIntegrationTestClient.java?rev=591632&r1=591631&r2=591632&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/helpers/MicroslingIntegrationTestClient.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/integration/helpers/MicroslingIntegrationTestClient.java
Sat Nov  3 08:22:55 2007
@@ -88,8 +88,7 @@
     }
     
     /** Create a node under given path, using a POST to microsling
-     *  @param url must end with ".sling" to use the microsling's default
-     *  servlet POST behaviour. 
+     *  @param url under which node is created 
      *  @return the URL that microsling provides to display the node 
      */
     public String createNode(String url, Map<String,String> nodeProperties) throws
IOException {



Mime
View raw message