You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2011/09/26 16:50:00 UTC

svn commit: r1175892 - in /sling/trunk/samples/slingshot: ./ src/main/resources/SLING-INF/content/libs/slingshot/Album/ src/main/resources/SLING-INF/content/libs/slingshot/Photo/ src/main/resources/SLING-INF/content/libs/slingshot/Tag/

Author: cziegeler
Date: Mon Sep 26 14:49:59 2011
New Revision: 1175892

URL: http://svn.apache.org/viewvc?rev=1175892&view=rev
Log:
Encode output and update readme

Modified:
    sling/trunk/samples/slingshot/README.txt
    sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/html.jsp
    sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/tags.html.jsp
    sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/trail.html.jsp
    sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/treeentry.html.jsp
    sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/html.jsp
    sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/main.html.jsp
    sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Tag/html.jsp

Modified: sling/trunk/samples/slingshot/README.txt
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/README.txt?rev=1175892&r1=1175891&r2=1175892&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/README.txt (original)
+++ sling/trunk/samples/slingshot/README.txt Mon Sep 26 14:49:59 2011
@@ -7,16 +7,22 @@ and files as photos.
 Getting Started
 ===============
 
-This component uses a Maven 2 (http://maven.apache.org/) build
+This component uses a Maven 3 (http://maven.apache.org/) build
 environment. It requires a Java 5 JDK (or higher) and Maven (http://maven.apache.org/)
-2.0.10 or later. We recommend to use the latest Maven version.
+3.0.2 or later. We recommend to use the latest Maven version.
 
-If you have Maven 2 installed, you can compile and
+If you have Maven 3 installed, you can compile and
 package the jar using the following command:
 
     mvn package
 
-See the Maven 2 documentation for other build features.
+See the Maven 3 documentation for other build features.
+
+Install the built bundle using the web console and go to
+
+http://localhost:8080/slingshot/albums.html
+
+
 
 The latest source code for this component is available in the
 Subversion (http://subversion.tigris.org/) source repository of
@@ -26,4 +32,3 @@ you can checkout the latest source using
     svn checkout http://svn.apache.org/repos/asf/sling/trunk/samples/slingshot
 
 See the Subversion documentation for other source control features.
-

Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/html.jsp?rev=1175892&r1=1175891&r2=1175892&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/html.jsp Mon Sep 26 14:49:59 2011
@@ -17,12 +17,13 @@
     under the License.
 --%><%@page session="false" %><%
 %><%@page import="org.apache.sling.api.resource.ResourceUtil,
-                org.apache.sling.api.resource.ValueMap" %><%
+                org.apache.sling.api.resource.ValueMap,
+                org.apache.sling.api.request.ResponseUtil" %><%
 %><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><%
 %><sling:defineObjects/><%
 
     final ValueMap attributes = ResourceUtil.getValueMap(resource);
-    final String albumName = attributes.get("jcr:title", ResourceUtil.getName(resource));
+    final String albumName = ResponseUtil.escapeXml(attributes.get("jcr:title", ResourceUtil.getName(resource)));
 %><html>
   <head>
     <title>Album <%= albumName %></title>

Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/tags.html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/tags.html.jsp?rev=1175892&r1=1175891&r2=1175892&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/tags.html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/tags.html.jsp Mon Sep 26 14:49:59 2011
@@ -19,7 +19,8 @@
 %><%@page import="java.util.Iterator,
                   org.apache.sling.api.resource.Resource,
                   org.apache.sling.api.resource.ResourceUtil,
-                  org.apache.sling.api.resource.ValueMap" %><%
+                  org.apache.sling.api.resource.ValueMap,
+                  org.apache.sling.api.request.ResponseUtil" %><%
 %><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><%
 %><sling:defineObjects/><%
 %><div class="tags">
@@ -31,7 +32,7 @@
        while ( ni.hasNext() ) {
            final Resource current = ni.next();
            final ValueMap attr = ResourceUtil.getValueMap(current);
-           %><div class="tag"><a href="<%= request.getContextPath() %><%= current.getPath() %>.html"><%=current.getName() %></a></div><%
+           %><div class="tag"><a href="<%= request.getContextPath() %><%= current.getPath() %>.html"><%=ResponseUtil.escapeXml(current.getName()) %></a></div><%
        }
    }
    %>

Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/trail.html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/trail.html.jsp?rev=1175892&r1=1175891&r2=1175892&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/trail.html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/trail.html.jsp Mon Sep 26 14:49:59 2011
@@ -21,7 +21,8 @@
                   org.apache.sling.api.resource.Resource,
                   org.apache.sling.api.resource.ResourceUtil,
                   org.apache.sling.api.resource.ValueMap,
-                  org.apache.sling.sample.slingshot.Constants" %><%
+                  org.apache.sling.sample.slingshot.Constants,
+                  org.apache.sling.api.request.ResponseUtil" %><%
 %><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><%
 %><sling:defineObjects/><%
 %><div class="trail"><div class="trailpart">Trail:</div>
@@ -36,7 +37,7 @@
         do {
             final ValueMap parentAttr = ResourceUtil.getValueMap(parent);
             final String parentName = parent.getName();
-            parents.add(new Object[] {prefix + parentName, parentAttr.get("jcr:title", parentName)});
+            parents.add(new Object[] {prefix + parentName, ResponseUtil.escapeXml(parentAttr.get("jcr:title", parentName))});
             parent = parent.getParent();
             prefix = prefix + "../";
             if ( parent.getPath().equals(Constants.APP_ROOT) ) {

Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/treeentry.html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/treeentry.html.jsp?rev=1175892&r1=1175891&r2=1175892&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/treeentry.html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/treeentry.html.jsp Mon Sep 26 14:49:59 2011
@@ -18,10 +18,11 @@
 --%><%@page session="false" %><%
 %><%@page import="org.apache.sling.api.resource.Resource,
                   org.apache.sling.api.resource.ResourceUtil,
-                  org.apache.sling.api.resource.ValueMap" %><%
+                  org.apache.sling.api.resource.ValueMap,
+                  org.apache.sling.api.request.ResponseUtil" %><%
 %><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><%
 %><sling:defineObjects/><%
   ValueMap attributes = ResourceUtil.getValueMap(resource);
   Resource parent = resource.getParent();
   String name = resource.getName();
-%>- <a href="<%=parent.getName() %>/<%=name %>.slingshot.html"><%=attributes.get("jcr:title", name) %></a><br/>
\ No newline at end of file
+%>- <a href="<%=parent.getName() %>/<%=name %>.slingshot.html"><%=ResponseUtil.escapeXml(attributes.get("jcr:title", name)) %></a><br/>
\ No newline at end of file

Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/html.jsp?rev=1175892&r1=1175891&r2=1175892&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/html.jsp Mon Sep 26 14:49:59 2011
@@ -17,7 +17,8 @@
     under the License.
 --%><%@page session="false" %><%
 %><%@page import="org.apache.sling.api.resource.ResourceUtil,
-                  org.apache.sling.api.resource.ValueMap"%><%
+                  org.apache.sling.api.resource.ValueMap,
+                  org.apache.sling.api.request.ResponseUtil"%><%
 %><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><%
 %><sling:defineObjects/><%
     final ValueMap attributes = ResourceUtil.getValueMap(resource);
@@ -29,15 +30,15 @@
   <body>
     <h1><%= photoName %></h1>
     <img src="<%=resource.getName() %>"/>
-    <p>Description: <%=attributes.get("jcr:description", "")%></p>
-    <p>Location: <%=attributes.get("slingshot:location", "")%></p>
-    <p>Tags:&nbsp
+    <p>Description: <%=ResponseUtil.escapeXml(attributes.get("jcr:description", ""))%></p>
+    <p>Location: <%=ResponseUtil.escapeXml(attributes.get("slingshot:location", ""))%></p>
+    <p>Tags:&nbsp;
 <%
     String[] values = attributes.get("slingshot:tags", String[].class);
     if  (values != null ) {
         for(int k=0;k<values.length;k++) {
             if(k>0) out.write(", ");
-            out.write(values[k]);
+            out.write(ResponseUtil.escapeXml(values[k]));
         }
         
     }

Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/main.html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/main.html.jsp?rev=1175892&r1=1175891&r2=1175892&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/main.html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/main.html.jsp Mon Sep 26 14:49:59 2011
@@ -19,7 +19,8 @@
 %><%@page import="org.apache.sling.api.resource.Resource,
                 org.apache.sling.api.resource.ResourceUtil,
                 org.apache.sling.api.resource.ValueMap,
-                org.apache.sling.sample.slingshot.Constants" %><%
+                org.apache.sling.sample.slingshot.Constants,
+                org.apache.sling.api.request.ResponseUtil" %><%
 %><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><%
 %><sling:defineObjects/><%
 %><div class="photo">
@@ -35,14 +36,14 @@
     }
 %>
     <a href="<%= request.getContextPath() %><%=relPath%>.slingshot.html"><img src="<%=imagePath%>" width="100" height="100"/></a><br/>
-    <p><a href="<%= request.getContextPath() %><%=relPath%>.slingshot.html"><%= photoName %></a></p>
+    <p><a href="<%= request.getContextPath() %><%=relPath%>.slingshot.html"><%= ResponseUtil.escapeXml(photoName) %></a></p>
     <p>Tags:&nbsp;
 <%
     String[] values = attr.get("slingshot:tags", String[].class);
     if  (values != null ) {
         for(int k=0;k<values.length;k++) {
             if (k>0) out.write(", ");
-            out.write(values[k]);
+            out.write(ResponseUtil.escapeXml(values[k]));
         }
     }
 %>

Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Tag/html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Tag/html.jsp?rev=1175892&r1=1175891&r2=1175892&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Tag/html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Tag/html.jsp Mon Sep 26 14:49:59 2011
@@ -20,6 +20,7 @@
                 org.apache.sling.api.resource.ResourceResolver,
                 org.apache.sling.api.resource.ResourceUtil,
                 org.apache.sling.api.resource.ValueMap,
+                org.apache.sling.api.request.ResponseUtil,
                 java.util.Iterator"%><%
 %><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><%
 %><sling:defineObjects/><%
@@ -28,10 +29,10 @@
     final ResourceResolver resolver = resource.getResourceResolver();
 %><html>
   <head>
-    <title>Tag <%= name %></title>
+    <title>Tag <%= ResponseUtil.escapeXml(name) %></title>
   </head>
   <body>
-<h1>Tag <%=name %></h1>
+<h1>Tag <%=ResponseUtil.escapeXml(name) %></h1>
 <div class="photolist">
 <%
     int i = 0;