How to use Apache camel RAW(value) for password

2.4k Views Asked by At

When we configure Camel endpoints using URIs then the parameter values gets url encoded by default. This can be a problem when we want to configure passwords as is.

To do that we can tell Camel to use the raw value, by enclosing the value with RAW(value). http://camel.apache.org/how-do-i-configure-endpoints.html

But this is not working for mail endpoint URI.

Here is the code.

 public String getURL()
{
    String url = "";
    try{
        URI uri = new URI(this.emailServer.toString());

        url = "imaps://"+uri.getHost()+"?username="+this.username+"&password=RAW("+this.password+")&folderName="+this.getMailBox()+"&copyTo="+this.getMailBox()";
    } catch (Exception ex){
        ex.printStackTrace();
    }
    return url;
        }

But it is working fine aws endpoint

 public String getURL(){

    String fromURL = "";

        fromURL = "aws-sqs://" + getQueueName() + "?accessKey=" + getS3AccessKey() + "&secretKey=RAW(" + getS3SecretKey() + ")&region=" + getQueueRegion() + "&queueOwnerAWSAccountId=" + getS3SQSAWSClientID();

    return  fromURL;
}

Any idea?

0

There are 0 best solutions below