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

camel-olingo2 - Missing encoding for query params

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.20.1
    • Fix Version/s: 2.20.2, 2.21.0
    • Component/s: camel-olingo2
    • Labels:
      None
    • Environment:

      spring-boot

    • Patch Info:
      Patch Available
    • Estimated Complexity:
      Unknown

      Description

      Hi guys,
      i've a problem with making camel-olingo2 to work with $filter query parameter
      Here is my RouteBuilder situation

      rest("/olingo2")
                      .get("tickets").to("direct:olingo2/tickets");
      
              from("direct:olingo2/tickets")
                      .setHeader("CamelOlingo2.$filter", simple("ReporterEmail eq 'user@company.com'"))
                      .setHeader("CamelOlingo2.$select", simple("ID,Name"))
                      .to("olingo2://read/ServiceRequestCollection")
      

      I get an exception while parsing endpoint URI (a space in uri)

      {{URISyntaxException: Illegal character in query at index 107: https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codata/ServiceRequestCollection/?$filter=ReporterEmail eq 'user@company.com'&$select=ID,Name
      }}

      It comes basically from Olingo2AppImpl:224
      I tried with
      {{ .setHeader("CamelOlingo2.$filter", simple("ReporterEmail%20eq%20%27user@company.com%27"))
      }}but then it fails in Olingo2AppImpl:222 while parsing filter expression.

      As a conclusion, at Olingo2AppImpl:224 queryParams should be encoded.

      here is my patch https://github.com/przem/camel/commit/e239645cadd7130b27cb85bd713cb71140872865

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                acosentino Andrea Cosentino
                Reporter:
                _przem Przemek Kubicki
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: