cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1381152 - in /cxf/trunk: rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/
Date Wed, 05 Sep 2012 12:10:25 GMT
Author: sergeyb
Date: Wed Sep  5 12:10:24 2012
New Revision: 1381152

URL: http://svn.apache.org/viewvc?rev=1381152&view=rev
Log:
[CXF-4400] Minor fix to the way static resources are checked

Modified:
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java
    cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/web.xml

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java?rev=1381152&r1=1381151&r2=1381152&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
Wed Sep  5 12:10:24 2012
@@ -227,13 +227,13 @@ public abstract class AbstractHTTPServle
             redirect(request, response, request.getPathInfo());
             return;
         }
-        
-        if (staticResourcesList != null 
-            && matchPath(staticResourcesList, request)
-            || staticWelcomeFile != null 
-                && (StringUtils.isEmpty(request.getPathInfo()) || request.getPathInfo().equals("/")))
{
+        boolean staticResourcesMatch = staticResourcesList != null 
+            && matchPath(staticResourcesList, request);
+        boolean staticWelcomeFileMatch = staticWelcomeFile != null 
+            && (StringUtils.isEmpty(request.getPathInfo()) || request.getPathInfo().equals("/"));

+        if (staticResourcesMatch || staticWelcomeFileMatch) {
             serveStaticContent(request, response, 
-                               staticWelcomeFile != null ? staticWelcomeFile : request.getPathInfo());
+                               staticWelcomeFileMatch ? staticWelcomeFile : request.getPathInfo());
             return;
         }
         invoke(request, response);

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java?rev=1381152&r1=1381151&r2=1381152&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java
Wed Sep  5 12:10:24 2012
@@ -115,6 +115,16 @@ public class JAXRSRequestDispatcherTest 
         doTestGetBookHTMLFromWelcomeList(endpointAddress);
     }
     
+    @Test
+    public void testGetTextWelcomeFile() throws Exception {
+        String address = "http://localhost:" + PORT + "/welcome2/welcome.txt";
+        WebClient client = WebClient.create(address);
+        client.accept("text/plain");
+        String welcome = client.get(String.class);
+        System.out.println(welcome);
+        assertEquals("Welcome", welcome);
+    }
+    
     private void doTestGetBookHTMLFromWelcomeList(String address) throws Exception {
         WebClient client = WebClient.create(address);
         client.accept("text/html");

Modified: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/web.xml?rev=1381152&r1=1381151&r2=1381152&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/web.xml (original)
+++ cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/web.xml Wed Sep  5
12:10:24 2012
@@ -146,6 +146,10 @@
     		<param-name>static-welcome-file</param-name>
 	    	<param-value>/welcomeBook.html</param-value>
 	    </init-param>
+	    <init-param>
+    		<param-name>static-resources-list</param-name>
+	    	<param-value>/welcome.txt</param-value>
+	    </init-param>
 		<load-on-startup>1</load-on-startup>
 	</servlet>
 	



Mime
View raw message