camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hadrian Zbarcea <hzbar...@gmail.com>
Subject Re: [DISCUSS] Should camel enforce usage of proper URIs?
Date Thu, 21 Jun 2012 12:53:16 GMT
In theory yes, that's how it kinda worked for many years. In practice it 
fails for all sorts of edge cases. The code that actually could be very 
simple and clear is riddled with all sorts hacks. Look at the code.

Hadrian

On 06/21/2012 07:46 AM, Henryk Konsek wrote:
>> It seems that you want to force incompatibly between Camel 2.x and 3.0
>> which is a NOT "a no brainer" for me.
>
> Good point. We will end up with ugly and backward incompatible URIs.
>
> What about introducing "implicit URI encoding" term? Can't we just
> assume that semi-URIs strings passed to the Camel DSLs are in fact
> decoded URIs?
>
> In such case:
>
> import org.springframework.web.util.UriUtils;
> // Decoded URI passed to the component.
> String decodedUri =
> "file://inbox?expression=backup/${date:now:yyyyMMdd}/${file:name}";
> // If we encode this URI we will end up with valid URI:
> // file://inbox?expression=backup/$%7Bdate:now:yyyyMMdd%7D/$%7Bfile:name%7D
> String encodedUri = UriUtils.encodeUri(decodedUri, "UTF-8");
>
> Maybe we just could validate that URI passed to the component is valid
> AFTER encoding it?
>
> String decodedUriFromDsl = ...
> String encodedUri = UriUtils.encodeUri(decodedUriFromDsl, "UTF-8");
> assertValidUri(encodedUri);
>
> This will guarantee that Camel uses valid URIs but won't break
> contract of many existing components.
>

Mime
View raw message