Class MultipartMimeUtils
- java.lang.Object
-
- com.google.apphosting.utils.servlet.MultipartMimeUtils
-
public class MultipartMimeUtils extends Object
MultipartMimeUtilsis a collection of static utility clases that facilitate the parsing of multipart/form-data and multipart/mixed requests using theMimeMultipartclass provided by JavaMail.
-
-
Constructor Summary
Constructors Constructor Description MultipartMimeUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DataSourcecreateDataSource(String contentType, byte[] data)Create a read-onlyDataSourcewith the specific content type and body.static StringgetFieldName(javax.mail.BodyPart part)Extract the form name from the Content-Disposition in a multipart/form-data request.static StringgetTextContent(javax.mail.BodyPart part)Extract the text content for aBodyPart, assuming the default encoding.static javax.mail.internet.MimeMultipartparseMultipartRequest(javax.servlet.http.HttpServletRequest req)Parse the request body and return aMimeMultipartrepresenting the request.
-
-
-
Method Detail
-
parseMultipartRequest
public static javax.mail.internet.MimeMultipart parseMultipartRequest(javax.servlet.http.HttpServletRequest req) throws IOException, javax.mail.MessagingExceptionParse the request body and return aMimeMultipartrepresenting the request.- Throws:
IOExceptionjavax.mail.MessagingException
-
createDataSource
public static DataSource createDataSource(String contentType, byte[] data)
Create a read-onlyDataSourcewith the specific content type and body.
-
getFieldName
public static String getFieldName(javax.mail.BodyPart part) throws javax.mail.MessagingException
Extract the form name from the Content-Disposition in a multipart/form-data request.- Throws:
javax.mail.MessagingException
-
getTextContent
public static String getTextContent(javax.mail.BodyPart part) throws javax.mail.MessagingException, IOException
Extract the text content for aBodyPart, assuming the default encoding.- Throws:
javax.mail.MessagingExceptionIOException
-
-