Class MimeBodyPartDataSource
- java.lang.Object
-
- com.atlassian.confluence.mail.embed.MimeBodyPartDataSource
-
- All Implemented Interfaces:
javax.activation.DataSource
public class MimeBodyPartDataSource extends Object implements javax.activation.DataSource
DataSource decorator that custom-URL-encodes the name for use with a MimeBodyPart.
-
-
Constructor Summary
Constructors Constructor Description MimeBodyPartDataSource(javax.activation.DataSource source)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
encode(String str)
Plugin datasources often include : as a separator, e.g.String
getContentType()
InputStream
getInputStream()
String
getName()
OutputStream
getOutputStream()
javax.activation.DataSource
getWrappedSource()
-
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getName
in interfacejavax.activation.DataSource
-
getInputStream
public InputStream getInputStream() throws IOException
- Specified by:
getInputStream
in interfacejavax.activation.DataSource
- Throws:
IOException
-
getOutputStream
public OutputStream getOutputStream() throws IOException
- Specified by:
getOutputStream
in interfacejavax.activation.DataSource
- Throws:
IOException
-
getContentType
public String getContentType()
- Specified by:
getContentType
in interfacejavax.activation.DataSource
-
getWrappedSource
public javax.activation.DataSource getWrappedSource()
-
encode
public static String encode(String str)
Plugin datasources often include : as a separator, e.g. plugin.name:module.key:resource.key. These strings need escaping before they can be used in MIME part headers. 1. However, plugin keys may include other characters not permitted in URLs, so we must do a URL encode. 2. However, per a few RFCs out there, escaped URLs are not expected in Content-Disposition and Content-Type filenames and names (resp.) so we replace the encoded bits and assume that nothing will conflict.
-
-