org.springframework.web.reactive.accept.HeaderContentTypeResolver Java Examples

The following examples show how to use org.springframework.web.reactive.accept.HeaderContentTypeResolver. 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: ViewResolutionResultHandlerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private ViewResolutionResultHandler resultHandler(List<View> defaultViews, ViewResolver... resolvers) {
	List<ViewResolver> resolverList = Arrays.asList(resolvers);
	RequestedContentTypeResolver contentTypeResolver = new HeaderContentTypeResolver();
	ViewResolutionResultHandler handler = new ViewResolutionResultHandler(resolverList, contentTypeResolver);
	handler.setDefaultViews(defaultViews);
	return handler;
}
 
Example #2
Source File: ViewResolutionResultHandlerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
private ViewResolutionResultHandler resultHandler(List<View> defaultViews, ViewResolver... resolvers) {
	List<ViewResolver> resolverList = Arrays.asList(resolvers);
	RequestedContentTypeResolver contentTypeResolver = new HeaderContentTypeResolver();
	ViewResolutionResultHandler handler = new ViewResolutionResultHandler(resolverList, contentTypeResolver);
	handler.setDefaultViews(defaultViews);
	return handler;
}
 
Example #3
Source File: DispatcherHandlerErrorTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Bean
public ResponseBodyResultHandler resultHandler() {
	return new ResponseBodyResultHandler(Collections.singletonList(
			new EncoderHttpMessageWriter<>(CharSequenceEncoder.textPlainOnly())),
			new HeaderContentTypeResolver());
}
 
Example #4
Source File: HandlerResultHandlerTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
protected TestResultHandler() {
	this(new HeaderContentTypeResolver());
}
 
Example #5
Source File: DispatcherHandlerErrorTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Bean
public ResponseBodyResultHandler resultHandler() {
	return new ResponseBodyResultHandler(Collections.singletonList(
			new EncoderHttpMessageWriter<>(CharSequenceEncoder.textPlainOnly())),
			new HeaderContentTypeResolver());
}
 
Example #6
Source File: HandlerResultHandlerTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
protected TestResultHandler() {
	this(new HeaderContentTypeResolver());
}
 
Example #7
Source File: AdviceTrait.java    From problem-spring-web with MIT License 4 votes vote down vote up
default Optional<MediaType> negotiate(final ServerWebExchange request) {
    final List<MediaType> mediaTypes = new HeaderContentTypeResolver().resolveMediaTypes(request);
    return AdviceTraits.getProblemMediaType(mediaTypes);
}
 
Example #8
Source File: ProducesRequestCondition.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Same as {@link #ProducesRequestCondition(String[], String[])} but also
 * accepting a {@link ContentNegotiationManager}.
 * @param produces expressions with syntax defined by {@link RequestMapping#produces()}
 * @param headers expressions with syntax defined by {@link RequestMapping#headers()}
 * @param resolver used to determine requested content type
 */
public ProducesRequestCondition(String[] produces, String[] headers, RequestedContentTypeResolver resolver) {
	this.expressions = new ArrayList<>(parseExpressions(produces, headers));
	Collections.sort(this.expressions);
	this.contentTypeResolver = (resolver != null ? resolver : new HeaderContentTypeResolver());
}