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

DefaultRestletBinding can not deal with multi-valued HTTP request parameters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.14.0
    • 2.13.4, 2.14.1, 2.15.0
    • camel-restlet
    • None
    • Patch Available
    • Unknown

    Description

      Multi-valued HTTP request parameters are a common practice yet, with the provided binding, Camel Restlet component can not deal with them.
      In DefaultRestletBinding, we can see the following problematic code:

      public void populateRestletRequestFromExchange(Request request, Exchange exchange) {
      ...
           form.add(key, value.toString());
      ...
      }
      

      where the value is always treated as a String, even though it can be a Collection.

      And similarly:

      public void populateExchangeFromRestletRequest(Request request, Response response, Exchange exchange) throws Exception {
      ...
           for (Map.Entry<String, String> entry : form.getValuesMap().entrySet()) {
                ...
           }
      ...
      }
      

      where getValuesMap() effectively disregards all duplicate key names.

      Attachments

        1. DefaultRestletBinding.patch
          3 kB
          Bojan Tomic

        Activity

          People

            njiang Willem Jiang
            kaqqao Bojan Tomic
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: