You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by James M Snell <ja...@gmail.com> on 2006/08/09 00:22:34 UTC
Client code
Ok, so I've got the new client code running to a point where we can use
it with basic Atom Publishing servers. For instance, we can point it at
Queso and things just work...
Client client = new CommonsClient();
String uri = "http://abdera.watson.ibm.com:8080/atom/abdera";
Entry entry = Factory.INSTANCE.newEntry();
entry.setId(FOMHelper.generateUuid());
entry.setTitle("this is a test");
entry.setUpdated(new Date());
entry.addAuthor("James");
entry.addLink("http://example.org/foo");
entry.setContent("this is a test");
// Create the entry
Response response = client.post(uri, entry);
System.out.println(response.getStatus());
System.out.println(response.getLocation());
System.out.println(response.getContentLocation());
uri = response.getLocation();
// Edit the entry
Document<Entry> entry_doc = client.get(uri).getDocument();
entry_doc.getRoot().setTitle("this is the changed title");
response = client.put(uri, entry_doc.getRoot());
System.out.println(response.getStatus());
// Delete the entry
response = client.delete(uri);
System.out.println(response.getStatus());
// Verify that it's gone
response = client.get(uri);
System.out.println(response.getStatus());
We still need to fully exercise and debug the caching code, but things
appear to be minimally functional enough to get real stuff done.
- James