cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r899344 - in /cxf/branches/2.2.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/
Date Thu, 14 Jan 2010 18:21:27 GMT
Author: sergeyb
Date: Thu Jan 14 18:21:26 2010
New Revision: 899344

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

........
  r899337 | sergeyb | 2010-01-14 18:12:02 +0000 (Thu, 14 Jan 2010) | 1 line
  
  JAXRS : fixing a regression with setting headers on HttpServletResponse
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpServletResponseFilter.java
    cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
    cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 14 18:21:26 2010
@@ -1 +1 @@
-/cxf/trunk:898526,898757
+/cxf/trunk:898526,898757,899337

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

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpServletResponseFilter.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpServletResponseFilter.java?rev=899344&r1=899343&r2=899344&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpServletResponseFilter.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpServletResponseFilter.java
Thu Jan 14 18:21:26 2010
@@ -19,9 +19,6 @@
 package org.apache.cxf.jaxrs.impl;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
 
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
@@ -47,30 +44,5 @@
     public ServletOutputStream getOutputStream() throws IOException {
         return new ServletOutputStreamFilter(super.getOutputStream(), m);
     }
-    
-    @Override
-    public void setHeader(String name, String value) {
-        setHeaderInternal(name, value, false);
-    }
-    
-    @Override
-    public void addHeader(String name, String value) {
-        setHeaderInternal(name, value, true);
-    }
-    
-    @SuppressWarnings("unchecked")
-    private void setHeaderInternal(String name, String value, boolean add) {
-        Map<String, List<String>> headers = 
-            (Map<String, List<String>>)m.get(Message.PROTOCOL_HEADERS);
-        List<String> values = headers.get(name);
-        if (values == null) {
-            values = new ArrayList<String>();
-            headers.put(name, values);
-        }
-        if (!add) {
-            values.clear();
-        }
-        values.add(value);
-    }
 }
 

Modified: cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java?rev=899344&r1=899343&r2=899344&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
Thu Jan 14 18:21:26 2010
@@ -478,9 +478,11 @@
     @Path("/books/customstatus")
     @Produces("text/xml")
     @Consumes("text/xml")
-    public Response addBookCustomFailure(Book book, @Context HttpServletResponse response)
{
+    public Book addBookCustomFailure(Book book, @Context HttpServletResponse response) {
         response.setStatus(333);
-        return null;
+        response.addHeader("CustomHeader", "CustomValue");
+        book.setId(888);
+        return book;
     }
     
     @POST

Modified: cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=899344&r1=899343&r2=899344&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
Thu Jan 14 18:21:26 2010
@@ -684,21 +684,12 @@
     @Test
     public void testAddBookCustomFailureStatus() throws Exception {
         String endpointAddress = "http://localhost:9080/bookstore/books/customstatus";
-
-        File input = new File(getClass().getResource("resources/update_book.txt").toURI());
-        PostMethod put = new PostMethod(endpointAddress);
-        RequestEntity entity = new FileRequestEntity(input, "text/xml; charset=ISO-8859-1");
-        put.setRequestEntity(entity);
-        HttpClient httpclient = new HttpClient();
-
-        try {
-            int result = httpclient.executeMethod(put);
-            assertEquals(333, result);
-        } finally {
-            // Release current connection to the connection pool once you are
-            // done
-            put.releaseConnection();
-        }
+        WebClient client = WebClient.create(endpointAddress);
+        Book book = client.type("text/xml").accept("text/xml").post(new Book(), Book.class);
+        assertEquals(888L, book.getId());
+        Response r = client.getResponse();
+        assertEquals("CustomValue", r.getMetadata().getFirst("CustomHeader"));
+        assertEquals(333, r.getStatus());
     }
     
     @Test



Mime
View raw message