How to specify Restlet response format in browser?

I started introducing myself in REST. I am using REST-framework Restlet. I defined a resource with methods for GET with multiple response formats, such as

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

Now I want to test my specific response formats in my browser, but I don’t know which parameter I need to specify in my URL in order to get the format. Sort of:

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

I tried several param names, but I could not find the correct parameter name. I know that there should be such a parameter, because I saw it already in the URL, but I forgot the name and could not find it on the network. What is the name of this parameter when using restart?

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

+3
source share
3

API- Restlet, ( ash @Get). Restlet Framework API JAX-RS ( @GET, @Produces ..), .

, "media = xml" "type = xml", TunnelService Restlet.

, . , , Restlet: http://www.restlet.org/community/lists

+5

"" "text/xml" "text/json".

, mime, @Produces("text"), @GET ( ). .. , API @GET.

, URI, , - media = json

+3

I am using the example project org.restlet.example.serialization.gae.server and this thread helped me, so I made a small change (just added "json" in quotation marks and brackets) to get a JSON response:

@Get("json")
public Contact retrieve() {
    return contact;
}
0
source

Source: https://habr.com/ru/post/1743061/


All Articles