Class MimeConfig.Builder

  • Enclosing class:
    MimeConfig

    public static class MimeConfig.Builder
    extends java.lang.Object
    • 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
    • Constructor Detail

      • Builder

        public Builder()
    • 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 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
      • setMaxLineLen

        public MimeConfig.Builder 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
      • setMaxHeaderCount

        public MimeConfig.Builder 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
      • setMaxHeaderLen

        public MimeConfig.Builder 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
      • setMaxContentLen

        public MimeConfig.Builder 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
      • 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)