| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
package com.ozacc.mail.fetch.impl.sk_jp; |
| 7 |
|
|
| 8 |
|
import java.io.IOException; |
| 9 |
|
|
| 10 |
|
import javax.mail.MessagingException; |
| 11 |
|
import javax.mail.Part; |
| 12 |
|
import javax.mail.internet.ContentType; |
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
0 |
public class HtmlPartExtractor implements PartHandler { |
| 21 |
|
|
| 22 |
0 |
private String html = null; |
| 23 |
|
|
| 24 |
|
public boolean processPart(Part part, ContentType context) throws MessagingException, |
| 25 |
|
IOException { |
| 26 |
0 |
if (!part.isMimeType("text/html")) { |
| 27 |
0 |
return true; |
| 28 |
|
} |
| 29 |
0 |
if (html == null) { |
| 30 |
|
|
| 31 |
0 |
html = (String)MultipartUtility.getContent(part); |
| 32 |
|
} else { |
| 33 |
0 |
String disposition = part.getDisposition(); |
| 34 |
0 |
if (disposition == null || disposition.equalsIgnoreCase(Part.INLINE)) { |
| 35 |
0 |
html += "\r\n\r\n-- inline --\r\n\r\n" + (String)MultipartUtility.getContent(part); |
| 36 |
|
} |
| 37 |
|
} |
| 38 |
0 |
return true; |
| 39 |
|
} |
| 40 |
|
|
| 41 |
|
public String getHtml() { |
| 42 |
0 |
return html; |
| 43 |
|
} |
| 44 |
|
|
| 45 |
|
} |