Search code examples
urlrestrestlet

Howto specify format of Restlet-response in browser?


i've started to introduce myself into REST. I use as REST-framework Restlet. I have defined a resource with methods for the GET with several response formats like

@Get("xml")
@Get("json")

I now want to test my defined response-formats with my browser, but I don't know which parameter I have to specify in my URL to get the format. Something like:

http://localhost:8182/members?type=xml

I've tried some param-names, but I couldn't find the right param-name. I know that there must be such a parameter, because I've seen it already in an URL, but i forgot the name and couldn't find it in the net. How is the name of this parameter when using restlet?

I would be pleased, if somebody can help me, thanks, Martin


Solution

  • Martin uses the Restlet API which defines its own simpler annotations (such ash @Get). The Restlet Framework does support JAX-RS API and annotations (such as @GET, @Produces, etc.) but as part of an extension.

    To select the media type in your browser you need to use the "media=xml" query parameter instead of "type=xml", but this can be configured in the TunnelService of your Restlet Application instance.

    Hope this helps. For further help, please use the Restlet mailing list: http://www.restlet.org/community/lists

    Best regards