/** * Construct a new {@code JsonbHttpMessageConverter} with the given configuration. * @param config the {@code JsonbConfig} for the underlying delegate */ public JsonbHttpMessageConverter(JsonbConfig config) { this.jsonb = JsonbBuilder.create(config); }
/** * Create a new {@link javax.json.bind.Jsonb} instance using the default * {@code JsonbBuilder} implementation provided as returned from * {@link javax.json.bind.spi.JsonbProvider#provider()} method, configured * with provided configuration. * * @param config * Provided configuration for {@link javax.json.bind.Jsonb} instance. * * @return new {@link javax.json.bind.Jsonb Jsonb} instance. */ static Jsonb create(JsonbConfig config) { return JsonbProvider.provider().create().withConfig(config).build(); }
private ConfiguredJsonbJaxrsProvider(final String encoding, final boolean nulls, final boolean iJson, final boolean pretty, final String binaryStrategy, final String namingStrategy, final String orderStrategy, final JsonProvider provider) { // ATTENTION this is only a workaround for MEECROWAVE-49 and shall get removed after Johnzon has a fix for it! // We add byte[] to the ignored types. super(singletonList("[B")); ofNullable(encoding).ifPresent(this::setEncoding); ofNullable(namingStrategy).ifPresent(this::setPropertyNamingStrategy); ofNullable(orderStrategy).ifPresent(this::setPropertyOrderStrategy); ofNullable(binaryStrategy).ifPresent(this::setBinaryDataStrategy); setNullValues(nulls); setIJson(iJson); setPretty(pretty); this.jsonb = JsonbBuilder.newBuilder() .withProvider(provider) .withConfig(config) .build(); }
protected Jsonb getJsonb(Class<?> type) { ContextResolver<Jsonb> contextResolver = providers.getContextResolver(Jsonb.class, MediaType.APPLICATION_JSON_TYPE); if (contextResolver != null) { return contextResolver.getContext(type); } else { if (jsonbObj == null) { JsonProviderImpl jProviderImpl = new JsonProviderImpl(); JsonBindingBuilder jbBuilder = new JsonBindingBuilder(); jsonbObj = jbBuilder.withProvider(jProviderImpl).build(); } return jsonbObj; } }
synchronized Jsonb jsonb() { if (jsonb == null) { jsonb = manager .getJsonbProvider() .create() .withProvider(new PreComputedJsonpProvider("test", manager.getJsonpProvider(), manager.getJsonpParserFactory(), manager.getJsonpWriterFactory(), manager.getJsonpBuilderFactory(), manager.getJsonpGeneratorFactory(), manager.getJsonpReaderFactory())) // reuses the same memory buffers .withConfig(new JsonbConfig().setProperty("johnzon.cdi.activated", false)) .build(); } return jsonb; }
.create(); private final Jsonb yasson = new JsonBindingProvider().create() .withProvider(new org.glassfish.json.JsonProviderImpl()) .build(); private static final AbstractTransformer FLEX_IDENTITY = new AbstractTransformer() { @Override
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Jsonb jsonb = JsonbBuilder.newBuilder().build(); HealthCheckModel healthCheckModel = healthCheckManager.performHealthChecks(); if (healthCheckModel.getOutcome().equalsIgnoreCase(HealthCheckResponse.State.UP.name())) { resp.setStatus(200); } else { resp.setStatus(503); } jsonb.toJson(healthCheckModel, resp.getOutputStream()); } }
static Jsonb create(final JsonbConfig config) { return JsonbProvider.provider().create().withConfig(config).build(); }
private ConfiguredJsonbJaxrsProvider(final String encoding, final boolean nulls, final boolean iJson, final boolean pretty, final String binaryStrategy, final String namingStrategy, final String orderStrategy, final JsonProvider provider) { // ATTENTION this is only a workaround for MEECROWAVE-49 and shall get removed after Johnzon has a fix for it! // We add byte[] to the ignored types. super(singletonList("[B")); ofNullable(encoding).ifPresent(this::setEncoding); ofNullable(namingStrategy).ifPresent(this::setPropertyNamingStrategy); ofNullable(orderStrategy).ifPresent(this::setPropertyOrderStrategy); ofNullable(binaryStrategy).ifPresent(this::setBinaryDataStrategy); setNullValues(nulls); setIJson(iJson); setPretty(pretty); this.jsonb = JsonbBuilder.newBuilder() .withProvider(provider) .withConfig(config) .build(); }
@Produces public Jsonb create() { return JsonbProvider.provider().create().build(); }
.withProvider(jsonpProvider) // reuses the same memory buffering .withConfig(jsonbConfig) .build(); final Jsonb serializableJsonb = Jsonb.class .cast(javaProxyEnricherFactory
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Jsonb jsonb = JsonbBuilder.newBuilder().build(); HealthCheckModel healthCheckModel = healthCheckManager.performHealthChecks(); if (healthCheckModel.getOutcome().equalsIgnoreCase(HealthCheckResponse.State.UP.name())) { resp.setStatus(200); } else { resp.setStatus(503); } jsonb.toJson(healthCheckModel, resp.getOutputStream()); } }
/** * Construct a new {@code JsonbHttpMessageConverter} with default configuration. */ public JsonbHttpMessageConverter() { this(JsonbBuilder.create()); }
static Jsonb create(final JsonbConfig config) { return JsonbProvider.provider().create().withConfig(config).build(); }
/** * Create a new {@link javax.json.bind.Jsonb} instance using the default * {@code JsonbBuilder} implementation provided as returned from * {@link javax.json.bind.spi.JsonbProvider#provider()} method. * * @return new {@link javax.json.bind.Jsonb Jsonb} instance. */ static Jsonb create() { return JsonbProvider.provider().create().build(); }
/** * Construct a new {@code JsonbHttpMessageConverter} with the given configuration. * @param config the {@code JsonbConfig} for the underlying delegate */ public JsonbHttpMessageConverter(JsonbConfig config) { this.jsonb = JsonbBuilder.create(config); }
static Jsonb create(final JsonbConfig config) { return JsonbProvider.provider().create().withConfig(config).build(); }
/** * Create a new {@link javax.json.bind.Jsonb} instance using the default * {@code JsonbBuilder} implementation provided as returned from * {@link javax.json.bind.spi.JsonbProvider#provider()} method. * * @return new {@link javax.json.bind.Jsonb Jsonb} instance. */ static Jsonb create() { return JsonbProvider.provider().create().build(); }
/** * Construct a new {@code JsonbHttpMessageConverter} with default configuration. */ public JsonbHttpMessageConverter() { this(JsonbBuilder.create()); }
/** * Create a new {@link javax.json.bind.Jsonb} instance using the default * {@code JsonbBuilder} implementation provided as returned from * {@link javax.json.bind.spi.JsonbProvider#provider()} method, configured * with provided configuration. * * @param config * Provided configuration for {@link javax.json.bind.Jsonb} instance. * * @return new {@link javax.json.bind.Jsonb Jsonb} instance. */ static Jsonb create(JsonbConfig config) { return JsonbProvider.provider().create().withConfig(config).build(); }