You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tiles.apache.org by nl...@apache.org on 2014/09/06 04:31:49 UTC

svn commit: r1622822 - in /tiles/request/branches/TREQ_1_0_X/tiles-request-api/src: main/java/org/apache/tiles/request/locale/ test/java/org/apache/tiles/request/locale/ test/resources/org/ test/resources/org/apache/ test/resources/org/apache/tiles/ te...

Author: nlebas
Date: Sat Sep  6 02:31:48 2014
New Revision: 1622822

URL: http://svn.apache.org/r1622822
Log:
TREQ-20 spaces in file names are not supported

Added:
    tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/resources/org/
    tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/resources/org/apache/
    tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/resources/org/apache/tiles/
    tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/resources/org/apache/tiles/request/
    tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/resources/org/apache/tiles/request/test/
    tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/resources/org/apache/tiles/request/test/locale/
    tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/resources/org/apache/tiles/request/test/locale/resource with space.txt
    tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/resources/org/apache/tiles/request/test/locale/resource.txt
Modified:
    tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/main/java/org/apache/tiles/request/locale/URLApplicationResource.java
    tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/java/org/apache/tiles/request/locale/PostfixedApplicationResourceTest.java
    tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/java/org/apache/tiles/request/locale/URLApplicationResourceTest.java

Modified: tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/main/java/org/apache/tiles/request/locale/URLApplicationResource.java
URL: http://svn.apache.org/viewvc/tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/main/java/org/apache/tiles/request/locale/URLApplicationResource.java?rev=1622822&r1=1622821&r2=1622822&view=diff
==============================================================================
--- tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/main/java/org/apache/tiles/request/locale/URLApplicationResource.java (original)
+++ tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/main/java/org/apache/tiles/request/locale/URLApplicationResource.java Sat Sep  6 02:31:48 2014
@@ -26,11 +26,15 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.JarURLConnection;
-import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLConnection;
 import java.util.Locale;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * A {@link PostfixedApplicationResource} that can be accessed through a URL.
  *
@@ -38,6 +42,7 @@ import java.util.Locale;
  */
 
 public class URLApplicationResource extends PostfixedApplicationResource {
+    private static final Logger LOG = LoggerFactory.getLogger(URLApplicationResource.class);
 
     /** the URL where the contents can be found. */
     private URL url;
@@ -54,7 +59,7 @@ public class URLApplicationResource exte
         super(localePath);
         this.url = url;
         if ("file".equals(url.getProtocol())) {
-            file = new File(url.getPath());
+            file = getFile(url);
         }
     }
 
@@ -65,14 +70,23 @@ public class URLApplicationResource exte
      * @param locale the Locale.
      * @param url the URL where the contents can be found.
      */
