incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From enor...@apache.org
Subject svn commit: r1395846 - in /sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post: AbstractGetAclServlet.java GetAclServlet.java GetEffectiveAclServlet.java
Date Tue, 09 Oct 2012 02:28:57 GMT
Author: enorman
Date: Tue Oct  9 02:28:57 2012
New Revision: 1395846

URL: http://svn.apache.org/viewvc?rev=1395846&view=rev
Log:
SLING-2616 Enable tidy output from acl servlets

Modified:
    sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/AbstractGetAclServlet.java
    sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/GetAclServlet.java
    sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/GetEffectiveAclServlet.java

Modified: sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/AbstractGetAclServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/AbstractGetAclServlet.java?rev=1395846&r1=1395845&r2=1395846&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/AbstractGetAclServlet.java
(original)
+++ sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/AbstractGetAclServlet.java
Tue Oct  9 02:28:57 2012
@@ -23,8 +23,8 @@ import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.Map.Entry;
+import java.util.Set;
 
 import javax.jcr.AccessDeniedException;
 import javax.jcr.Item;
@@ -69,7 +69,21 @@ public abstract class AbstractGetAclServ
 	        response.setContentType("application/json");
 	        response.setCharacterEncoding("UTF-8");
 
-	        acl.write(response.getWriter());
+	        boolean isTidy = false;
+	        final String[] selectors = request.getRequestPathInfo().getSelectors();
+	        if (selectors != null && selectors.length > 0) {
+	        	for (final String level : selectors) {
+		            if("tidy".equals(level)) {
+		            	isTidy = true;
+		            }
+				}
+	        }
+
+	        if (isTidy) {
+		        response.getWriter().append(acl.toString(2));
+	        } else {
+	        	acl.write(response.getWriter());
+	        }
         } catch (AccessDeniedException ade) {
             response.sendError(HttpServletResponse.SC_NOT_FOUND);
         } catch (ResourceNotFoundException rnfe) {

Modified: sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/GetAclServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/GetAclServlet.java?rev=1395846&r1=1395845&r2=1395846&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/GetAclServlet.java
(original)
+++ sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/GetAclServlet.java
Tue Oct  9 02:28:57 2012
@@ -115,7 +115,10 @@ import org.apache.sling.jcr.jackrabbit.a
 	@Property (name="sling.servlet.methods", 
 			value="GET"),
 	@Property (name="sling.servlet.selectors", 
-			value="acl"),
+			value={
+			"acl",
+			"tidy.acl"
+		}),
 	@Property (name="sling.servlet.extensions", 
 			value="json")
 })

Modified: sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/GetEffectiveAclServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/GetEffectiveAclServlet.java?rev=1395846&r1=1395845&r2=1395846&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/GetEffectiveAclServlet.java
(original)
+++ sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/GetEffectiveAclServlet.java
Tue Oct  9 02:28:57 2012
@@ -115,7 +115,10 @@ import org.apache.sling.jcr.jackrabbit.a
 	@Property (name="sling.servlet.methods", 
 			value="GET"),
 	@Property (name="sling.servlet.selectors", 
-			value="eacl"),
+			value={
+				"eacl",
+				"tidy.eacl"
+			}),
 	@Property (name="sling.servlet.extensions", 
 			value="json")
 })



Mime
View raw message