Hi everyone,

I would like to let users of my REST API to specify the response
format using ".json" or ".xml". I tried the following configuration,
but it does not recognize "content-type" as a parameter.

        rest("products/").description("Products API")
            .get("{shortcode}/memo.{content-type}")
                .consumes(appJsonXml).produces(appJsonXml)
                .bindingMode(RestBindingMode.json_xml)
                .param().name("shortcode").type(RestParamType.path).endParam()
                .param().name("content-type").type(RestParamType.path)
                        .allowableValues("xml", "json")
                        .endParam()
                .outType(ProductMemo.class)
                .to("direct:products/memo")

It works when I define "memo.json" and "memo.xml" as separate routes,
but I don't want to maintain all routes twice; and it works with
"memo/{content-type}", but that's not the standard URL format.

Is there any to enable the dot as a parameter separator?

Best regards,
Arian

Reply via email to