camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henryk Konsek <hekon...@gmail.com>
Subject Re: [DISCUSS] Should camel enforce usage of proper URIs?
Date Thu, 21 Jun 2012 11:46:26 GMT
> 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.

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com

Mime
View raw message