|
Project Information
Featured
Downloads
|
A lightweight implementation of the ActiveResource pattern for Java that lets you manipulate RESTful resources as Java objects. Note: Currently uses Apache the HttpClient Jar. You can get the JarsHere: Usage:for a more detailed look see the HighriseWalkthrough... Quick usage example...request: http://www.example.com/projects/2782118.xml response: <?xml version="1.0"?><project><id>2782118</id><project-name>Zipwire Rest</project-name></project> create an interface(s) to manipulate the resource interface Project {
String getId();
String getName();
}create a RestConnection object * The XmlNamingRule handles method(CamelCase) to xml (separate-word) translation. RestConnection connection = new ApacheRestConnection(
host, username, password,
new XmlNamingRule(){
public String transform(String method) {
return new CamelCase(method).separateWith("-").toLowerCase();
}}
){};get the resource via the interface Project project = connection.get("projects/2782118.xml").as(Project.class);
System.out.println(project.getId()); // ==> "2782218"
System.out.println(project.getProjectName()); // ==> "Zipwire Rest"
|