You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by jl...@apache.org on 2007/12/19 16:59:55 UTC
svn commit: r605598 - in
/incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs:
README.txt src/demo/jaxrs/client/Client.java src/demo/jaxrs/server/Order.java
Author: jliu
Date: Wed Dec 19 07:59:54 2007
New Revision: 605598
URL: http://svn.apache.org/viewvc?rev=605598&view=rev
Log:
More updates on jax-rs demo.
Modified:
incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/README.txt
incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/src/demo/jaxrs/client/Client.java
incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/src/demo/jaxrs/server/Order.java
Modified: incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/README.txt
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/README.txt?rev=605598&r1=605597&r2=605598&view=diff
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/README.txt (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/README.txt Wed Dec 19 07:59:54 2007
@@ -14,9 +14,13 @@
<name>John</name>
</Customer>
-A HTTP GET request to URL http://localhost:9000/customerservice/orders/223/products/1
-returns product 1 from order 223.
+A HTTP GET request to URL http://localhost:9000/customerservice/orders/223/products/323
+returns product 323 that belongs to order 223. The XML document returned:
+<Product>
+ <description>product 323</description>
+ <id>323</id>
+</Product>
A HTTP POST request to URL http://localhost:9000/customerservice/customers
with the data:
Modified: incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/src/demo/jaxrs/client/Client.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/src/demo/jaxrs/client/Client.java?rev=605598&r1=605597&r2=605598&view=diff
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/src/demo/jaxrs/client/Client.java (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/src/demo/jaxrs/client/Client.java Wed Dec 19 07:59:54 2007
@@ -52,6 +52,12 @@
InputStream in = url.openStream();
System.out.println(getStringFromInputStream(in));
+ // Sent HTTP GET request to query sub resource product info
+ System.out.println("Sent HTTP GET request to query sub resource product info");
+ url = new URL("http://localhost:9000/customerservice/orders/223/products/323");
+ in = url.openStream();
+ System.out.println(getStringFromInputStream(in));
+
// Sent HTTP PUT request to update customer info
System.out.println("Sent HTTP PUT request to update customer info");
Client client = new Client();
Modified: incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/src/demo/jaxrs/server/Order.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/src/demo/jaxrs/server/Order.java?rev=605598&r1=605597&r2=605598&view=diff
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/src/demo/jaxrs/server/Order.java (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/src/demo/jaxrs/server/Order.java Wed Dec 19 07:59:54 2007
@@ -31,6 +31,10 @@
private String description;
private Map<Long, Product> products = new HashMap<Long, Product>();
+ public Order() {
+ init();
+ }
+
public long getId() {
return id;
}
@@ -51,14 +55,14 @@
@UriTemplate("products/{productId}/")
public Product getProduct(@UriParam("productId")int productId) {
System.out.println("----invoking getProduct with id: " + productId);
-
- return products.get(new Long(productId));
+ Product p = products.get(new Long(productId));
+ return p;
}
final void init() {
Product p = new Product();
- p.setId(1);
- p.setDescription("product 1");
+ p.setId(323);
+ p.setDescription("product 323");
products.put(p.getId(), p);
}
}