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

Restlet GET request should not trying to stringify the exchange body

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.16.2
    • 2.16.3, 2.17.0
    • camel-restlet
    • None
    • Unknown

    Description

      When sending a restlet GET request, the body should not be looked at at all.

      Currently In my exchange i have a java object in the body, and i send a restlet GET request, i expect the restlet response to replace whatever is in the body. But i get a type conversion error because it is trying to stringify the java object before sending the get request.

      I think the body should only be used in PUT and POST request.

      Here is the fix in org.apache.camel.component.restlet.DefaultRestletBinding.java line 151:

      public void populateRestletRequestFromExchange(Request request, Exchange exchange) {
      request.setReferrerRef("camel-restlet");
      String body = null;
      if(request.getMethod() == Method.POST || request.getMethod() == Method.PUT)

      { body = exchange.getIn().getBody(String.class); }

      Form form = new Form();
      // add the body as the key in the form with null value
      form.add(body, null);

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              jmandawg Jay mann
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: