/** * @param defaultCharset The default charset * @param byteBufferFactory A byte buffer factory * @param codecRegistryProvider A media type codec registry * @param codecConfiguration The configuration for the codec */ protected TextStreamCodec( Charset defaultCharset, ByteBufferFactory byteBufferFactory, Provider<MediaTypeCodecRegistry> codecRegistryProvider, @Named(CONFIGURATION_QUALIFIER) @Nullable CodecConfiguration codecConfiguration) { this.defaultCharset = defaultCharset; this.byteBufferFactory = byteBufferFactory; this.codecRegistryProvider = codecRegistryProvider; if (codecConfiguration != null) { this.additionalTypes = codecConfiguration.getAdditionalTypes(); } else { this.additionalTypes = Collections.emptyList(); } }
/** * @param objectMapper To read/write JSON * @param applicationConfiguration The common application configurations * @param codecConfiguration The configuration for the codec */ public JsonStreamMediaTypeCodec(ObjectMapper objectMapper, ApplicationConfiguration applicationConfiguration, @Named(CONFIGURATION_QUALIFIER) @Nullable CodecConfiguration codecConfiguration) { super(objectMapper, applicationConfiguration, null); if (codecConfiguration != null) { this.additionalTypes = codecConfiguration.getAdditionalTypes(); } else { this.additionalTypes = Collections.emptyList(); } }
/** * @param objectMapper To read/write JSON * @param applicationConfiguration The common application configurations * @param codecConfiguration The configuration for the codec */ public JsonMediaTypeCodec(ObjectMapper objectMapper, ApplicationConfiguration applicationConfiguration, @Named(CONFIGURATION_QUALIFIER) @Nullable CodecConfiguration codecConfiguration) { this.objectMapper = objectMapper; this.applicationConfiguration = applicationConfiguration; if (codecConfiguration != null) { this.additionalTypes = codecConfiguration.getAdditionalTypes(); } else { this.additionalTypes = Collections.emptyList(); } }
/** * @param serverConfiguration The HTTP server configuration * @param byteBufferFactory A byte buffer factory * @param codecRegistryProvider A media type codec registry * @param codecConfiguration The configuration for the codec */ public TextStreamCodec( HttpServerConfiguration serverConfiguration, ByteBufferFactory byteBufferFactory, Provider<MediaTypeCodecRegistry> codecRegistryProvider, @Named(CONFIGURATION_QUALIFIER) @Nullable CodecConfiguration codecConfiguration) { this.serverConfiguration = serverConfiguration; this.byteBufferFactory = byteBufferFactory; this.codecRegistryProvider = codecRegistryProvider; if (codecConfiguration != null) { this.additionalTypes = codecConfiguration.getAdditionalTypes(); } else { this.additionalTypes = Collections.emptyList(); } }
/** * @param defaultCharset The default charset used for serialization and deserialization * @param codecConfiguration The configuration for the codec */ @Inject public TextPlainCodec(@Value("${" + ApplicationConfiguration.DEFAULT_CHARSET + "}") Optional<Charset> defaultCharset, @Named(CONFIGURATION_QUALIFIER) @Nullable CodecConfiguration codecConfiguration) { this.defaultCharset = defaultCharset.orElse(StandardCharsets.UTF_8); if (codecConfiguration != null) { this.additionalTypes = codecConfiguration.getAdditionalTypes(); } else { this.additionalTypes = Collections.emptyList(); } }