Codehaus XFire
DocumentationQuicklinksDevelopers
Sponsors |
This page is for brainstorming how REST support should work in XFire (or possibly a new project if xfire ends up being too heavy weight). Dan's First TakeCreating a Servicepublic class CustomerService { @RestMethod(methods={HttpMethod.GET}) Customer getCustomer(String id); @RestMethod(methods={HttpMethod.DELETE}) void deleteCustomer(String id); @RestMethod(methods={HttpMethod.POST}) @WebResult(name="customerId") String addCustomer(Customer customer); @RestMethod(method={HttpMethod.PUT}) void updateCustomer(Customer customer); } public enum HttpMethod { DELETE, GET, PUT, POST } Mapping data to method parametersThe information to invoke our service could come from a number of places:
Mapping the Operations to URIsThis could be done in the interface a couple different ways. At the class level: @RestService(uri="/customer/") public class CustomerService { ... } At the method level public class CustomerService { @RestMethod(methods={HttpMethod.GET}, uri="/customer") Customer getCustomer(String id); ... } At the service registration level: CustomerService customerService = ...; ServiceRegistry registry = ...; registry.register("/internal-customers", customerService); registry.register("/external-customers", anotherCustomerService); Questions
|