@Retention(value=CLASS)
@Target(value={METHOD,TYPE})
public @interface Accept
Use on Get
, Post
, … annotated methods to negotiate the
response format expected, and so the converter to use.
The annotation value()
is mandatory and define the media type to
accept. We provide a MediaType
class to help you.
Example :@Rest(rootUrl = "http://myserver", converters = { MappingJacksonHttpMessageConverter.class, SimpleXmlHttpMessageConverter.class }) public interface MyRestClient { @Get("/events/{id}") @Accept(MediaType.APPLICATION_JSON) Event getEvent(long id); @Post("/entity") @Accept(MediaType.APPLICATION_XML) Event addEvent(Event event); }
Modifier and Type | Required Element and Description |
---|---|
java.lang.String |
value |
Copyright © 2010-2014. All Rights Reserved.