Author: jliu
Date: Tue Sep 11 23:50:08 2007
New Revision: 574801
URL: http://svn.apache.org/viewvc?rev=574801&view=rev
Log:
Be able to return HTTP status correctly.
Modified:
incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
Modified:
incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java?rev=574801&r1=574800&r2=574801&view=diff
==============================================================================
---
incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
(original)
+++
incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
Tue Sep 11 23:50:08 2007
@@ -63,8 +63,9 @@
Response response = (Response)responseObj;
responseObj = response.getEntity();
- HttpServletResponse hsr =
(HttpServletResponse)message.get("HTTP.RESPONSE");
- hsr.setStatus(response.getStatus());
+ //HttpServletResponse hsr =
(HttpServletResponse)message.get("HTTP.RESPONSE");
+ //hsr.setStatus(response.getStatus());
+ message.put(Message.RESPONSE_CODE, response.getStatus());
if (responseObj == null) {
return;
Modified:
incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java?rev=574801&r1=574800&r2=574801&view=diff
==============================================================================
---
incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
(original)
+++
incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
Tue Sep 11 23:50:08 2007
@@ -73,13 +73,14 @@
@HttpMethod("POST")
@UriTemplate("/books")
- public Book addBook(Book book) {
+ public Response addBook(Book book) {
System.out.println("----invoking addBook, book name is: " +
book.getName());
book.setId(++bookId);
books.add(book);
- return book;
+ Response r = Response.Builder.ok(book).build();
+ return r;
}
@HttpMethod("PUT")
Modified:
incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=574801&r1=574800&r2=574801&view=diff
==============================================================================
---
incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
(original)
+++
incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
Tue Sep 11 23:50:08 2007
@@ -38,10 +38,10 @@
public class JAXRSClientServerBookTest extends AbstractBusClientServerTestBase
{
-/* @BeforeClass
+ @BeforeClass
public static void startServers() throws Exception {
assertTrue("server did not launch correctly",
launchServer(BookServer.class));
- }*/
+ }
@Test
public void testGetBooks() throws Exception {
@@ -152,7 +152,7 @@
@Test
public void testUpdateBookFailed() throws Exception {
String endpointAddress =
- "http://localhost:9080/xml/bookstore/books";
+ "http://localhost:9081/xml/bookstore/books";
String inputFile =
getClass().getResource("resources/update_book_not_exist.txt").getFile();
File input = new File(inputFile);
@@ -163,7 +163,7 @@
try {
int result = httpclient.executeMethod(post);
- assertEquals(200, result);
+ assertEquals(304, result);
System.out.println("Response status code: " + result);
System.out.println("Response body: ");
System.out.println(post.getResponseBodyAsString());