Skip to content

Commit

Permalink
Support "DecodeMonitor" attribute in the default messageservicefactory.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/james/mime4j/trunk@1147963 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Stefano Bagnara committed Jul 18, 2011
1 parent a65c016 commit 912f629
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -18,6 +18,7 @@
****************************************************************/
package org.apache.james.mime4j.message;

import org.apache.james.mime4j.codec.DecodeMonitor;
import org.apache.james.mime4j.dom.MessageBuilder;
import org.apache.james.mime4j.dom.MessageServiceFactory;
import org.apache.james.mime4j.dom.MessageWriter;
Expand All @@ -35,6 +36,7 @@ public class MessageServiceFactoryImpl extends MessageServiceFactory {
private BodyFactory bodyFactory = null;
private MimeConfig mimeEntityConfig = null;
private BodyDescriptorBuilder bodyDescriptorBuilder = null;
private DecodeMonitor decodeMonitor = null;
private Boolean flatMode = null;
private Boolean contentDecoding = null;

Expand All @@ -46,6 +48,7 @@ public MessageBuilder newMessageBuilder() {
if (bodyDescriptorBuilder != null) m.setBodyDescriptorBuilder(bodyDescriptorBuilder);
if (flatMode != null) m.setFlatMode(flatMode.booleanValue());
if (contentDecoding != null) m.setContentDecoding(contentDecoding.booleanValue());
if (decodeMonitor != null) m.setDecodeMonitor(decodeMonitor);
return m;
}

Expand All @@ -66,12 +69,17 @@ public void setAttribute(String name, Object value)
if (value instanceof MimeConfig) {
this.mimeEntityConfig = (MimeConfig) value;
return;
} else throw new IllegalArgumentException("Unsupported attribute value type for "+name+", expected a MimeEntityConfig");
} else throw new IllegalArgumentException("Unsupported attribute value type for "+name+", expected a MimeConfig");
} else if ("MutableBodyDescriptorFactory".equals(name)) {
if (value instanceof BodyDescriptorBuilder) {
this.bodyDescriptorBuilder = (BodyDescriptorBuilder) value;
return;
} else throw new IllegalArgumentException("Unsupported attribute value type for "+name+", expected a MutableBodyDescriptorFactory");
} else if ("DecodeMonitor".equals(name)) {
if (value instanceof DecodeMonitor) {
this.decodeMonitor = (DecodeMonitor) value;
return;
} else throw new IllegalArgumentException("Unsupported attribute value type for "+name+", expected a DecodeMonitor");
} else if ("FlatMode".equals(name)) {
if (value instanceof Boolean) {
this.flatMode = (Boolean) value;
Expand Down

0 comments on commit 912f629

Please sign in to comment.