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; } }
@Produces public Jsonb create() { return JsonbProvider.provider().create().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(); }
/** * 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(); }
static Jsonb create() { return JsonbProvider.provider().create().build(); }
static Jsonb create() { return JsonbProvider.provider().create().build(); }
@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()); } }
@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() { return JsonbProvider.provider().create().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(); }
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(); }
/** * 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(); }
static Jsonb create(final JsonbConfig config) { return JsonbProvider.provider().create().withConfig(config).build(); }
static Jsonb create(final JsonbConfig config) { return JsonbProvider.provider().create().withConfig(config).build(); }
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, 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(); }
.build(); final Jsonb serializableJsonb = Jsonb.class .cast(javaProxyEnricherFactory
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; } }
.setProperty("johnzon.cdi.activated", false) .setProperty("johnzon.attributeOrder", String.CASE_INSENSITIVE_ORDER)) .build()) { container.execute(() -> { try {
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; }