当我们使用 URI 配置 Camel 端点时,默认情况下参数值会获取 url 编码。当我们想按原样配置密码时,这可能是一个问题。
为此,我们可以告诉 Camel 使用原始值,方法是用 RAW(value) 将值括起来。 http://camel.apache.org/how-do-i-configure-endpoints.html
但这不适用于邮件端点 URI。
这是代码。
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()+"©To="+this.getMailBox()";
} catch (Exception ex){
ex.printStackTrace();
}
return url;
}
但它工作正常 aws 端点
public String getURL(){
String fromURL = "";
fromURL = "aws-sqs://" + getQueueName() + "?accessKey=" + getS3AccessKey() + "&secretKey=RAW(" + getS3SecretKey() + ")®ion=" + getQueueRegion() + "&queueOwnerAWSAccountId=" + getS3SQSAWSClientID();
return fromURL;
}
任何想法?