Camel Olingo2 parses the URI?

I'm trying to run a Camel Olingo2 route to an OData service with a top, format and filter queryParams, but the Olingo component isn't encoding the params so it throws an URISyntaxException, and if I encode the params before calling the Component then the param will return as invalid, is there any way to use a filter param with the Olingo2 component?

Example:

Route Example
from("timer://camelpoll?period=120000")
    .id("PersonPoll")
    .log("CAMEL_POLLING_IN_PROGRESS")
    .setHeader("CamelOlingo2.$top", constant("5"))
    .setHeader("CamelOlingo2.$format", constant("json"))
    .setHeader("CamelOlingo2.$filter", constant("Timestamp gt datetime'2014-06-26T03:30:00.000'"))
    .to("olingo2://read/Persons");
Error log
Caused by: java.lang.IllegalArgumentException: Illegal character in query at index 131: https://<hostname>/Persons/?$top=5&$filter=Timestamp gt datetime'2014-06-26T03:30:00.000'&$format=json
    at java.net.URI.create(URI.java:852) ~[na:1.8.0_45]
    at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:69) ~[httpclient-4.5.2.jar:4.5.2]
    at org.apache.camel.component.olingo2.api.impl.Olingo2AppImpl.read(Olingo2AppImpl.java:190) ~[camel-olingo2-api-2.17.1.jar:2.17.1]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45]
    at org.apache.camel.util.component.ApiMethodHelper.invokeMethod(ApiMethodHelper.java:461) ~[camel-core-2.17.1.jar:2.17.1]
    ... 13 common frames omitted
Caused by: java.net.URISyntaxException: Illegal character in query at index 131: https://<hostname>/Persons/?$top=5&$filter=Timestamp gt datetime'2014-06-26T03:30:00.000'&$format=json
    at java.net.URI$Parser.fail(URI.java:2848) ~[na:1.8.0_45]
    at java.net.URI$Parser.checkChars(URI.java:3021) ~[na:1.8.0_45]
    at java.net.URI$Parser.parseHierarchical(URI.java:3111) ~[na:1.8.0_45]
    at java.net.URI$Parser.parse(URI.java:3053) ~[na:1.8.0_45]
    at java.net.URI.<init>(URI.java:588) ~[na:1.8.0_45]
    at java.net.URI.create(URI.java:850) ~[na:1.8.0_45]
    ... 20 common frames omitted

Answers


Well, looks like the olingo2 component has an issue so I had to create a custom component to achieve this.


Need Your Help

How can I display all object values in one NSTableCellView?

objective-c cocoa nstableview nstablecellview

I have a Product object but as of right now I can only print one of its values in each table cell view. I want to display all the contents of my object in one cell. When I try to add another valu...

C: corrupted pointer from push function?

c associative-array

I'm having trouble with a pointer that changes value as its passed to a function… I have various print statements scattered throughout that confirm that the value of the pointer doesn't change, jus...