Search in sources :

Example 1 with NettyByteBufEncoder

use of org.springframework.core.codec.NettyByteBufEncoder in project spring-framework by spring-projects.

the class BaseDefaultCodecs method getBaseTypedWriters.

/**
 * Return "base" typed writers only, i.e. common to client and server.
 */
final List<HttpMessageWriter<?>> getBaseTypedWriters() {
    if (!this.registerDefaults) {
        return Collections.emptyList();
    }
    List<HttpMessageWriter<?>> writers = new ArrayList<>();
    addCodec(writers, new EncoderHttpMessageWriter<>(new ByteArrayEncoder()));
    addCodec(writers, new EncoderHttpMessageWriter<>(new ByteBufferEncoder()));
    addCodec(writers, new EncoderHttpMessageWriter<>(new DataBufferEncoder()));
    if (nettyByteBufPresent) {
        addCodec(writers, new EncoderHttpMessageWriter<>(new NettyByteBufEncoder()));
    }
    addCodec(writers, new ResourceHttpMessageWriter());
    addCodec(writers, new EncoderHttpMessageWriter<>(CharSequenceEncoder.textPlainOnly()));
    if (protobufPresent) {
        addCodec(writers, new ProtobufHttpMessageWriter(this.protobufEncoder != null ? (ProtobufEncoder) this.protobufEncoder : new ProtobufEncoder()));
    }
    return writers;
}
Also used : ByteBufferEncoder(org.springframework.core.codec.ByteBufferEncoder) ProtobufEncoder(org.springframework.http.codec.protobuf.ProtobufEncoder) ServerSentEventHttpMessageWriter(org.springframework.http.codec.ServerSentEventHttpMessageWriter) FormHttpMessageWriter(org.springframework.http.codec.FormHttpMessageWriter) MultipartHttpMessageWriter(org.springframework.http.codec.multipart.MultipartHttpMessageWriter) ResourceHttpMessageWriter(org.springframework.http.codec.ResourceHttpMessageWriter) EncoderHttpMessageWriter(org.springframework.http.codec.EncoderHttpMessageWriter) ProtobufHttpMessageWriter(org.springframework.http.codec.protobuf.ProtobufHttpMessageWriter) HttpMessageWriter(org.springframework.http.codec.HttpMessageWriter) ByteArrayEncoder(org.springframework.core.codec.ByteArrayEncoder) DataBufferEncoder(org.springframework.core.codec.DataBufferEncoder) ArrayList(java.util.ArrayList) NettyByteBufEncoder(org.springframework.core.codec.NettyByteBufEncoder) ResourceHttpMessageWriter(org.springframework.http.codec.ResourceHttpMessageWriter) ProtobufHttpMessageWriter(org.springframework.http.codec.protobuf.ProtobufHttpMessageWriter)

Aggregations

ArrayList (java.util.ArrayList)1 ByteArrayEncoder (org.springframework.core.codec.ByteArrayEncoder)1 ByteBufferEncoder (org.springframework.core.codec.ByteBufferEncoder)1 DataBufferEncoder (org.springframework.core.codec.DataBufferEncoder)1 NettyByteBufEncoder (org.springframework.core.codec.NettyByteBufEncoder)1 EncoderHttpMessageWriter (org.springframework.http.codec.EncoderHttpMessageWriter)1 FormHttpMessageWriter (org.springframework.http.codec.FormHttpMessageWriter)1 HttpMessageWriter (org.springframework.http.codec.HttpMessageWriter)1 ResourceHttpMessageWriter (org.springframework.http.codec.ResourceHttpMessageWriter)1 ServerSentEventHttpMessageWriter (org.springframework.http.codec.ServerSentEventHttpMessageWriter)1 MultipartHttpMessageWriter (org.springframework.http.codec.multipart.MultipartHttpMessageWriter)1 ProtobufEncoder (org.springframework.http.codec.protobuf.ProtobufEncoder)1 ProtobufHttpMessageWriter (org.springframework.http.codec.protobuf.ProtobufHttpMessageWriter)1