You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2020/08/02 08:07:00 UTC
[jira] [Updated] (CAMEL-15363) jetty:....?matchOnUriPrefix in
combination with rest: gives 404 or 405
[ https://issues.apache.org/jira/browse/CAMEL-15363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen updated CAMEL-15363:
--------------------------------
Priority: Minor (was: Major)
> jetty:....?matchOnUriPrefix in combination with rest: gives 404 or 405
> ----------------------------------------------------------------------
>
> Key: CAMEL-15363
> URL: https://issues.apache.org/jira/browse/CAMEL-15363
> Project: Camel
> Issue Type: Bug
> Components: camel-http-common
> Affects Versions: 2.24.0, 2.25.1, 3.4.1
> Reporter: Fyodor Kravchenko
> Priority: Minor
> Attachments: Main.java
>
>
> 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:
> {code:java}
> // 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 {code}
> 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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)