@Retention(value=CLASS)
@Target(value=METHOD)
public @interface Get
Use on methods in Rest
annotated class to add a new rest service of
type GET.
The annotation value()
is mandatory and define the URI or the full
URL of the web service. It MAY contain placeholders defined as follow :
{name}
The annotated method MAY have parameters as soon as each parameter names are present as placeholders in the URI.
The annotated method CAN return void
,
ResponseEntity
or any concrete java classes.
Interfaces CAN'T be used as return type because converters have to know which
object to instantiate while returning result.
Note: Generics classes are also supported both for return type and parameters.
Example :@Rest(rootUrl = "http://myserver", converters = MappingJacksonHttpMessageConverter.class) public interface MyRestClient { @Get("/events") EventList getEvents(); @Get("/events/{max}") ResponseEntity<EventList> getEvents(int max); @Get("/events/{max}/{filter}") ArrayList<Event> getEvents(int max, String filter); }
Modifier and Type | Required Element and Description |
---|---|
java.lang.String |
value |
Copyright © 2010-2014. All Rights Reserved.