org.apache.james.mime4j.stream
Class MimeConfig

java.lang.Object
  extended by org.apache.james.mime4j.stream.MimeConfig
All Implemented Interfaces:
java.lang.Cloneable

public final class MimeConfig
extends java.lang.Object
implements java.lang.Cloneable

Properties used to configure the behavior of MIME stream parsers.


Constructor Summary
MimeConfig()
           
 
Method Summary
 MimeConfig clone()
           
 java.lang.String getHeadlessParsing()
          Returns the value of the default content type.
 long getMaxContentLen()
          Returns the maximum content length limit
 int getMaxHeaderCount()
          Returns the maximum header limit
 int getMaxHeaderLen()
          Returns the maximum header length limit
 int getMaxLineLen()
          Returns the maximum line length limit
 boolean isCountLineNumbers()
          Returns the value of the line number counting mode.
 boolean isMalformedHeaderStartsBody()
           
 boolean isStrictParsing()
          Returns the value of the strict parsing mode
 void setCountLineNumbers(boolean countLineNumbers)
          Defines whether the parser should count line numbers.
 void setHeadlessParsing(java.lang.String contentType)
          Defines a default content type.
 void setMalformedHeaderStartsBody(boolean malformedHeaderStartsBody)
          Define the behaviour for dealing with malformed headers while in lenient mode
 void setMaxContentLen(long maxContentLen)
          Sets the maximum content length limit.
 void setMaxHeaderCount(int maxHeaderCount)
          Sets the maximum header limit.
 void setMaxHeaderLen(int maxHeaderLen)
          Sets the maximum header length limit.
 void setMaxLineLen(int maxLineLen)
          Sets the maximum line length limit.
 void setStrictParsing(boolean strictParsing)
          Defines whether minor violations of the MIME specification should be tolerated or should result in a MimeException.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MimeConfig

public MimeConfig()
Method Detail

isMalformedHeaderStartsBody

public boolean isMalformedHeaderStartsBody()
Returns:
true if malformed header should "end" the headers and be part of the body
See Also:
setMalformedHeaderStartsBody(boolean)

setMalformedHeaderStartsBody

public void setMalformedHeaderStartsBody(boolean malformedHeaderStartsBody)
Define the behaviour for dealing with malformed headers while in lenient mode

Parameters:
malformedHeaderStartsBody - true to make the parser interpret a malformed header as end of the headers and as part of the body (as if the CRLF separator was missing). false to simply ignore malformed headers and continue parsing headers from the following line.

isStrictParsing

public boolean isStrictParsing()
Returns the value of the strict parsing mode

Returns:
value of the strict parsing mode
See Also:
setStrictParsing(boolean)

setStrictParsing

public void setStrictParsing(boolean strictParsing)
Defines whether minor violations of the MIME specification should be tolerated or should result in a MimeException. If this parameter is set to true, a strict interpretation of the MIME specification will be enforced, If this parameter is set to false minor violations will result in a warning in the log.

Default value: false

Parameters:
strictParsing - value of the strict parsing mode

getMaxLineLen

public int getMaxLineLen()
Returns the maximum line length limit

Returns:
value of the the maximum line length limit
See Also:
setMaxLineLen(int)

setMaxLineLen

public void setMaxLineLen(int maxLineLen)
Sets the maximum line length limit. Parsing of a MIME entity will be terminated with a MimeException if a line is encountered that exceeds the maximum length limit. If this parameter is set to a non positive value the line length check will be disabled.

Default value: 1000

Parameters:
maxLineLen - maximum line length limit

getMaxHeaderCount

public int getMaxHeaderCount()
Returns the maximum header limit

Returns:
value of the the maximum header limit
See Also:
setMaxHeaderCount(int)

setMaxHeaderCount

public void setMaxHeaderCount(int maxHeaderCount)
Sets the maximum header limit. Parsing of a MIME entity will be terminated with a MimeException if the number of headers exceeds the maximum limit. If this parameter is set to a non positive value the header limit check will be disabled.

Default value: 1000

Parameters:
maxHeaderCount - maximum header limit

getMaxHeaderLen

public int getMaxHeaderLen()
Returns the maximum header length limit

Returns:
value of the maximum header length limit
See Also:
setMaxHeaderLen(int)

setMaxHeaderLen

public void setMaxHeaderLen(int maxHeaderLen)
Sets the maximum header length limit. Parsing of a MIME entity will be terminated with a MimeException if the total length of a header exceeds this limit. If this parameter is set to a non positive value the header length check will be disabled.

A message header may be folded across multiple lines. This configuration parameter is used to limit the total length of a header, i.e. the sum of the length of all lines the header spans across (including line terminators).

Default value: 10000

Parameters:
maxHeaderLen - maximum header length limit

getMaxContentLen

public long getMaxContentLen()
Returns the maximum content length limit

Returns:
value of the the maximum content length limit
See Also:
setMaxContentLen(long)

setMaxContentLen

public void setMaxContentLen(long maxContentLen)
Sets the maximum content length limit. Parsing of a MIME entity will be terminated with a MimeException if a content body exceeds the maximum length limit. If this parameter is set to a non positive value the content length check will be disabled.

Default value: -1

Parameters:
maxContentLen - maximum content length limit

isCountLineNumbers

public boolean isCountLineNumbers()
Returns the value of the line number counting mode.

Returns:
value of the line number counting mode.

setCountLineNumbers

public void setCountLineNumbers(boolean countLineNumbers)
Defines whether the parser should count line numbers. If enabled line numbers are included in the debug output.

Default value: false

Parameters:
countLineNumbers - value of the line number counting mode.

getHeadlessParsing

public java.lang.String getHeadlessParsing()
Returns the value of the default content type. When not null, indicates that the parsing should be headless.

Returns:
default content type when parsing headless, null otherwise
See Also:
MimeStreamParser.parse(java.io.InputStream)

setHeadlessParsing

public void setHeadlessParsing(java.lang.String contentType)
Defines a default content type. When not null, indicates that the parsing should be headless.

Default value: null

Parameters:
contentType - value of the default content type when parsing headless, null otherwise
See Also:
MimeStreamParser.parse(java.io.InputStream)

clone

public MimeConfig clone()
Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.