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