Java Code Examples for org.springframework.http.codec.ServerCodecConfigurer#getWriters()

The following examples show how to use org.springframework.http.codec.ServerCodecConfigurer#getWriters() . 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: WebFluxConfigurationSupport.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Bean
public ResponseEntityResultHandler responseEntityResultHandler(
		ReactiveAdapterRegistry webFluxAdapterRegistry,
		ServerCodecConfigurer serverCodecConfigurer,
		RequestedContentTypeResolver webFluxContentTypeResolver) {
	return new ResponseEntityResultHandler(serverCodecConfigurer.getWriters(),
			webFluxContentTypeResolver, webFluxAdapterRegistry);
}
 
Example 2
Source File: WebFluxConfigurationSupport.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Bean
public ResponseBodyResultHandler responseBodyResultHandler(
		ReactiveAdapterRegistry webFluxAdapterRegistry,
		ServerCodecConfigurer serverCodecConfigurer,
		RequestedContentTypeResolver webFluxContentTypeResolver) {
	return new ResponseBodyResultHandler(serverCodecConfigurer.getWriters(),
			webFluxContentTypeResolver, webFluxAdapterRegistry);
}
 
Example 3
Source File: SpringWebfluxUnhandledExceptionHandler.java    From backstopper with Apache License 2.0 5 votes vote down vote up
@Inject
public SpringWebfluxUnhandledExceptionHandler(
    @NotNull ProjectApiErrors projectApiErrors,
    @NotNull ApiExceptionHandlerUtils generalUtils,
    @NotNull SpringWebfluxApiExceptionHandlerUtils springUtils,
    @NotNull ObjectProvider<ViewResolver> viewResolversProvider,
    @NotNull ServerCodecConfigurer serverCodecConfigurer
) {
    super(projectApiErrors, generalUtils);

    //noinspection ConstantConditions
    if (springUtils == null) {
        throw new NullPointerException("springUtils cannot be null.");
    }
    
    //noinspection ConstantConditions
    if (viewResolversProvider == null) {
        throw new NullPointerException("viewResolversProvider cannot be null.");
    }

    //noinspection ConstantConditions
    if (serverCodecConfigurer == null) {
        throw new NullPointerException("serverCodecConfigurer cannot be null.");
    }

    this.singletonGenericServiceError = Collections.singleton(projectApiErrors.getGenericServiceError());
    this.genericServiceErrorHttpStatusCode = projectApiErrors.getGenericServiceError().getHttpStatusCode();

    this.springUtils = springUtils;
    this.viewResolvers = viewResolversProvider.orderedStream().collect(Collectors.toList());
    this.messageReaders = serverCodecConfigurer.getReaders();
    this.messageWriters = serverCodecConfigurer.getWriters();
}
 
Example 4
Source File: SpringWebfluxApiExceptionHandler.java    From backstopper with Apache License 2.0 5 votes vote down vote up
@Inject
public SpringWebfluxApiExceptionHandler(
    @NotNull ProjectApiErrors projectApiErrors,
    @NotNull SpringWebFluxApiExceptionHandlerListenerList apiExceptionHandlerListeners,
    @NotNull ApiExceptionHandlerUtils generalUtils,
    @NotNull SpringWebfluxApiExceptionHandlerUtils springUtils,
    @NotNull ObjectProvider<ViewResolver> viewResolversProvider,
    @NotNull ServerCodecConfigurer serverCodecConfigurer
) {
    super(projectApiErrors, apiExceptionHandlerListeners.listeners, generalUtils);

    //noinspection ConstantConditions
    if (springUtils == null) {
        throw new NullPointerException("springUtils cannot be null.");
    }

    //noinspection ConstantConditions
    if (viewResolversProvider == null) {
        throw new NullPointerException("viewResolversProvider cannot be null.");
    }

    //noinspection ConstantConditions
    if (serverCodecConfigurer == null) {
        throw new NullPointerException("serverCodecConfigurer cannot be null.");
    }

    this.springUtils = springUtils;
    this.viewResolvers = viewResolversProvider.orderedStream().collect(Collectors.toList());
    this.messageReaders = serverCodecConfigurer.getReaders();
    this.messageWriters = serverCodecConfigurer.getWriters();
}
 
Example 5
Source File: SentinelGatewayBlockExceptionHandler.java    From Sentinel-Dashboard-Nacos with Apache License 2.0 4 votes vote down vote up
public SentinelGatewayBlockExceptionHandler(List<ViewResolver> viewResolvers, ServerCodecConfigurer serverCodecConfigurer) {
    this.viewResolvers = viewResolvers;
    this.messageWriters = serverCodecConfigurer.getWriters();
}
 
Example 6
Source File: SentinelBlockExceptionHandler.java    From Sentinel-Dashboard-Nacos with Apache License 2.0 4 votes vote down vote up
public SentinelBlockExceptionHandler(List<ViewResolver> viewResolvers, ServerCodecConfigurer serverCodecConfigurer) {
    this.viewResolvers = viewResolvers;
    this.messageWriters = serverCodecConfigurer.getWriters();
}
 
Example 7
Source File: SentinelGatewayBlockExceptionHandler.java    From Sentinel with Apache License 2.0 4 votes vote down vote up
public SentinelGatewayBlockExceptionHandler(List<ViewResolver> viewResolvers, ServerCodecConfigurer serverCodecConfigurer) {
    this.viewResolvers = viewResolvers;
    this.messageWriters = serverCodecConfigurer.getWriters();
}
 
Example 8
Source File: SentinelBlockExceptionHandler.java    From Sentinel with Apache License 2.0 4 votes vote down vote up
public SentinelBlockExceptionHandler(List<ViewResolver> viewResolvers, ServerCodecConfigurer serverCodecConfigurer) {
    this.viewResolvers = viewResolvers;
    this.messageWriters = serverCodecConfigurer.getWriters();
}
 
Example 9
Source File: GlobalErrorWebExceptionHandler.java    From springboot-learning-example with Apache License 2.0 4 votes vote down vote up
public GlobalErrorWebExceptionHandler(GlobalErrorAttributes g, ApplicationContext applicationContext,
        ServerCodecConfigurer serverCodecConfigurer) {
    super(g, new ResourceProperties(), applicationContext);
    super.setMessageWriters(serverCodecConfigurer.getWriters());
    super.setMessageReaders(serverCodecConfigurer.getReaders());
}
 
Example 10
Source File: GlobalErrorWebExceptionHandler.java    From microservice-integration with MIT License 4 votes vote down vote up
public GlobalErrorWebExceptionHandler(GlobalErrorAttributes g, ApplicationContext applicationContext,
                                      ServerCodecConfigurer serverCodecConfigurer) {
    super(g, new ResourceProperties(), applicationContext);
    super.setMessageWriters(serverCodecConfigurer.getWriters());
    super.setMessageReaders(serverCodecConfigurer.getReaders());
}
 
Example 11
Source File: GlobalErrorWebExceptionHandler.java    From tutorials with MIT License 4 votes vote down vote up
public GlobalErrorWebExceptionHandler(GlobalErrorAttributes g, ApplicationContext applicationContext, 
        ServerCodecConfigurer serverCodecConfigurer) {
    super(g, new ResourceProperties(), applicationContext);
    super.setMessageWriters(serverCodecConfigurer.getWriters());
    super.setMessageReaders(serverCodecConfigurer.getReaders());
}