org.springframework.http.codec.CodecConfigurer Java Examples
The following examples show how to use
org.springframework.http.codec.CodecConfigurer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultipartCodecInitializer.java From spring-fu with Apache License 2.0 | 5 votes |
@Override protected void register(GenericApplicationContext context, CodecConfigurer configurer) { configurer.customCodecs().writer(new MultipartHttpMessageWriter()); if (!isClientCodec) { configurer.customCodecs().reader(new MultipartHttpMessageReader(new SynchronossPartHttpMessageReader())); } }
Example #2
Source File: JacksonJsonCodecInitializer.java From spring-fu with Apache License 2.0 | 5 votes |
@Override protected void register(GenericApplicationContext context, CodecConfigurer configurer) { ObjectMapper mapper = context.getBean(ObjectMapper.class); Jackson2JsonEncoder encoder = new Jackson2JsonEncoder(mapper); configurer.customCodecs().decoder(new Jackson2JsonDecoder(mapper)); configurer.customCodecs().encoder(encoder); configurer.customCodecs().writer(new ServerSentEventHttpMessageWriter(encoder)); }
Example #3
Source File: CredHubWebClientFactory.java From spring-credhub with Apache License 2.0 | 5 votes |
private static WebClient.Builder buildWebClient(String baseUri, ClientHttpConnector clientHttpConnector) { ExchangeStrategies strategies = ExchangeStrategies.builder().codecs((configurer) -> { ObjectMapper mapper = JsonUtils.buildObjectMapper(); CodecConfigurer.DefaultCodecs dc = configurer.defaultCodecs(); dc.jackson2JsonDecoder(new Jackson2JsonDecoder(mapper)); dc.jackson2JsonEncoder(new Jackson2JsonEncoder(mapper)); }).build(); return WebClient.builder().clientConnector(clientHttpConnector).baseUrl(baseUri) .defaultHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) .exchangeStrategies(strategies); }
Example #4
Source File: ResourceCodecInitializer.java From spring-fu with Apache License 2.0 | 4 votes |
@Override protected void register(GenericApplicationContext context, CodecConfigurer configurer) { configurer.customCodecs().writer(new ResourceHttpMessageWriter()); configurer.customCodecs().decoder(new ResourceDecoder()); }
Example #5
Source File: ProtobufCodecInitializer.java From spring-fu with Apache License 2.0 | 4 votes |
@Override protected void register(GenericApplicationContext context, CodecConfigurer configurer) { configurer.customCodecs().encoder(new ProtobufEncoder()); configurer.customCodecs().decoder(new ProtobufDecoder()); }
Example #6
Source File: FormCodecInitializer.java From spring-fu with Apache License 2.0 | 4 votes |
@Override protected void register(GenericApplicationContext context, CodecConfigurer configurer) { configurer.customCodecs().writer(new FormHttpMessageWriter()); configurer.customCodecs().reader(new FormHttpMessageReader()); }
Example #7
Source File: StringCodecInitializer.java From spring-fu with Apache License 2.0 | 4 votes |
@Override protected void register(GenericApplicationContext context, CodecConfigurer configurer) { configurer.customCodecs().encoder(textPlainOnly ? CharSequenceEncoder.textPlainOnly() : CharSequenceEncoder.allMimeTypes()); configurer.customCodecs().decoder(textPlainOnly ? StringDecoder.textPlainOnly() : StringDecoder.allMimeTypes()); }
Example #8
Source File: AdviceTraitTesting.java From problem-spring-web with MIT License | 4 votes |
default void configureJson(CodecConfigurer configurer) { final ObjectMapper mapper = mapper(); CodecConfigurer.DefaultCodecs defaults = configurer.defaultCodecs(); defaults.jackson2JsonDecoder(new Jackson2JsonDecoder(mapper)); defaults.jackson2JsonEncoder(new Jackson2JsonEncoder(mapper)); }
Example #9
Source File: AbstractCodecInitializer.java From spring-fu with Apache License 2.0 | votes |
protected abstract void register(GenericApplicationContext context, CodecConfigurer configurer);