You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by sc...@apache.org on 2011/04/01 14:34:22 UTC
svn commit: r1087683 - in /incubator/wookie/trunk: WebContent/WEB-INF/web.xml
src-tests/org/apache/wookie/tests/functional/FlatpackControllerTest.java
src/org/apache/wookie/flatpack/FlatpackFactory.java
Author: scottbw
Date: Fri Apr 1 12:34:22 2011
New Revision: 1087683
URL: http://svn.apache.org/viewvc?rev=1087683&view=rev
Log:
Removed directive to prevent directory listing from web.xml (see WOOKIE-192) and instead add an index.html file to /exports when its first created. Also updated functional test.
Modified:
incubator/wookie/trunk/WebContent/WEB-INF/web.xml
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/FlatpackControllerTest.java
incubator/wookie/trunk/src/org/apache/wookie/flatpack/FlatpackFactory.java
Modified: incubator/wookie/trunk/WebContent/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/WEB-INF/web.xml?rev=1087683&r1=1087682&r2=1087683&view=diff
==============================================================================
--- incubator/wookie/trunk/WebContent/WEB-INF/web.xml (original)
+++ incubator/wookie/trunk/WebContent/WEB-INF/web.xml Fri Apr 1 12:34:22 2011
@@ -137,9 +137,7 @@
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
- <url-pattern>/export/*</url-pattern>
- <param-name>dirAllowed</param-name>
- <param-value>false</param-value>
+ <url-pattern>/export/*</url-pattern>
</servlet-mapping>
<servlet>
Modified: incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/FlatpackControllerTest.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/FlatpackControllerTest.java?rev=1087683&r1=1087682&r2=1087683&view=diff
==============================================================================
--- incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/FlatpackControllerTest.java (original)
+++ incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/FlatpackControllerTest.java Fri Apr 1 12:34:22 2011
@@ -30,6 +30,7 @@ import org.junit.Test;
public class FlatpackControllerTest extends AbstractControllerTest {
private static final String TEST_FLATPACK_SERVICE_URL_VALID = TEST_SERVER_LOCATION+"flatpack";
+ private static final String TEST_EXPORT_SERVICE_URL_VALID = TEST_SERVER_LOCATION+"export";
@BeforeClass
public static void setup() throws HttpException, IOException{
@@ -37,18 +38,22 @@ public class FlatpackControllerTest exte
PostMethod post = new PostMethod(TEST_INSTANCES_SERVICE_URL_VALID);
post.setQueryString("api_key="+API_KEY_VALID+"&widgetid="+WIDGET_ID_VALID+"&userid=FPtest&shareddatakey=test");
client.executeMethod(post);
- int code = post.getStatusCode();
post.releaseConnection();
}
+ // Test that you can't get a directory listing of exported widgets
@Test
public void sniff(){
try {
HttpClient client = new HttpClient();
- GetMethod get = new GetMethod(TEST_FLATPACK_SERVICE_URL_VALID);
+ GetMethod get = new GetMethod(TEST_EXPORT_SERVICE_URL_VALID);
client.executeMethod(get);
int code = get.getStatusCode();
- assertEquals(403, code);
+ if (code != 404){
+ String html = get.getResponseBodyAsString();
+ System.out.println(html);
+ assertEquals(html.length(), 0);
+ }
}
catch (Exception e) {
e.printStackTrace();
Modified: incubator/wookie/trunk/src/org/apache/wookie/flatpack/FlatpackFactory.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/flatpack/FlatpackFactory.java?rev=1087683&r1=1087682&r2=1087683&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/flatpack/FlatpackFactory.java (original)
+++ incubator/wookie/trunk/src/org/apache/wookie/flatpack/FlatpackFactory.java Fri Apr 1 12:34:22 2011
@@ -89,6 +89,8 @@ public class FlatpackFactory {
if (!inputWidget.exists()) throw new Exception("Input widget file does not exist:"+inputWidget.getPath());
if (!flatpackFolder.exists()){
if (!flatpackFolder.mkdir()) throw new Exception("Flatpack folder could not be created:"+flatpackFolder.getPath());
+ // Create an index.html file; this prevents browsing exported files.
+ new File(flatpackFolder.getPath()+"/index.html").createNewFile();
}
// Create tmp working area