cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1003254 - in /cxf/branches/2.2.x-fixes: ./ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java
Date Thu, 30 Sep 2010 20:56:07 GMT
Author: dkulp
Date: Thu Sep 30 20:56:06 2010
New Revision: 1003254

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

........
  r999649 | sergeyb | 2010-09-21 17:23:55 -0400 (Tue, 21 Sep 2010) | 1 line
  
  Adding a test confirming post parameters can be retrieved from HttpServletContext
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java
    cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java

Propchange: cxf/branches/2.2.x-fixes/
            ('svn:mergeinfo' removed)

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

Modified: cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java?rev=1003254&r1=1003253&r2=1003254&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java
Thu Sep 30 20:56:06 2010
@@ -62,6 +62,19 @@ public class JAXRSSpringSecurityClassTes
     }
     
     @Test
+    public void testBookFromHttpRequestParameters() throws Exception {
+        
+        WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstorestorage/bookforms2",

+                                        "foo", "bar", null);
+        
+        Response r = wc.form(new Form().set("name", "CXF Rocks").set("id", "123"));
+        
+        Book b = readBook((InputStream)r.getEntity());
+        assertEquals("CXF Rocks", b.getName());
+        assertEquals(123L, b.getId());
+    }
+    
+    @Test
     public void testGetBookUserAdmin() throws Exception {
         String endpointAddress =
             "http://localhost:" + PORT + "/bookstorestorage/thosebooks/123"; 

Modified: cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java?rev=1003254&r1=1003253&r2=1003254&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java
Thu Sep 30 20:56:06 2010
@@ -23,12 +23,16 @@ import java.util.HashMap;
 import java.util.Map;
 
 import javax.annotation.security.RolesAllowed;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
 import javax.ws.rs.FormParam;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
 
 import org.apache.cxf.systest.jaxrs.Book;
 import org.apache.cxf.systest.jaxrs.BookNotFoundFault;
@@ -54,6 +58,15 @@ public class SecureBookStoreNoInterface 
         return new Book(name, id);
     }
     
+    @POST
+    @Path("/bookforms2")
+    @RolesAllowed({"ROLE_USER", "ROLE_ADMIN" })
+    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
+    public Book getBookFromHttpRequestParams(@Context HttpServletRequest request) {
+        Map<String, String[]> params = request.getParameterMap();
+        return getBookFromFormParams(params.get("name")[0], Long.valueOf(params.get("id")[0]));
+    }
+    
     @GET
     @Path("/thosebooks/{bookId}/{id}")
     @Produces("application/xml")



Mime
View raw message