Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-8422

Rest DSL not resolving same endpoint with different methods

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.14.0
    • 2.14.1
    • camel-servlet
    • None
    • Unknown

    Description

      Using the Java REST DSL we are having problems setting up a route for all HTTP methods using the same endpoint. It seems that when we use the same URL for the delete, post and put only the Delete method actually works. In the below example the GET and DELETE work fine but the PUT and POST do not. If we change these to be unique URL's they then work.

      Route
      rest("/registrations")
      .get("/").to("direct:listRegistration")
      .delete("/

      {id}").to("direct:deleteRegistration")
      .post("/{id}

      ").to("direct:createRegistration")
      .put("/

      {id}

      ").to("direct:updateRegistation");

      web.xml

      <!-- Camel servlet -->
      <servlet>
      <servlet-name>CamelServlet</servlet-name>
      <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
      </servlet>

      <!-- Camel servlet mapping -->
      <servlet-mapping>
      <servlet-name>CamelServlet</servlet-name>
      <url-pattern>/camel/*</url-pattern>
      </servlet-mapping>

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              glencollins1888 Glen Collins
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: