Annotation Interface HttpPartMarshalling


Specifies the HttpPartSerializer and HttpPartParser to use for serializing/parsing HTTP parts.

Can be applied alongside the HTTP-part parameter annotations @Query, @Header, @FormData, and @Path to override the default part serializer for that specific value. It may also be declared at the method or interface level to supply a default for all parts of that scope.

The next-generation org.apache.juneau.rest.client.RestClient remote-proxy engine (RestClient.remote(Class)) honors the serializer() attribute for outgoing HTTP parts (query / header / path / form-data), resolving the most-specific declaration: parameter-level overrides method-level, which overrides interface-level. When absent, the client's default part serializer is used (behavior is unchanged).

Not currently consumed: the parser() attribute (the next-gen engine has no response-part parsing path; response bodies are handled by the client Parsers, not part parsers), the request body (@Content, which uses a full Serializer/Parser rather than a part serializer/parser), and the classic RestClient remote-proxy path (which does not discover this annotation).

Example:

@RemoteGet("/mymethod") String myMethod(@Query("foo") @HttpPartMarshalling(serializer=MySerializer.class) String foo);

See Also:
  • Element Details

    • parser

      Specifies the HttpPartParser class used for parsing strings to values.
      Returns:
      The annotation value.
      Default:
      org.apache.juneau.marshall.httppart.HttpPartParser.Void.class
    • serializer

      Specifies the HttpPartSerializer class used for serializing values to strings.
      Returns:
      The annotation value.
      Default:
      org.apache.juneau.marshall.httppart.HttpPartSerializer.Void.class