org.androidannotations.annotations.rest
Annotation Type Accept


@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);
 }
 

See Also:
Rest, Get, Post, Put, Delete, Head, Options

Required Element Summary
 String value
           
 

Element Detail

value

public abstract String value


Copyright © 2010-2014. All Rights Reserved.