HTTP Part Parsers
There is a separate set of parsers for parsing HTTP parts (query, form-data, headers, path variables, and plain-text request bodies).
The distinction is that these are designed to parse directly from strings based on Open-API schema information.
// Schema information about our part.
HttpPartSchema schema = HttpPartSchema
.create("array")
.collectionFormat("pipes")
.items(
HttpPartSchema
.create("array")
.collectionFormat("csv")
.items(
HttpPartSchema.create("integer","int64")
)
)
.build();
// Our input to parse.
String input = "1,2,3|4,5,6|7,8,9";
// Produces "[[1,2,3],[4,5,6],[7,8,9]]
long[][] value = OpenApiParser.DEFAULT.parse(HttpPartType.HEADER, schema, input, long[][].class);
The class hierarchy for the part serializers are:
- {@link oaj.httppart.HttpPartParser}
- {@link oaj.httppart.SimplePartParser} - Parses directly from strings.
- {@link oaj.uon.UonParser} - Parses from UON notation.
- {@link oaj.oapi.OpenApiParser} - Parses using Open-API schema rules.