Skip to content

MessageEncoder docs are outdated #3726

@wowselim

Description

@wowselim

The interface for MessageEncoder has the following encode method:

@Nullable DataBuffer encode(@NonNull Context ctx, @NonNull Object value) throws Exception;

The javadocs state the following:

/**
 * Render a route output as byte array.
 *
 * @author edgar
 * @since 2.0.0
 */

and

/**
   * MessageEncoder a value into a byte array or <code>null</code> if given object isn't supported
   * it.
   *
   * @param ctx Web context.
   * @param value Value to render.
   * @return Value as byte array or <code>null</code> if given object isn't supported it.
   * @throws Exception If something goes wrong.
   */

These are both outdated as the class does not return byte[] but DataBuffer instead.

The website is also outdated on message encoders: https://jooby.io/#context-response-body-message-encoder
Here, a String is produced and returned. This also doesn't use the DataBuffer class.

In general there is very little info about how to work with data buffers.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions