Example usage for org.springframework.http.codec ServerCodecConfigurer getReaders

List of usage examples for org.springframework.http.codec ServerCodecConfigurer getReaders

Introduction

In this page you can find the example usage for org.springframework.http.codec ServerCodecConfigurer getReaders.

Prototype

List<HttpMessageReader<?>> getReaders();

Source Link

Document

Obtain the configured HTTP message readers.

Usage

From source file:org.springframework.cloud.function.web.function.FunctionEndpointInitializer.java

private DefaultErrorWebExceptionHandler errorHandler(GenericApplicationContext context) {
    context.registerBean(ErrorAttributes.class, () -> new DefaultErrorAttributes());
    context.registerBean(ErrorProperties.class, () -> new ErrorProperties());
    context.registerBean(ResourceProperties.class, () -> new ResourceProperties());
    DefaultErrorWebExceptionHandler handler = new DefaultErrorWebExceptionHandler(
            context.getBean(ErrorAttributes.class), context.getBean(ResourceProperties.class),
            context.getBean(ErrorProperties.class), context);
    ServerCodecConfigurer codecs = ServerCodecConfigurer.create();
    handler.setMessageWriters(codecs.getWriters());
    handler.setMessageReaders(codecs.getReaders());
    return handler;
}

From source file:org.springframework.cloud.function.web.RequestProcessor.java

public RequestProcessor(FunctionInspector inspector, ObjectProvider<JsonMapper> mapper,
        StringConverter converter, ObjectProvider<ServerCodecConfigurer> codecs) {
    this.mapper = mapper.getIfAvailable();
    this.inspector = inspector;
    this.converter = converter;
    ServerCodecConfigurer source = codecs.getIfAvailable();
    this.messageReaders = source == null ? null : source.getReaders();
}

From source file:org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter.java

@Override
public void afterPropertiesSet() throws Exception {
    Assert.notNull(this.applicationContext, "ApplicationContext is required");

    if (CollectionUtils.isEmpty(this.messageReaders)) {
        ServerCodecConfigurer codecConfigurer = ServerCodecConfigurer.create();
        this.messageReaders = codecConfigurer.getReaders();
    }//from   ww w .  j av  a2s. c  o  m
    if (this.argumentResolverConfigurer == null) {
        this.argumentResolverConfigurer = new ArgumentResolverConfigurer();
    }
    if (this.reactiveAdapterRegistry == null) {
        this.reactiveAdapterRegistry = ReactiveAdapterRegistry.getSharedInstance();
    }

    this.methodResolver = new ControllerMethodResolver(this.argumentResolverConfigurer, this.messageReaders,
            this.reactiveAdapterRegistry, this.applicationContext);

    this.modelInitializer = new ModelInitializer(this.methodResolver, this.reactiveAdapterRegistry);
}