Search in sources :

Example 1 with NekoHTMLFilter

use of org.olat.core.util.filter.impl.NekoHTMLFilter in project OpenOLAT by OpenOLAT.

the class XmlDocument method readContent.

// fxdiff FXOLAT-97: index run in infinite loop
protected FileContent readContent(VFSLeaf leaf) throws IOException {
    InputStream is = leaf.getInputStream();
    // Remove all HTML and   Tags
    NekoContent output;
    try {
        output = new NekoHTMLFilter().filter(is);
        if (log.isDebug())
            log.debug("HTML content without tags :" + output);
    } catch (Exception e) {
        throw new IOException(e);
    } finally {
        FileUtils.closeSafely(is);
    }
    return new FileContent(output.getTitle(), output.getContent());
}
Also used : NekoHTMLFilter(org.olat.core.util.filter.impl.NekoHTMLFilter) InputStream(java.io.InputStream) NekoContent(org.olat.core.util.filter.impl.NekoHTMLFilter.NekoContent) IOException(java.io.IOException) IOException(java.io.IOException)

Example 2 with NekoHTMLFilter

use of org.olat.core.util.filter.impl.NekoHTMLFilter in project OpenOLAT by OpenOLAT.

the class MailManagerImpl method createMultipartAlternative.

private Multipart createMultipartAlternative(String text) throws MessagingException {
    String pureText = new NekoHTMLFilter().filter(text, true);
    MimeBodyPart textPart = new MimeBodyPart();
    textPart.setText(pureText, "utf-8");
    MimeBodyPart htmlPart = new MimeBodyPart();
    htmlPart.setText(text, "utf-8", "html");
    Multipart multipart = new MimeMultipart("alternative");
    multipart.addBodyPart(textPart);
    multipart.addBodyPart(htmlPart);
    return multipart;
}
Also used : NekoHTMLFilter(org.olat.core.util.filter.impl.NekoHTMLFilter) MimeMultipart(javax.mail.internet.MimeMultipart) Multipart(javax.mail.Multipart) MimeMultipart(javax.mail.internet.MimeMultipart) MimeBodyPart(javax.mail.internet.MimeBodyPart)

Example 3 with NekoHTMLFilter

use of org.olat.core.util.filter.impl.NekoHTMLFilter in project openolat by klemens.

the class XmlDocument method readContent.

// fxdiff FXOLAT-97: index run in infinite loop
protected FileContent readContent(VFSLeaf leaf) throws IOException {
    InputStream is = leaf.getInputStream();
    // Remove all HTML and   Tags
    NekoContent output;
    try {
        output = new NekoHTMLFilter().filter(is);
        if (log.isDebug())
            log.debug("HTML content without tags :" + output);
    } catch (Exception e) {
        throw new IOException(e);
    } finally {
        FileUtils.closeSafely(is);
    }
    return new FileContent(output.getTitle(), output.getContent());
}
Also used : NekoHTMLFilter(org.olat.core.util.filter.impl.NekoHTMLFilter) InputStream(java.io.InputStream) NekoContent(org.olat.core.util.filter.impl.NekoHTMLFilter.NekoContent) IOException(java.io.IOException) IOException(java.io.IOException)

Example 4 with NekoHTMLFilter

use of org.olat.core.util.filter.impl.NekoHTMLFilter in project openolat by klemens.

the class MailManagerImpl method createMultipartAlternative.

private Multipart createMultipartAlternative(String text) throws MessagingException {
    String pureText = new NekoHTMLFilter().filter(text, true);
    MimeBodyPart textPart = new MimeBodyPart();
    textPart.setText(pureText, "utf-8");
    MimeBodyPart htmlPart = new MimeBodyPart();
    htmlPart.setText(text, "utf-8", "html");
    Multipart multipart = new MimeMultipart("alternative");
    multipart.addBodyPart(textPart);
    multipart.addBodyPart(htmlPart);
    return multipart;
}
Also used : NekoHTMLFilter(org.olat.core.util.filter.impl.NekoHTMLFilter) MimeMultipart(javax.mail.internet.MimeMultipart) Multipart(javax.mail.Multipart) MimeMultipart(javax.mail.internet.MimeMultipart) MimeBodyPart(javax.mail.internet.MimeBodyPart)

Aggregations

NekoHTMLFilter (org.olat.core.util.filter.impl.NekoHTMLFilter)4 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 Multipart (javax.mail.Multipart)2 MimeBodyPart (javax.mail.internet.MimeBodyPart)2 MimeMultipart (javax.mail.internet.MimeMultipart)2 NekoContent (org.olat.core.util.filter.impl.NekoHTMLFilter.NekoContent)2