Class HeaderValidator
java.lang.Object
org.netpreserve.jwarc.HeaderValidator
The `HeaderValidator` class validates MessageHeaders based on predefined rules. Rules can include which records types
a header field is allowed, forbidden or mandatory on and whether the value matches a regular expression.
-
Method Summary
Modifier and TypeMethodDescriptionvalidate(MessageHeaders headers) Validates the given set of message headers.static HeaderValidatorwarc_1_1()Creates and configures a HeaderValidator object for the WARC 1.1 standard.static HeaderValidatorwarc_1_1(boolean forbidExtensions) Creates and configures a HeaderValidator object for the WARC 1.1 standard.
-
Method Details
-
warc_1_1
Creates and configures a HeaderValidator object for the WARC 1.1 standard. Extension headers and values will be ignored. -
warc_1_1
Creates and configures a HeaderValidator object for the WARC 1.1 standard.The validation of field values is slightly relaxed from the grammar in the WARC 1.1 standard for backwards compatibility with WARC 1.0 and in other cases recommended by the community annotations.
- Parameters:
forbidExtensions- if true unknown headers are forbidden and only standard values are accepted for WARC-Type, WARC-Truncated and WARC-Profile.
-
validate
Validates the given set of message headers.- Parameters:
headers- the MessageHeaders object containing headers to be validated- Returns:
- a list of strings describing any validation violations found
-