{title:'HTTP Part Serializers and Parsers', updated:'8.2.0,9.0.0'}

There is a separate set of serializers and parsers for marshalling HTTP parts (query, form-data, headers, path variables, and plain-text request bodies). The distinction is that these are designed to marshall directly to-and-from strings based on Open-API schema information.

| // Schema information about our part. | HttpPartSchema schema = HttpPartSchema | .tArrayPipes() | .items( | HttpPartSchema | .tArrayCsv() | .items( | HttpPartSchema.tInt64("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 = OpenApi.of(HttpPartType.HEADER, schema, value); | | // Produces "[[1,2,3],[4,5,6],[7,8,9]] | long[][] value = OpenApi.to(HttpPartType.HEADER, schema, output, long[][].class);

The {@link oaj.httppart.HttpPartSchema} class also provides convenience static methods for creation of custom schemas. The equivalent to the schema above can be structured like so:

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

The class hierarchy for the part marshallers are: