Sounds perfect. That's exactly what I had in mind. You are proposing the
extra setting, which I am perfectly fine with.
Thanks a bunch,
Hadrian
On 06/21/2012 01:00 PM, Hiram Chirino wrote:
How about we add setting to the camel context which controls if the
'UnsafeUriCharactersEncoder.encode' method is used or not?
That way folks that feel that their camel configurations MUST always use
valid URI syntax can enable it. And the rest can continue to use the
current behavior.
Users are then in control.
On Thu, Jun 21, 2012 at 8:53 AM, Hadrian Zbarcea<hzbar...@gmail.com> wrote:
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.