-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Welcome to the rop wiki.Rop is the most simple rest service framework base on Spring MVC 3.0. You can use it to build you EBS like the TOP(Taobao open platform) http://localhost?method=user.get&format=xml&... You will get the xml format just like:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<sampleRopResponse1 createTime="20120101010101" userId="1"/>
And get json format like:
{"sampleRopResponse1":{"userId":"1","createTime":"20120101010101"}}
The only thing you need to do just write the request class with JSR303 annotation and write response class with JSR222(JAXB) annotatoin,rop will validate the request data and generate the error response and marshalle the response use JAXB annotation. You just use the @ApiMethod to make the bean's method to be a service handler:
@Service
public class UserRestService {
@ApiMethod("sample.user.add")//②指定对应的API方法
public RopResponse addUser(CreateUserRequest request) {
CreateUserResponse response = new CreateUserResponse();
//add creaet new user here...
response.setCreateTime("20120101010101");
response.setUserId("1");
return response;
}
}
Use rop to build you rest web service is mostly simple,you can focus on you business logic,and let the rop do the remain. Please try it ,make you live easy!