use of org.springframework.http.codec.FormHttpMessageReader in project spring-framework by spring-projects.
the class DefaultHandlerStrategiesBuilder method defaultConfiguration.
public void defaultConfiguration() {
messageReader(new DecoderHttpMessageReader<>(new ByteArrayDecoder()));
messageReader(new DecoderHttpMessageReader<>(new ByteBufferDecoder()));
messageReader(new DecoderHttpMessageReader<>(new StringDecoder()));
messageReader(new FormHttpMessageReader());
messageWriter(new EncoderHttpMessageWriter<>(new ByteArrayEncoder()));
messageWriter(new EncoderHttpMessageWriter<>(new ByteBufferEncoder()));
messageWriter(new EncoderHttpMessageWriter<>(new CharSequenceEncoder()));
messageWriter(new ResourceHttpMessageWriter());
if (jaxb2Present) {
messageReader(new DecoderHttpMessageReader<>(new Jaxb2XmlDecoder()));
messageWriter(new EncoderHttpMessageWriter<>(new Jaxb2XmlEncoder()));
}
if (jackson2Present) {
messageReader(new DecoderHttpMessageReader<>(new Jackson2JsonDecoder()));
Jackson2JsonEncoder jsonEncoder = new Jackson2JsonEncoder();
messageWriter(new Jackson2ServerHttpMessageWriter(jsonEncoder));
messageWriter(new ServerSentEventHttpMessageWriter(Collections.singletonList(jsonEncoder)));
} else {
messageWriter(new ServerSentEventHttpMessageWriter());
}
localeResolver(DEFAULT_LOCALE_RESOLVER);
}
use of org.springframework.http.codec.FormHttpMessageReader in project spring-framework by spring-projects.
the class BodyExtractorsTests method createContext.
@Before
public void createContext() {
final List<HttpMessageReader<?>> messageReaders = new ArrayList<>();
messageReaders.add(new DecoderHttpMessageReader<>(new ByteBufferDecoder()));
messageReaders.add(new DecoderHttpMessageReader<>(new StringDecoder()));
messageReaders.add(new DecoderHttpMessageReader<>(new Jaxb2XmlDecoder()));
messageReaders.add(new DecoderHttpMessageReader<>(new Jackson2JsonDecoder()));
messageReaders.add(new FormHttpMessageReader());
this.context = new BodyExtractor.Context() {
@Override
public Supplier<Stream<HttpMessageReader<?>>> messageReaders() {
return messageReaders::stream;
}
@Override
public Map<String, Object> hints() {
return hints;
}
};
this.hints = new HashMap<String, Object>();
}
Aggregations