request with accept application/xml.

0 views
Skip to first unread message

Jose Donizetti

unread,
Feb 10, 2011, 6:25:49 AM2/10/11
to restfu...@googlegroups.com
Hi, suppose that I have an controller which return an item represented as json.

@Get
@Path("/item)
public void show(){
Item item = newItem(name,10.0);
result.use(json()).from(item).serialize();
}

And I request this uri, with the accept application/xml.

Restfulie.at("http://mydomain/item").accept("application/xml").get();

Should the server response with a 200, and the content with json?

thanks,
Doni.

Guilherme Silveira

unread,
Feb 10, 2011, 7:34:07 AM2/10/11
to restfu...@googlegroups.com
Hi Doni,

Yes... when the user did:

result.use(json())

He specifically told Restfulie to use json and ignore conneg... if he wants to use connect he will do so through:

result.use(representation())...

guilherme

Guilherme Silveira
Caelum | Ensino e Inovação
http://www.caelum.com.br/
Reply all
Reply to author
Forward
0 new messages