camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <>
Subject [jira] [Commented] (CAMEL-11951) Uri matching does not match request type
Date Tue, 31 Oct 2017 09:52:00 GMT


Claus Ibsen commented on CAMEL-11951:

It works fine when I do

      <get uri="/v1/customer/{custId}/devices" consumes="application/json" produces="application/json">
        <description>Queries all devices for a single customer</description>
        <to uri="direct:getCustomerDevices" />
      <get uri="/v1/customer/{custId}/detail" consumes="application/json" produces="application/json">
        <description>Customer detail</description>
        <to uri="direct:getCustomer" />

And then just make those routes log
    <route id="getCustomer">
      <description>Queries the customer details from the heroku server</description>
      <from uri="direct:getCustomer" />
      <log message="getCustomer detail ${header.custId}"/>
    <route id="getDevice">
      <description>Queries the device details from heroku server</description>
      <from uri="direct:getDevice" />
      <log message="getCustomer device ${header.custId}"/>

And then I call Camel via these 2 curls
davsclaus:/Users/davsclaus/Downloads/camel-bug-demo/$ curl http://localhost:8078/integration/api/v1/customer/123456/devices
davsclaus:/Users/davsclaus/Downloads/camel-bug-demo/$ curl http://localhost:8078/integration/api/v1/customer/999999/detail

Then I can see it calls different rest-dsl operation

[INFO ] 2017-10-31 10:49:23.692 [qtp1739303520-24] getCustomerDevices:159 - getCustomer devices
[INFO ] 2017-10-31 10:49:40.139 [qtp1739303520-19] getCustomer:159 - getCustomer detail 999999

> Uri matching does not match request type
> ----------------------------------------
>                 Key: CAMEL-11951
>                 URL:
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-http-common
>    Affects Versions: 2.20.0
>         Environment: camel-spring, camel-jetty
>            Reporter: Robert Hillier
>         Attachments:
> I had previously described the problem here:
> It appears that the problem is down to a possible bug in the way URIs are matched (not
to mention my rather obscure use-case)
> I have a number of REST-DSL endpoints with the same URI but different request types (POST,
PUT, GET, DELETE).  In my case, the URI is getting selected by
> HttpServletResolveConsumerStrategy.resolve (in addition to these, I have some specific
endpoints with wildcards in them)
> This method matches the URI, but not the request type.  When I send a GET request, it
returns the first consumer candidate it finds which, in my case, always seems to be PUT. 
Later, when CamelContinuationServlet.doService checks that the request type and cadidate type
match, they don't.  It then returns 405 Method Not Allowed.
> I believe that the HttpServletResolveConsumerStrategy.resolve method IN camel-hhtp-common
should check the request type as well as the URI.

This message was sent by Atlassian JIRA

View raw message