Search in sources :

Example 1 with MockMimeTypeInfo

use of com.zimbra.cs.mime.MockMimeTypeInfo in project zm-mailbox by Zimbra.

the class MockProvisioning method initializeMimeHandlers.

private void initializeMimeHandlers() {
    MockMimeTypeInfo plain = new MockMimeTypeInfo();
    plain.setMimeTypes(MimeConstants.CT_TEXT_PLAIN);
    plain.setHandlerClass(TextPlainHandler.class.getName());
    plain.setIndexingEnabled(true);
    addMimeType(MimeConstants.CT_TEXT_PLAIN, plain);
    MockMimeTypeInfo html = new MockMimeTypeInfo();
    html.setMimeTypes(MimeConstants.CT_TEXT_HTML);
    html.setHandlerClass(TextHtmlHandler.class.getName());
    html.setFileExtensions("html", "htm");
    html.setIndexingEnabled(true);
    addMimeType(MimeConstants.CT_TEXT_HTML, html);
    MockMimeTypeInfo calendar = new MockMimeTypeInfo();
    calendar.setMimeTypes(MimeConstants.CT_TEXT_CALENDAR);
    calendar.setHandlerClass(TextCalendarHandler.class.getName());
    calendar.setIndexingEnabled(true);
    addMimeType(MimeConstants.CT_TEXT_CALENDAR, calendar);
    MockMimeTypeInfo message = new MockMimeTypeInfo();
    message.setMimeTypes(MimeConstants.CT_MESSAGE_RFC822);
    message.setHandlerClass(MessageRFC822Handler.class.getName());
    message.setIndexingEnabled(true);
    addMimeType(MimeConstants.CT_MESSAGE_RFC822, message);
}
Also used : TextCalendarHandler(com.zimbra.cs.mime.handler.TextCalendarHandler) TextPlainHandler(com.zimbra.cs.mime.handler.TextPlainHandler) MockMimeTypeInfo(com.zimbra.cs.mime.MockMimeTypeInfo) MessageRFC822Handler(com.zimbra.cs.mime.handler.MessageRFC822Handler) TextHtmlHandler(com.zimbra.cs.mime.handler.TextHtmlHandler)

Example 2 with MockMimeTypeInfo

use of com.zimbra.cs.mime.MockMimeTypeInfo in project zm-mailbox by Zimbra.

the class MockProvisioning method getMimeTypes.

@Override
public List<MimeTypeInfo> getMimeTypes(String mime) {
    List<MimeTypeInfo> result = mimeConfig.get(mime);
    if (result != null) {
        return result;
    } else {
        MockMimeTypeInfo info = new MockMimeTypeInfo();
        info.setHandlerClass(UnknownTypeHandler.class.getName());
        return Collections.<MimeTypeInfo>singletonList(info);
    }
}
Also used : MockMimeTypeInfo(com.zimbra.cs.mime.MockMimeTypeInfo) UnknownTypeHandler(com.zimbra.cs.mime.handler.UnknownTypeHandler) MimeTypeInfo(com.zimbra.cs.mime.MimeTypeInfo) MockMimeTypeInfo(com.zimbra.cs.mime.MockMimeTypeInfo)

Aggregations

MockMimeTypeInfo (com.zimbra.cs.mime.MockMimeTypeInfo)2 MimeTypeInfo (com.zimbra.cs.mime.MimeTypeInfo)1 MessageRFC822Handler (com.zimbra.cs.mime.handler.MessageRFC822Handler)1 TextCalendarHandler (com.zimbra.cs.mime.handler.TextCalendarHandler)1 TextHtmlHandler (com.zimbra.cs.mime.handler.TextHtmlHandler)1 TextPlainHandler (com.zimbra.cs.mime.handler.TextPlainHandler)1 UnknownTypeHandler (com.zimbra.cs.mime.handler.UnknownTypeHandler)1