Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Won't Fix
-
2.24.0, 2.25.1, 3.4.1
-
None
-
None
-
Unknown
Description
Presence of a "rest:" route that uses URL templates breaks a regular "jetty:" route that has "?matchOnUriPrefix=true&httpMethodRestrict=GET" attributes.
Looks like CAMEL-11951 wasn't fixed.
How to check:
// this magic route doesn't work if all of the subsequent routes are present // interestingly, it catches anything starting with "res" ignoring the "/" after it from("jetty:http://0.0.0.0:8686/res/?matchOnUriPrefix=true&httpMethodRestrict=GET") .setBody().mvel("'RESOURCE GET path: ' + exchange.in.request.requestURI"); // a catch all route that needs to be here always from("jetty:http://0.0.0.0:8686?matchOnUriPrefix=true&httpMethodRestrict=GET") .setBody().mvel("'ROOT GET path: ' + exchange.in.request.requestURI"); // a catch all POST route // if you comment out this, you will get 404 for the "magic" route instead of 405 from("jetty:http://0.0.0.0:8686?matchOnUriPrefix=true&httpMethodRestrict=POST") .setBody(constant("ROOT POST")); // if this route is commented out, the magic route starts woking, otherwise the magic route produces 405 from("rest:get:/test/{test}") .setBody(simple("SOPHISTICATED REST. Header: ${header.test}")); // this rest service doesn't break the magic route. from("rest:get:/dumb") .setBody(simple("DUMB REST")); Tested with Camel 2.25.1 and 3.4.1, but more interested in fixing ver. 2.x
Run this and see the 405 error for any request starting from "/res".
Comment out "rest:get:/test/{test}" and see the "/res/ route starting working.
(As per requirements, the first three routes in this example have to stay first as in the big application other routes are added dynamically.)
Attached is a java file with the main method to test.