-    public URLApplicationResource(String path, Locale locale, URL url) throws MalformedURLException {
+    public URLApplicationResource(String path, Locale locale, URL url) {
         super(path, locale);
         this.url = url;
         if ("file".equals(url.getProtocol())) {
-            file = new File(url.getPath());
+            file = getFile(url);
         }
     }
 
+    private static File getFile(URL url) {
+    	try {
+			return new File(new URI(url.toExternalForm()).getSchemeSpecificPart());
+		} catch (URISyntaxException e) {
+			LOG.debug("Cannot translate URL to file name, expect a performance impact", e);
+			return null;
+		}
+    }
+    
     /** {@inheritDoc} */
     @Override
     public InputStream getInputStream() throws IOException {

Modified: tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/java/org/apache/tiles/request/locale/PostfixedApplicationResourceTest.java
URL: http://svn.apache.org/viewvc/tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/java/org/apache/tiles/request/locale/PostfixedApplicationResourceTest.java?rev=1622822&r1=1622821&r2=1622822&view=diff
==============================================================================
--- tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/java/org/apache/tiles/request/locale/PostfixedApplicationResourceTest.java (original)
+++ tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/java/org/apache/tiles/request/locale/PostfixedApplicationResourceTest.java Sat Sep  6 02:31:48 2014
@@ -61,75 +61,75 @@ public class PostfixedApplicationResourc
      */
     @Test
     public void testGetLocalePath() {
-        TestApplicationResource resource = new TestApplicationResource("/my/path_fr.html");
-        assertEquals("/my/path.html", resource.getLocalePath(null));
-        assertEquals("/my/path.html", resource.getLocalePath(Locale.ROOT));
-        assertEquals("/my/path_it.html", resource.getLocalePath(Locale.ITALIAN));
-        assertEquals("/my/path_it_IT.html", resource.getLocalePath(Locale.ITALY));
-        assertEquals("/my/path_en_GB_scotland.html", resource.getLocalePath(new Locale("en", "GB", "scotland")));
+        TestApplicationResource resource = new TestApplicationResource("/my test/path_fr.html");
+        assertEquals("/my test/path.html", resource.getLocalePath(null));
+        assertEquals("/my test/path.html", resource.getLocalePath(Locale.ROOT));
+        assertEquals("/my test/path_it.html", resource.getLocalePath(Locale.ITALIAN));
+        assertEquals("/my test/path_it_IT.html", resource.getLocalePath(Locale.ITALY));
+        assertEquals("/my test/path_en_GB_scotland.html", resource.getLocalePath(new Locale("en", "GB", "scotland")));
     }
 
     @Test
     public void testBuildFromString() {
-        TestApplicationResource resource = new TestApplicationResource("/my/path_en_GB_scotland.html");
-        assertEquals("/my/path_en_GB_scotland.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        TestApplicationResource resource = new TestApplicationResource("/my test/path_en_GB_scotland.html");
+        assertEquals("/my test/path_en_GB_scotland.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals(new Locale("en", "GB", "scotland"), resource.getLocale());
-        resource = new TestApplicationResource("/my/path_it_IT.html");
-        assertEquals("/my/path_it_IT.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path_it_IT.html");
+        assertEquals("/my test/path_it_IT.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals(Locale.ITALY, resource.getLocale());
-        resource = new TestApplicationResource("/my/path_it.html");
-        assertEquals("/my/path_it.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path_it.html");
+        assertEquals("/my test/path_it.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals(Locale.ITALIAN, resource.getLocale());
-        resource = new TestApplicationResource("/my/path.html");
-        assertEquals("/my/path.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path.html");
+        assertEquals("/my test/path.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals(Locale.ROOT, resource.getLocale());
-        resource = new TestApplicationResource("/my/path_zz.html");
-        assertEquals("/my/path_zz.html", resource.getLocalePath());
-        assertEquals("/my/path_zz.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path_zz.html");
+        assertEquals("/my test/path_zz.html", resource.getLocalePath());
+        assertEquals("/my test/path_zz.html", resource.getPath());
         assertEquals(Locale.ROOT, resource.getLocale());
-        resource = new TestApplicationResource("/my/path_en_ZZ.html");
-        assertEquals("/my/path_en.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path_en_ZZ.html");
+        assertEquals("/my test/path_en.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals(new Locale("en"), resource.getLocale());
-        resource = new TestApplicationResource("/my/path_tiles.html");
-        assertEquals("/my/path_tiles.html", resource.getLocalePath());
-        assertEquals("/my/path_tiles.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path_tiles.html");
+        assertEquals("/my test/path_tiles.html", resource.getLocalePath());
+        assertEquals("/my test/path_tiles.html", resource.getPath());
         assertEquals(Locale.ROOT, resource.getLocale());
-        resource = new TestApplicationResource("/my/path_longwordthatbreaksISO639.html");
-        assertEquals("/my/path_longwordthatbreaksISO639.html", resource.getLocalePath());
-        assertEquals("/my/path_longwordthatbreaksISO639.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path_longwordthatbreaksISO639.html");
+        assertEquals("/my test/path_longwordthatbreaksISO639.html", resource.getLocalePath());
+        assertEquals("/my test/path_longwordthatbreaksISO639.html", resource.getPath());
         assertEquals(Locale.ROOT, resource.getLocale());
-        resource = new TestApplicationResource("/my/path_en_tiles.html");
-        assertEquals("/my/path_en.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path_en_tiles.html");
+        assertEquals("/my test/path_en.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals(new Locale("en"), resource.getLocale());
-        resource = new TestApplicationResource("/my/path_en_longwordthatbreaksISO3166.html");
-        assertEquals("/my/path_en.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path_en_longwordthatbreaksISO3166.html");
+        assertEquals("/my test/path_en.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals(new Locale("en"), resource.getLocale());
     }
 
     @Test
     public void testBuildFromStringAndLocale() {
-        TestApplicationResource resource = new TestApplicationResource("/my/path.html", new Locale("en", "GB", "scotland"));
-        assertEquals("/my/path_en_GB_scotland.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        TestApplicationResource resource = new TestApplicationResource("/my test/path.html", new Locale("en", "GB", "scotland"));
+        assertEquals("/my test/path_en_GB_scotland.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals(new Locale("en", "GB", "scotland"), resource.getLocale());
-        resource = new TestApplicationResource("/my/path.html", Locale.ITALY);
-        assertEquals("/my/path_it_IT.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path.html", Locale.ITALY);
+        assertEquals("/my test/path_it_IT.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals(Locale.ITALY, resource.getLocale());
-        resource = new TestApplicationResource("/my/path.html", Locale.ITALIAN);
-        assertEquals("/my/path_it.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path.html", Locale.ITALIAN);
+        assertEquals("/my test/path_it.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals(Locale.ITALIAN, resource.getLocale());
-        resource = new TestApplicationResource("/my/path.html", Locale.ROOT);
-        assertEquals("/my/path.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path.html", Locale.ROOT);
+        assertEquals("/my test/path.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals(Locale.ROOT, resource.getLocale());
     }
 }

Modified: tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/java/org/apache/tiles/request/locale/URLApplicationResourceTest.java
URL: http://svn.apache.org/viewvc/tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/java/org/apache/tiles/request/locale/URLApplicationResourceTest.java?rev=1622822&r1=1622821&r2=1622822&view=diff
==============================================================================
--- tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/java/org/apache/tiles/request/locale/URLApplicationResourceTest.java (original)
+++ tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/java/org/apache/tiles/request/locale/URLApplicationResourceTest.java Sat Sep  6 02:31:48 2014
@@ -21,9 +21,15 @@
 
 package org.apache.tiles.request.locale;
 import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import java.net.MalformedURLException;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.Locale;
 
@@ -37,11 +43,11 @@ import org.junit.Test;
 public class URLApplicationResourceTest {
 
     private class TestApplicationResource extends URLApplicationResource {
-        public TestApplicationResource(String localePath, URL url) {
+        public TestApplicationResource(String localePath, URL url) throws URISyntaxException {
             super(localePath, url);
         }
 
-        public TestApplicationResource(String path, Locale locale, URL url) throws MalformedURLException {
+        public TestApplicationResource(String path, Locale locale, URL url) throws MalformedURLException, URISyntaxException {
             super(path, locale, url);
         }
 
@@ -58,108 +64,141 @@ public class URLApplicationResourceTest 
 
     /**
      * Test getLocalePath(String path, Locale locale).
+     * @throws URISyntaxException 
      */
     @Test
-    public void testGetLocalePath() throws MalformedURLException {
-        TestApplicationResource resource = new TestApplicationResource("/my/path_fr.html", new URL("file:///"));
-        assertEquals("/my/path.html", resource.getLocalePath(null));
-        assertEquals("/my/path.html", resource.getLocalePath(Locale.ROOT));
-        assertEquals("/my/path_it.html", resource.getLocalePath(Locale.ITALIAN));
-        assertEquals("/my/path_it_IT.html", resource.getLocalePath(Locale.ITALY));
-        assertEquals("/my/path_en_GB_scotland.html", resource.getLocalePath(new Locale("en", "GB", "scotland")));
+    public void testGetLocalePath() throws MalformedURLException, URISyntaxException {
+        TestApplicationResource resource = new TestApplicationResource("/my test/path_fr.html", new URL("file:///"));
+        assertEquals("/my test/path.html", resource.getLocalePath(null));
+        assertEquals("/my test/path.html", resource.getLocalePath(Locale.ROOT));
+        assertEquals("/my test/path_it.html", resource.getLocalePath(Locale.ITALIAN));
+        assertEquals("/my test/path_it_IT.html", resource.getLocalePath(Locale.ITALY));
+        assertEquals("/my test/path_en_GB_scotland.html", resource.getLocalePath(new Locale("en", "GB", "scotland")));
         assertEquals("file:/", resource.getURL().toString());
         assertEquals(File.separator, resource.getFile().toString());
     }
 
     @Test
-    public void testBuildFromString() throws MalformedURLException {
-        TestApplicationResource resource = new TestApplicationResource("/my/path_en_GB_scotland.html", new URL("file:///"));
-        assertEquals("/my/path_en_GB_scotland.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+    public void testBuildFromString() throws MalformedURLException, URISyntaxException {
+        TestApplicationResource resource = new TestApplicationResource("/my test/path_en_GB_scotland.html", new URL("file:///"));
+        assertEquals("/my test/path_en_GB_scotland.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals("file:/", resource.getURL().toString());
         assertEquals(File.separator, resource.getFile().toString());
         assertEquals(new Locale("en", "GB", "scotland"), resource.getLocale());
-        resource = new TestApplicationResource("/my/path_it_IT.html", new URL("file:///"));
-        assertEquals("/my/path_it_IT.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path_it_IT.html", new URL("file:///"));
+        assertEquals("/my test/path_it_IT.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals("file:/", resource.getURL().toString());
         assertEquals(File.separator, resource.getFile().toString());
         assertEquals(Locale.ITALY, resource.getLocale());
-        resource = new TestApplicationResource("/my/path_it.html", new URL("file:///"));
-        assertEquals("/my/path_it.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path_it.html", new URL("file:///"));
+        assertEquals("/my test/path_it.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals("file:/", resource.getURL().toString());
         assertEquals(File.separator, resource.getFile().toString());
         assertEquals(Locale.ITALIAN, resource.getLocale());
-        resource = new TestApplicationResource("/my/path.html", new URL("file:///"));
-        assertEquals("/my/path.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path.html", new URL("file:///"));
+        assertEquals("/my test/path.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals("file:/", resource.getURL().toString());
         assertEquals(File.separator, resource.getFile().toString());
         assertEquals(Locale.ROOT, resource.getLocale());
-        resource = new TestApplicationResource("/my/path_zz.html", new URL("file:///"));
-        assertEquals("/my/path_zz.html", resource.getLocalePath());
-        assertEquals("/my/path_zz.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path_zz.html", new URL("file:///"));
+        assertEquals("/my test/path_zz.html", resource.getLocalePath());
+        assertEquals("/my test/path_zz.html", resource.getPath());
         assertEquals("file:/", resource.getURL().toString());
         assertEquals(File.separator, resource.getFile().toString());
         assertEquals(Locale.ROOT, resource.getLocale());
-        resource = new TestApplicationResource("/my/path_en_ZZ.html", new URL("file:///"));
-        assertEquals("/my/path_en.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path_en_ZZ.html", new URL("file:///"));
+        assertEquals("/my test/path_en.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals("file:/", resource.getURL().toString());
         assertEquals(File.separator, resource.getFile().toString());
         assertEquals(new Locale("en"), resource.getLocale());
-        resource = new TestApplicationResource("/my/path_tiles.html", new URL("file:///"));
-        assertEquals("/my/path_tiles.html", resource.getLocalePath());
-        assertEquals("/my/path_tiles.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path_tiles.html", new URL("file:///"));
+        assertEquals("/my test/path_tiles.html", resource.getLocalePath());
+        assertEquals("/my test/path_tiles.html", resource.getPath());
         assertEquals("file:/", resource.getURL().toString());
         assertEquals(File.separator, resource.getFile().toString());
         assertEquals(Locale.ROOT, resource.getLocale());
-        resource = new TestApplicationResource("/my/path_longwordthatbreaksISO639.html", new URL("file:///"));
-        assertEquals("/my/path_longwordthatbreaksISO639.html", resource.getLocalePath());
-        assertEquals("/my/path_longwordthatbreaksISO639.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path_longwordthatbreaksISO639.html", new URL("file:///"));
+        assertEquals("/my test/path_longwordthatbreaksISO639.html", resource.getLocalePath());
+        assertEquals("/my test/path_longwordthatbreaksISO639.html", resource.getPath());
         assertEquals("file:/", resource.getURL().toString());
         assertEquals(File.separator, resource.getFile().toString());
         assertEquals(Locale.ROOT, resource.getLocale());
-        resource = new TestApplicationResource("/my/path_en_tiles.html", new URL("file:///"));
-        assertEquals("/my/path_en.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path_en_tiles.html", new URL("file:///"));
+        assertEquals("/my test/path_en.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals("file:/", resource.getURL().toString());
         assertEquals(File.separator, resource.getFile().toString());
         assertEquals(new Locale("en"), resource.getLocale());
-        resource = new TestApplicationResource("/my/path_en_longwordthatbreaksISO3166.html", new URL("file:///"));
-        assertEquals("/my/path_en.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path_en_longwordthatbreaksISO3166.html", new URL("file:///"));
+        assertEquals("/my test/path_en.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals("file:/", resource.getURL().toString());
         assertEquals(File.separator, resource.getFile().toString());
         assertEquals(new Locale("en"), resource.getLocale());
     }
 
     @Test
-    public void testBuildFromStringAndLocale() throws MalformedURLException {
-        TestApplicationResource resource = new TestApplicationResource("/my/path.html", new Locale("en", "GB", "scotland"), new URL("file:///"));
-        assertEquals("/my/path_en_GB_scotland.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+    public void testBuildFromStringAndLocale() throws MalformedURLException, URISyntaxException {
+        TestApplicationResource resource = new TestApplicationResource("/my test/path.html", new Locale("en", "GB", "scotland"), new URL("file:///"));
+        assertEquals("/my test/path_en_GB_scotland.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals(new Locale("en", "GB", "scotland"), resource.getLocale());
         assertEquals("file:/", resource.getURL().toString());
         assertEquals(File.separator, resource.getFile().toString());
-        resource = new TestApplicationResource("/my/path.html", Locale.ITALY, new URL("file:///"));
-        assertEquals("/my/path_it_IT.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path.html", Locale.ITALY, new URL("file:///"));
+        assertEquals("/my test/path_it_IT.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals(Locale.ITALY, resource.getLocale());
         assertEquals("file:/", resource.getURL().toString());
         assertEquals(File.separator, resource.getFile().toString());
-        resource = new TestApplicationResource("/my/path.html", Locale.ITALIAN, new URL("file:///"));
-        assertEquals("/my/path_it.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path.html", Locale.ITALIAN, new URL("file:///"));
+        assertEquals("/my test/path_it.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals(Locale.ITALIAN, resource.getLocale());
         assertEquals("file:/", resource.getURL().toString());
         assertEquals(File.separator, resource.getFile().toString());
-        resource = new TestApplicationResource("/my/path.html", Locale.ROOT, new URL("file:///"));
-        assertEquals("/my/path.html", resource.getLocalePath());
-        assertEquals("/my/path.html", resource.getPath());
+        resource = new TestApplicationResource("/my test/path.html", Locale.ROOT, new URL("file:///"));
+        assertEquals("/my test/path.html", resource.getLocalePath());
+        assertEquals("/my test/path.html", resource.getPath());
         assertEquals(Locale.ROOT, resource.getLocale());
         assertEquals("file:/", resource.getURL().toString());
         assertEquals(File.separator, resource.getFile().toString());
     }
+    
+    @Test
+    public void testGetLastModified() throws IOException {
+    	URL url = getClass().getClassLoader().getResource("org/apache/tiles/request/test/locale/resource.txt");
+    	URLApplicationResource resource = new URLApplicationResource("org/apache/tiles/request/test/locale/resource.txt", url);
+    	assertTrue(resource.getLastModified() > 0);
+    }
+    
+    @Test
+    public void testGetLastModifiedWithSpace() throws IOException {
+    	URL url = getClass().getClassLoader().getResource("org/apache/tiles/request/test/locale/resource with space.txt");
+    	URLApplicationResource resource = new URLApplicationResource("org/apache/tiles/request/test/locale/resource with space.txt", url);
+    	assertTrue(resource.getLastModified() > 0);
+    }
+    
+    @Test
+    public void testGetInputStream() throws IOException {
+    	URL url = getClass().getClassLoader().getResource("org/apache/tiles/request/test/locale/resource.txt");
+    	URLApplicationResource resource = new URLApplicationResource("org/apache/tiles/request/test/locale/resource.txt", url);
+    	InputStream is = resource.getInputStream();
+    	assertNotNull(is);
+    	is.close();
+    }
+    
+    @Test
+    public void testGetInputStreamWithSpace() throws IOException {
+    	URL url = getClass().getClassLoader().getResource("org/apache/tiles/request/test/locale/resource with space.txt");
+    	URLApplicationResource resource = new URLApplicationResource("org/apache/tiles/request/test/locale/resource with space.txt", url);
+    	InputStream is = resource.getInputStream();
+    	assertNotNull(is);
+    	is.close();
+    }
 }

Added: tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/resources/org/apache/tiles/request/test/locale/resource with space.txt
URL: http://svn.apache.org/viewvc/tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/resources/org/apache/tiles/request/test/locale/resource%20with%20space.txt?rev=1622822&view=auto
==============================================================================
--- tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/resources/org/apache/tiles/request/test/locale/resource with space.txt (added)
+++ tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/resources/org/apache/tiles/request/test/locale/resource with space.txt Sat Sep  6 02:31:48 2014
@@ -0,0 +1 @@
+test

Added: tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/resources/org/apache/tiles/request/test/locale/resource.txt
URL: http://svn.apache.org/viewvc/tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/resources/org/apache/tiles/request/test/locale/resource.txt?rev=1622822&view=auto
==============================================================================
--- tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/resources/org/apache/tiles/request/test/locale/resource.txt (added)
+++ tiles/request/branches/TREQ_1_0_X/tiles-request-api/src/test/resources/org/apache/tiles/request/test/locale/resource.txt Sat Sep  6 02:31:48 2014
@@ -0,0 +1 @@
+test