Restler is a library that generates a client of a web service by its annotated Spring controller interface at runtime.
/** * An annotated Spring controller interface*/@Controller@RequestMapping("greeter")
publicinterfaceGreeter {
@RequestMapping("greetings/{language}") StringgetGreeting(@PathVariableStringlanguage, @RequestParam(defaultValue = "Anonimous") Stringname); }
// Consuming code Serviceservice = newService("https://www.excelsior-usa.com/api");
Greetergreeter = service.getController(Greeter.class);
Stringgreeting = greeter.getGreeting("en","Boddy"); // the result of https://www.excelsior-usa.com/api/greeter/greetings/en?name=Boddy call// Session support in consuming codeServiceservice = newService("https://www.excelsior-usa.com/api");
AuthorizationStrategyauthorizationStrategy = newLoginAuthorizationStrategy(...);
Sessionsession = service.startSession(authorizationStrategy);
Greetergreeter = service.getController(Greeter.class);
Stringgreeting = greeter.getGreeting("en","Boddy");