Christian Holzer created OLINGO-577:
---------------------------------------

             Summary: Invalid escaping of space characters
                 Key: OLINGO-577
                 URL: https://issues.apache.org/jira/browse/OLINGO-577
             Project: Olingo
          Issue Type: Bug
          Components: odata4-client
    Affects Versions: (Java) V4 4.0.0-beta-03
            Reporter: Christian Holzer
            Priority: Minor


Hi,

I've noticed an issue while building of URIs with the OData Client. I used the 
following snipped:

final ODataClient client = getClient();
    final String filter = client.getFilterFactory().eq(
        client.getFilterFactory().getArgFactory().property("PropertyString"),
        client.getFilterFactory().getArgFactory().literal("First Resource - 
positive values")).build();

    final URI uri = client.newURIBuilder(SERVICE_URI)
        .appendEntitySetSegment(ES_ALL_PRIM)
        .filter(filter)
        .build();

    final ODataRetrieveResponse<ODataEntitySet> response = 
client.getRetrieveRequestFactory()
        .getEntitySetRequest(uri).execute();
The request has the uses the following URI:
/odata-server-tecsvc/odata.svc/ESAllPrim?%24filter=%28PropertyString+eq+%27First+Resource+-+positive+values%27%29

In OData Version 4.0 Part 2: URL Conventions Plus Errata 02 is mentioned that 
OData follows RFC 3986 and uses percent-decoding exactly ones. RFC 3986 says “A 
percent-encoding mechanism is used to represent a data octet in a component 
when that octet's corresponding character is outside the allowed set…” The 
allowed set in the query component is described as 
query = *( pchar / "/" / "?" )
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
pct-encoded = "%" HEXDIG HEXDIG
sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
                 / "*" / "+" / "," / ";" / "="

So  up the this rules the space character has to be encoded as %20 instead of +.

Kind regards
Christian







--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to