Example usage for org.springframework.integration.mail MailTransportUtils toPasswordProtectedString

List of usage examples for org.springframework.integration.mail MailTransportUtils toPasswordProtectedString

Introduction

In this page you can find the example usage for org.springframework.integration.mail MailTransportUtils toPasswordProtectedString.

Prototype

public static String toPasswordProtectedString(URLName name) 

Source Link

Document

Returns a string representation of the given URLName , where the password has been protected.

Usage

From source file:org.springframework.integration.mail.AbstractMailReceiver.java

private void openSession() throws MessagingException {
    if (this.session == null) {
        if (this.javaMailAuthenticator != null) {
            this.session = Session.getInstance(this.javaMailProperties, this.javaMailAuthenticator);
        } else {//  ww  w  . j av  a  2 s .  com
            this.session = Session.getInstance(this.javaMailProperties);
        }
    }
    if (this.store == null) {
        if (this.url != null) {
            this.store = this.session.getStore(this.url);
        } else if (this.protocol != null) {
            this.store = this.session.getStore(this.protocol);
        } else {
            this.store = this.session.getStore();
        }
    }
    if (!this.store.isConnected()) {
        if (logger.isDebugEnabled()) {
            logger.debug(
                    "connecting to store [" + MailTransportUtils.toPasswordProtectedString(this.url) + "]");
        }
        this.store.connect();
    }
}

From source file:org.springframework.integration.mail.AbstractMailReceiver.java

protected void openFolder() throws MessagingException {
    this.openSession();
    if (this.folder == null) {
        this.folder = obtainFolderInstance();
    }//from  w  w  w . j av a2 s. c  om
    if (this.folder == null || !this.folder.exists()) {
        throw new IllegalStateException("no such folder [" + this.url.getFile() + "]");
    }
    if (this.folder.isOpen()) {
        return;
    }
    if (logger.isDebugEnabled()) {
        logger.debug("opening folder [" + MailTransportUtils.toPasswordProtectedString(this.url) + "]");
    }
    this.folder.open(this.folderOpenMode);
}