没有任何数据可供显示
开源项目社区 | 当前位置 : |
|
www.trustie.net/open_source_projects | 主页 > 开源项目社区 > zipwire-rest |
zipwire-rest
|
0 | 0 | 5 |
贡献者 | 讨论 | 代码提交 |
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:
2782118Zipwire Rest
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"