Skip to content

Conversation

@rbygrave
Copy link
Contributor

@rbygrave rbygrave commented Dec 1, 2024

For example, with Jsonb we can obtain the specific type once and then write directly to the outputSteam like:

ctx.status(200).contentType("application/json");
var result = HelloDto.rob();
jsonTypeHelloDto.toJson(result, ctx.outputStream());

... where jsonTypeHelloDto is obtained like:

static final Jsonb jsonb = Jsonb.builder().build();
static final JsonType<HelloDto> jsonTypeHelloDto = jsonb.type(HelloDto.class);

With this approach, it effectively bypasses the underlying io.avaje.jex.spi.JsonService with the view that this can be more flexible and more efficient.

…ctly

For example, with Jsonb we can obtain the specific type once and then
write directly to the outputSteam like:

           ctx.status(200).contentType("application/json");
           var result = HelloDto.rob();
           jsonTypeHelloDto.toJson(result, ctx.outputStream());

... where jsonTypeHelloDto is obtained like:

  static final Jsonb jsonb = Jsonb.builder().build();
  static final JsonType<HelloDto> jsonTypeHelloDto = jsonb.type(HelloDto.class);

With this approach, it effectively bypasses the underlying io.avaje.jex.spi.JsonService with the view that this can be more flexible and more efficient.
@rbygrave rbygrave requested a review from SentryMan December 1, 2024 23:36
@rbygrave rbygrave self-assigned this Dec 1, 2024
@rbygrave rbygrave merged commit e0f489f into master Dec 1, 2024
7 checks passed
@rbygrave rbygrave deleted the feature/expose-outputStream branch December 1, 2024 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants