{8.2.0-updated} HTTP Part Serializers

There is a separate set of serializers for serializing HTTP parts (query, form-data, headers, path variables, and plain-text request bodies). The distinction is that these are designed to serialize directly to 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 value to serialize Object value = new long[][]{{1,2,3},{4,5,6},{7,8,9}}; // Produces "1,2,3|4,5,6|7,8,9" String output = OpenApiSerializer.DEFAULT.serialize(HttpPartType.HEADER, schema, value);

The {@link oaj.httppart.HttpPartSchemaBuilder} class is provided for shortening the creation of schemas. The equivalent to the schema above can be structured like so:

import static org.apache.juneau.httppart.HttpPartSchemaBuilder.*; // Schema information about our part. HttpPartSchema schema = tArrayPipes(tArrayCsv(tInt64())).build();

The class hierarchy for the part serializers are: