You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Tadayoshi Sato (JIRA)" <ji...@apache.org> on 2019/01/17 05:34:00 UTC

[jira] [Comment Edited] (CAMEL-12982) Add support for alternative RAW() syntax

    [ https://issues.apache.org/jira/browse/CAMEL-12982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16744700#comment-16744700 ] 

Tadayoshi Sato edited comment on CAMEL-12982 at 1/17/19 5:33 AM:
-----------------------------------------------------------------

I understand that diverging ideas without clear needs isn't good at this moment. Meanwhile, at least there is a need that a user occasionally wants to use RAW values like {{foo)&+bar}} in the URI, so let's go back and stick to this original request and support RAW{} syntax to solve it. A pull req will follow soon.

While working on the fix, I learned the current limitations (including my fix) of RAW syntax handling in Camel. Let me write them down here:

Currently Camel supports RAW() syntax in two parts of the endpoint URI: 1) query part and 2) host/path part.

# Query part: e.g. {{?password=RAW(p+?%w0rd)&username=scott}}
** In this part almost every character is allowed, including ')' and '}'. If you want to use ')&' or '}&' inside RAW then use the other brackets, i.e. RAW{..} for ')&' and RAW(..) for '}&'.
** RAW can be used only in the value of a query. A key cannot be notated with RAW. If you use RAW in value, use it entirely. Partial usage such as {{password=RAW(%%%)bar&...}} is not allowed.
** Implementation details: The query scanner detects the occurrence of ')&' or '}&' as the closing of each RAW token.
# Host/path part: e.g. {{mock:RAW(se+ret)+language:xpath:/order/@uri}}
** I don't know when it's useful but for some components usages of RAW syntax in the URI are allowed (e.g. mock component).
** However, unlike the query part, it's not possible to use RAW(foo)bar) or RAW\{foo\}bar\} in this part. It's still possible to use RAW(foo\}bar) and RAW\{foo)bar\} though.
** Implementation details: This is because the scanner cannot rely on ')&' or '}&' for the closing mark in host/path part and thus picks up the first occurrence of the closing bracket as the closing.


was (Author: tadayosi):
I understand that diverging ideas without clear needs isn't good at this moment. Meanwhile, at least there is a need that a user occasionally wants to use RAW values like {{foo)&+bar}} in the URI, so let's go back and stick to this original request and support RAW{} syntax to solve it. A pull req will follow soon.

While working on the fix, I learned the current limitations (including my fix) of RAW syntax handling in Camel. Let me write them down here:

Currently Camel supports RAW() syntax in two parts of the endpoint URI: 1) query part and 2) host/path part.

# Query part: e.g. {{?password=RAW(p+?%w0rd)&username=scott}}
** In this part almost every character is allowed, including ')' and '}'. If you want to use ')&' or '}&' inside RAW then use the other brackets, i.e. RAW{..} for ')&' and RAW(..) for '}&'.
** RAW can be used only in the value of a query. A key cannot be notated with RAW. If you use RAW in value, use it entirely. Partial usage such as {{password=RAW(%%%)bar&...}} is not allowed.
** Implementation details: The query scanner detects the occurrence of ')&' or '}&' as the closing of each RAW token.
# Host/path part: e.g. {{mock:RAW(se+ret)+language:xpath:/order/@uri}}
** I don't know when it's useful but for some components usages of RAW syntax in the URI are allowed (e.g. mock component).
** However, unlike the query part, it's not possible to use RAW(foo)bar) or RAW{foo}bar} in this part. It's still possible to use RAW(foo}bar) and RAW{foo)bar} though.
** Implementation details: This is because the scanner cannot rely on ')&' or '}&' for the closing mark in host/path part and thus picks up the first occurrence of the closing bracket as the closing.

> Add support for alternative RAW() syntax
> ----------------------------------------
>
>                 Key: CAMEL-12982
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12982
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Tadayoshi Sato
>            Priority: Major
>             Fix For: 3.0.0, 2.24.0
>
>
> In some edge case you may have a password=foo)+bar which you want to use as-is. The + sign gets escaped and therefore you need to use RAW syntax. But the closing paranthesis is used the first one. And the parser is not always smart enough. But this can be tricky to improve as you can use &a=v as will and the parser thinks its a new option etc.
> So instead we should add an alternative syntax such as RAW{} where we use curly brackets.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)