List of usage examples for javax.mail URLName getFile
public String getFile()
From source file:StoreTreeNode.java
/** * We override toString() so we can display the store URLName * without the password./*from w w w.j a v a2s.com*/ */ public String toString() { if (display == null) { URLName url = store.getURLName(); if (url == null) { display = store.toString(); } else { // don't show the password URLName too = new URLName(url.getProtocol(), url.getHost(), url.getPort(), url.getFile(), url.getUsername(), null); display = too.toString(); } } return display; }
From source file:org.apache.jmeter.protocol.mail.sampler.MailFileFolder.java
public MailFileFolder(Store store, URLName path) { this(store, path.getFile()); }
From source file:org.springframework.integration.mail.MailTransportUtils.java
/** * Returns a string representation of the given {@link URLName}, where the * password has been protected./*from w w w . java 2 s .c o m*/ */ public static String toPasswordProtectedString(URLName name) { String protocol = name.getProtocol(); String username = name.getUsername(); String password = name.getPassword(); String host = name.getHost(); int port = name.getPort(); String file = name.getFile(); String ref = name.getRef(); StringBuffer tempURL = new StringBuffer(); if (protocol != null) { tempURL.append(protocol).append(':'); } if (StringUtils.hasLength(username) || StringUtils.hasLength(host)) { tempURL.append("//"); if (StringUtils.hasLength(username)) { tempURL.append(username); if (StringUtils.hasLength(password)) { tempURL.append(":*****"); } tempURL.append("@"); } if (StringUtils.hasLength(host)) { tempURL.append(host); } if (port != -1) { tempURL.append(':').append(Integer.toString(port)); } if (StringUtils.hasLength(file)) { tempURL.append('/'); } } if (StringUtils.hasLength(file)) { tempURL.append(file); } if (StringUtils.hasLength(ref)) { tempURL.append('#').append(ref); } return tempURL.toString(); }
From source file:org.springframework.ws.transport.mail.support.MailTransportUtils.java
/** Returns a string representation of the given {@link URLName}, where the password has been protected. */ public static String toPasswordProtectedString(URLName name) { String protocol = name.getProtocol(); String username = name.getUsername(); String password = name.getPassword(); String host = name.getHost(); int port = name.getPort(); String file = name.getFile(); String ref = name.getRef();//from w w w . j a va2s.c o m StringBuilder tempURL = new StringBuilder(); if (protocol != null) { tempURL.append(protocol).append(':'); } if (StringUtils.hasLength(username) || StringUtils.hasLength(host)) { tempURL.append("//"); if (StringUtils.hasLength(username)) { tempURL.append(username); if (StringUtils.hasLength(password)) { tempURL.append(":*****"); } tempURL.append("@"); } if (StringUtils.hasLength(host)) { tempURL.append(host); } if (port != -1) { tempURL.append(':').append(Integer.toString(port)); } if (StringUtils.hasLength(file)) { tempURL.append('/'); } } if (StringUtils.hasLength(file)) { tempURL.append(file); } if (StringUtils.hasLength(ref)) { tempURL.append('#').append(ref); } return tempURL.toString(); }