You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Calle Andersson <ca...@hotmail.com> on 2021/09/22 05:43:42 UTC

REST DSL route not accepting call without slash at the end

Hi,

I use Camel 3.4 (I have to use that version) and have a problem when using REST DSL.

I have the following route:
rest().tag("dummy")
    .post()
        .route().
            .log("### Inside 'first'")
        .endRest()
    .post("tmp").
        .route()
            .log("### Inside 'second'")
        .endRest();

I also use the following configuration:
restConfiguration()
    .component("servlet")
    .endpointProperty("servletName", "CamelServletDummy");

And a context root specified in jboss-web.xml:
<context-root>services/rest/dummy</context-root>

I use the following cURL to call the REST endpoints:
curl --request POST '[MY_URL]' --header 'Accept: application/xml' --header 'Content-Type: application/xml' --data-raw 'lorem ipsum'

The routes gets invoked and logs as expected when replacing "[MY_URL]" with the following URL:s (notice the usage of slashes at the end):
localhost:8080/services/rest/dummy/tmp/
localhost:8080/services/rest/dummy/tmp
localhost:8080/services/rest/dummy/

However, I only get a HTTP 404 and the first route isn’t invoked when using the following URL (with no slash at the end):
localhost:8080/services/rest/dummy

Unfortunately, I can't shorten the context root and move "/dummy" to the REST DSL configuration (since it would interfer with other REST endpoints on the same server).

Does anyone know a way to make the failing call work?

Thanks in advance,
Calle