You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2012/09/05 17:16:57 UTC

svn commit: r1381221 - in /cxf/branches/2.6.x-fixes: ./ 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/ systests/jaxrs/src/t...

Author: sergeyb
Date: Wed Sep  5 15:16:57 2012
New Revision: 1381221

URL: http://svn.apache.org/viewvc?rev=1381221&view=rev
Log:
Merged revisions 1381152,1381154 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1381152 | sergeyb | 2012-09-05 13:10:24 +0100 (Wed, 05 Sep 2012) | 1 line
  
  [CXF-4400] Minor fix to the way static resources are checked
........
  r1381154 | sergeyb | 2012-09-05 13:11:22 +0100 (Wed, 05 Sep 2012) | 1 line
  
  [CXF-4400] Minor fix to the way static resources are checked: adding the test resource
........

Added:
    cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/resources/jaxrs_dispatch/welcome.txt
      - copied unchanged from r1381154, cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/welcome.txt
Modified:
    cxf/branches/2.6.x-fixes/   (props changed)
    cxf/branches/2.6.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
    cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java
    cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/web.xml

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1381152-1381154

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.6.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java?rev=1381221&r1=1381220&r2=1381221&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java (original)
+++ cxf/branches/2.6.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java Wed Sep  5 15:16:57 2012
@@ -209,13 +209,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/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java?rev=1381221&r1=1381220&r2=1381221&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java (original)
+++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java Wed Sep  5 15:16:57 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/branches/2.6.x-fixes/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/web.xml?rev=1381221&r1=1381220&r2=1381221&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/web.xml (original)
+++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/web.xml Wed Sep  5 15:16:57 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>