Package org.apache.james.mime4j.stream
Class MimeConfig.Builder
java.lang.Object
org.apache.james.mime4j.stream.MimeConfig.Builder
- Enclosing class:
MimeConfig
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private String
private boolean
private long
private int
private int
private int
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
setCountLineNumbers
(boolean countLineNumbers) Defines whether the parser should count line numbers.setHeadlessParsing
(String contentType) Defines a default content type.setMalformedHeaderStartsBody
(boolean malformedHeaderStartsBody) Define the behaviour for dealing with malformed headers while in lenient modesetMaxContentLen
(long maxContentLen) Sets the maximum content length limit.setMaxHeaderCount
(int maxHeaderCount) Sets the maximum header limit.setMaxHeaderLen
(int maxHeaderLen) Sets the maximum header length limit.setMaxLineLen
(int maxLineLen) Sets the maximum line length limit.setStrictParsing
(boolean strictParsing) Defines whether minor violations of the MIME specification should be tolerated or should result in aMimeException
.
-
Field Details
-
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
-
malformedHeaderStartsBody
private boolean malformedHeaderStartsBody
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
setMalformedHeaderStartsBody
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
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
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
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
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
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
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
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:
-
build
-