incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r601753 - in /incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling: resource/ scripting/ servlet/ slingservlets/
Date Thu, 06 Dec 2007 15:00:45 GMT
Author: cziegeler
Date: Thu Dec  6 07:00:45 2007
New Revision: 601753

URL: http://svn.apache.org/viewvc?rev=601753&view=rev
Log:
Clean up a little bit: remove unused imports, fix javadocs.

Modified:
    incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/resource/MicroslingResourceResolver.java
    incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java
    incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/servlet/MicroslingServletResolver.java
    incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/MicrojaxGetServlet.java
    incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/MicrojaxPostServlet.java

Modified: incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/resource/MicroslingResourceResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/resource/MicroslingResourceResolver.java?rev=601753&r1=601752&r2=601753&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/resource/MicroslingResourceResolver.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/resource/MicroslingResourceResolver.java
Thu Dec  6 07:00:45 2007
@@ -21,7 +21,6 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 
 import javax.jcr.NamespaceException;
@@ -141,7 +140,7 @@
                 // return the base resource
                 return base;
             }
-            
+
             Node baseNode = base.adaptTo(Node.class);
             if (baseNode != null) {
                 try {

Modified: incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java?rev=601753&r1=601752&r2=601753&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java
Thu Dec  6 07:00:45 2007
@@ -28,10 +28,8 @@
 import javax.jcr.Item;
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
-import javax.jcr.Property;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
-import javax.jcr.Value;
 import javax.servlet.ServletException;
 
 import org.apache.sling.api.SlingException;
@@ -99,10 +97,6 @@
 
     /**
      * @param req
-     * @param scriptExtension
-     * @return <code>true</code> if a MicroslingScript and a ScriptEngine to
-     *         evaluate it could be found. Otherwise <code>false</code> is
-     *         returned.
      * @throws ServletException
      * @throws IOException
      */
@@ -164,33 +158,33 @@
     public SlingScript resolveScriptInternal(
             final SlingHttpServletRequest request) throws RepositoryException, SlingException
{
 
-        final Resource r = request.getResource(); 
+        final Resource r = request.getResource();
         final Session s = (Session)request.getAttribute(Session.class.getName());
         MicroslingScript result = null;
 
         final String scriptFilename = scriptFilenameBuilder.buildScriptFilename(
             request.getMethod(),
-            request.getRequestPathInfo().getExtension(), 
+            request.getRequestPathInfo().getExtension(),
             "*");
-        
+
         // this is the location of the trailing asterisk
         final int scriptExtensionOffset = scriptFilename.length() - 1;
 
         final List<String> possiblePaths = scriptSearchPathsBuilder.getScriptSearchPaths(
                 request.getResource(), request.getRequestPathInfo().getSelectors());
         for(String currentPath : possiblePaths) {
-            
+
             if(result != null) {
                 break;
             }
-            
+
             if (log.isDebugEnabled()) {
                 log.debug("Looking for script with filename=" + scriptFilename
                     + " under " + currentPath);
             }
-            
+
             if (s.itemExists(currentPath)) {
-    
+
                 // get the item and ensure it is a node
                 final Item i = s.getItem(currentPath);
                 if (i.isNode()) {
@@ -198,14 +192,14 @@
                     NodeIterator scriptNodeIterator = parent.getNodes(scriptFilename);
                     while (scriptNodeIterator.hasNext()) {
                         Node scriptNode = scriptNodeIterator.nextNode();
-    
+
                         // SLING-72: Require the node to be an nt:file
                         if (scriptNode.isNodeType("nt:file")) {
-    
+
                             String scriptName = scriptNode.getName();
                             String scriptExt = scriptName.substring(scriptExtensionOffset);
                             SlingScriptEngine scriptEngine = scriptEngines.get(scriptExt);
-    
+
                             if (scriptEngine != null) {
                                 MicroslingScript script = new MicroslingScript();
                                 script.setScriptResource(new JcrNodeResource(scriptNode));
@@ -263,9 +257,6 @@
         }
 
         public Reader getScriptReader() throws IOException {
-
-            Property property;
-            Value value;
 
             InputStream stream = getScriptResource().adaptTo(InputStream.class);
             if (stream == null) {

Modified: incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/servlet/MicroslingServletResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/servlet/MicroslingServletResolver.java?rev=601753&r1=601752&r2=601753&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/servlet/MicroslingServletResolver.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/servlet/MicroslingServletResolver.java
Thu Dec  6 07:00:45 2007
@@ -18,8 +18,6 @@
  */
 package org.apache.sling.microsling.servlet;
 
-import java.util.Collections;
-import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
 

Modified: incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/MicrojaxGetServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/MicrojaxGetServlet.java?rev=601753&r1=601752&r2=601753&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/MicrojaxGetServlet.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/slingservlets/MicrojaxGetServlet.java
Thu Dec  6 07:00:45 2007
@@ -22,7 +22,6 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.servlet.ServletException;
@@ -32,7 +31,6 @@
 import org.apache.sling.api.SlingException;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
 import org.apache.sling.commons.json.JSONException;
 import org.apache.sling.commons.json.io.JSONWriter;
@@ -59,38 +57,37 @@
             }
         }
 
-        if(data== null) {
+        if (data== null) {
             throw new HttpStatusCodeException(HttpServletResponse.SC_NOT_FOUND,request.getPathInfo());
-        } else {
-            // render data in JSON format
-            response.setContentType(getServletContext().getMimeType("dummy.json"));
-            final Writer out = new OutputStreamWriter(response.getOutputStream());
-            final JSONWriter w = new JSONWriter(out);
-            try {
-                w.object();
-                for(Map.Entry<String, Object> e : data.entrySet()) {
-                    w.key(e.getKey());
-                    w.value(e.getValue());
-                }
-                w.endObject();
+        }
+        // render data in JSON format
+        response.setContentType(getServletContext().getMimeType("dummy.json"));
+        final Writer out = new OutputStreamWriter(response.getOutputStream());
+        final JSONWriter w = new JSONWriter(out);
+        try {
+            w.object();
+            for(Map.Entry<String, Object> e : data.entrySet()) {
+                w.key(e.getKey());
+                w.value(e.getValue());
+            }
+            w.endObject();
 
-            } catch (JSONException jse) {
-                out.write(jse.toString());
+        } catch (JSONException jse) {
+            out.write(jse.toString());
 
-            } finally {
-                out.flush();
-            }
+        } finally {
+            out.flush();
         }
     }
 
     protected Map<String, Object> getSessionInfo(SlingHttpServletRequest request)
     throws RepositoryException, HttpStatusCodeException, SlingException {
         final Map<String, Object> result = new HashMap<String, Object>();
-        
+
         final Session s = (Session)request.getAttribute(Session.class.getName());
         result.put("workspace",s.getWorkspace().getName());
         result.put("userID",s.getUserID());
-        
+
         return result;
     }
 

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=601753&r1=601752&r2=601753&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
Thu Dec  6 07:00:45 2007
@@ -61,11 +61,11 @@
 
     /** 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}.
+     *  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} */
+    /** 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
@@ -200,7 +200,7 @@
         final String redirectExtension = request.getParameter(RP_DISPLAY_EXTENSION);
         if(forcedRedirect != null) {
             redirectPath = forcedRedirect;
-        } else if(currentNode != null) {
+        } else {
             redirectPath = currentNode.getPath();
         }
         if(redirectExtension!=null) {



Mime
View raw message