public static class MimeConfig.Builder extends Object
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
MimeConfig |
build() |
MimeConfig.Builder |
setCountLineNumbers(boolean countLineNumbers)
Defines whether the parser should count line numbers.
|
MimeConfig.Builder |
setHeadlessParsing(String contentType)
Defines a default content type.
|
MimeConfig.Builder |
setMalformedHeaderStartsBody(boolean malformedHeaderStartsBody)
Define the behaviour for dealing with malformed headers while in lenient
mode
|
MimeConfig.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 a
MimeException . |
public MimeConfig.Builder setMalformedHeaderStartsBody(boolean malformedHeaderStartsBody)
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.public MimeConfig.Builder setStrictParsing(boolean strictParsing)
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
strictParsing
- value of the strict parsing modepublic MimeConfig.Builder setMaxLineLen(int maxLineLen)
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
maxLineLen
- maximum line length limitpublic MimeConfig.Builder setMaxHeaderCount(int maxHeaderCount)
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
maxHeaderCount
- maximum header limitpublic MimeConfig.Builder setMaxHeaderLen(int maxHeaderLen)
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
maxHeaderLen
- maximum header length limitpublic MimeConfig.Builder setMaxContentLen(long maxContentLen)
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
maxContentLen
- maximum content length limitpublic MimeConfig.Builder setCountLineNumbers(boolean countLineNumbers)
Default value: false
countLineNumbers
- value of the line number counting mode.public MimeConfig.Builder setHeadlessParsing(String contentType)
Default value: null
contentType
- value of the default content type when parsing headless, null
otherwiseMimeStreamParser.parse(java.io.InputStream)
public MimeConfig build()
Copyright © 2004–2023 The Apache Software Foundation. All rights reserved.