dcsimg
Adding/Removing Bodyparts in MultiPart object
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ashok_Naidu
Posted On:   Friday, October 19, 2001 04:57 AM

I need to filter Multipart object which contains text/plain, do some text formating on it and mail the entire formated Multipart content. I intend to do this by removing only the text/plain bodypart, make changes and add it back to the particular index of the Multipart object. The code below which takes care of nested messages is not able to remove the BodyPart (returns false) What could have gone wrong? And is my program flow correct or could i do it in a easier way. By the way, i am using POP3/Tomcat public void FilterPart(Multipart multipart, Part part) { try { if(part.isMimeType("multipart/*")) { Multipart mp = (Multi   More>>

I need to filter Multipart object which contains text/plain, do some text formating
on it and mail the entire formated Multipart content. I intend to do this by removing
only the text/plain bodypart, make changes and add it back to the particular index
of the Multipart object. The code below which takes care of nested messages is
not able to remove the BodyPart (returns false) What could have gone wrong? And
is my program flow correct or could i do it in a easier way. By the way, i am
using POP3/Tomcat

			
				
public void FilterPart(Multipart multipart, Part part)
{
try
{
if(part.isMimeType("multipart/*"))
{
Multipart mp = (Multipart)part.getContent();

for (int j=0; j gr8 mp.getCount(); j++)
{
Part apart=mp.getBodyPart(j);
FilterPart(mp,apart);
}
}
else

if( part.getContentType("text/plain") )
System.out.println( multipart.removeBodyPart((BodyPart)part) );
}
catch(ClassCastException e){}
catch(Exception ef) {}
}

   <<Less
About | Sitemap | Contact