Package org.apache.james.mime4j.stream
Class MimeConfig.Builder
- java.lang.Object
-
- org.apache.james.mime4j.stream.MimeConfig.Builder
-
- Enclosing class:
- MimeConfig
public static class MimeConfig.Builder extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
countLineNumbers
private java.lang.String
headlessParsing
private boolean
malformedHeaderStartsBody
private long
maxContentLen
private int
maxHeaderCount
private int
maxHeaderLen
private int
maxLineLen
private boolean
strictParsing
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MimeConfig
build()
MimeConfig.Builder
setCountLineNumbers(boolean countLineNumbers)
Defines whether the parser should count line numbers.MimeConfig.Builder
setHeadlessParsing(java.lang.String contentType)
Defines a default content type.MimeConfig.Builder
setMalformedHeaderStartsBody(boolean malformedHeaderStartsBody)
Define the behaviour for dealing with malformed headers while in lenient modeMimeConfig.Builder
setMaxContentLen(long maxContentLen)
Sets the maximum content length limit.MimeConfig.Builder
setMaxHeaderCount(int maxHeaderCount)
Sets the maximum header limit.MimeConfig.Builder
setMaxHeaderLen(int maxHeaderLen)
Sets the maximum header length limit.MimeConfig.Builder
setMaxLineLen(int maxLineLen)
Sets the maximum line length limit.MimeConfig.Builder
setStrictParsing(boolean strictParsing)
Defines whether minor violations of the MIME specification should be tolerated or should result in aMimeException
.
-
-
-
Field Detail
-
strictParsing
private boolean strictParsing
-
maxLineLen
private int maxLineLen
-
maxHeaderCount
private int maxHeaderCount
-
maxHeaderLen
private int maxHeaderLen
-
maxContentLen
private long maxContentLen
-
countLineNumbers
private boolean countLineNumbers
-
headlessParsing
private java.lang.String headlessParsing
-
malformedHeaderStartsBody
private boolean malformedHeaderStartsBody
-
-
Method Detail
-
setMalformedHeaderStartsBody
public MimeConfig.Builder 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.
-
setStrictParsing
public MimeConfig.Builder setStrictParsing(boolean strictParsing)
Defines whether minor violations of the MIME specification should be tolerated or should result in aMimeException
. If this parameter is set totrue
, a strict interpretation of the MIME specification will be enforced, If this parameter is set tofalse
minor violations will result in a warning in the log.Default value:
false
- Parameters:
strictParsing
- value of the strict parsing mode
-
setMaxLineLen
public MimeConfig.Builder setMaxLineLen(int maxLineLen)
Sets the maximum line length limit. Parsing of a MIME entity will be terminated with aMimeException
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
-
setMaxHeaderCount
public MimeConfig.Builder setMaxHeaderCount(int maxHeaderCount)
Sets the maximum header limit. Parsing of a MIME entity will be terminated with aMimeException
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
-
setMaxHeaderLen
public MimeConfig.Builder setMaxHeaderLen(int maxHeaderLen)
Sets the maximum header length limit. Parsing of a MIME entity will be terminated with aMimeException
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
-
setMaxContentLen
public MimeConfig.Builder setMaxContentLen(long maxContentLen)
Sets the maximum content length limit. Parsing of a MIME entity will be terminated with aMimeException
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
-
setCountLineNumbers
public MimeConfig.Builder 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.
-
setHeadlessParsing
public MimeConfig.Builder 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)
-
build
public MimeConfig build()
-
-