0

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?

NeedToLearn
  • 147
  • 1
  • 2
  • 11
  • 1
    What do you mean by "not working"? Does the password still get encoded, or do you get some URI parsing exception? It's also worth showing how the return of getURL() method is consumed. – Tadayoshi Sato Feb 06 '19 at 10:37
  • That is if I log in a logFile using log4j it display as: "imaps://outlook.office365.com?username=abc@companyname.com&password=RAW(abc@123)&folderName=in&copyTo=out" . It should come as "password = ****". This happens with "aws-sqs://... i.e password appears as asterisk". There is no exception but email does not move from in to out folder. – NeedToLearn Feb 06 '19 at 13:23

0 Answers0