Java Code Examples for org.springframework.web.reactive.accept.RequestedContentTypeResolver

The following examples show how to use org.springframework.web.reactive.accept.RequestedContentTypeResolver. These examples are extracted from open source projects. 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 Project: spring-analysis-note   Source File: WebFluxConfigurationSupport.java    License: MIT License 6 votes vote down vote up
@Bean
public RequestMappingHandlerMapping requestMappingHandlerMapping(
		RequestedContentTypeResolver webFluxContentTypeResolver) {
	RequestMappingHandlerMapping mapping = createRequestMappingHandlerMapping();
	mapping.setOrder(0);
	mapping.setContentTypeResolver(webFluxContentTypeResolver);
	mapping.setCorsConfigurations(getCorsConfigurations());

	PathMatchConfigurer configurer = getPathMatchConfigurer();
	Boolean useTrailingSlashMatch = configurer.isUseTrailingSlashMatch();
	if (useTrailingSlashMatch != null) {
		mapping.setUseTrailingSlashMatch(useTrailingSlashMatch);
	}
	Boolean useCaseSensitiveMatch = configurer.isUseCaseSensitiveMatch();
	if (useCaseSensitiveMatch != null) {
		mapping.setUseCaseSensitiveMatch(useCaseSensitiveMatch);
	}
	Map<String, Predicate<Class<?>>> pathPrefixes = configurer.getPathPrefixes();
	if (pathPrefixes != null) {
		mapping.setPathPrefixes(pathPrefixes);
	}

	return mapping;
}
 
Example 2
Source Project: spring-analysis-note   Source File: RequestMappingInfo.java    License: MIT License 6 votes vote down vote up
@Override
public RequestMappingInfo build() {
	RequestedContentTypeResolver contentTypeResolver = this.options.getContentTypeResolver();

	PathPatternParser parser = (this.options.getPatternParser() != null ?
			this.options.getPatternParser() : new PathPatternParser());
	PatternsRequestCondition patternsCondition = new PatternsRequestCondition(parse(this.paths, parser));

	return new RequestMappingInfo(this.mappingName, patternsCondition,
			new RequestMethodsRequestCondition(this.methods),
			new ParamsRequestCondition(this.params),
			new HeadersRequestCondition(this.headers),
			new ConsumesRequestCondition(this.consumes, this.headers),
			new ProducesRequestCondition(this.produces, this.headers, contentTypeResolver),
			this.customCondition);
}
 
Example 3
@Test
public void requestMappingHandlerMapping() throws Exception {
	ApplicationContext context = loadConfig(WebFluxConfig.class);
	final Field field = ReflectionUtils.findField(PathPatternParser.class, "matchOptionalTrailingSeparator");
	ReflectionUtils.makeAccessible(field);

	String name = "requestMappingHandlerMapping";
	RequestMappingHandlerMapping mapping = context.getBean(name, RequestMappingHandlerMapping.class);
	assertNotNull(mapping);

	assertEquals(0, mapping.getOrder());

	PathPatternParser patternParser = mapping.getPathPatternParser();
	assertNotNull(patternParser);
	boolean matchOptionalTrailingSlash = (boolean) ReflectionUtils.getField(field, patternParser);
	assertTrue(matchOptionalTrailingSlash);

	name = "webFluxContentTypeResolver";
	RequestedContentTypeResolver resolver = context.getBean(name, RequestedContentTypeResolver.class);
	assertSame(resolver, mapping.getContentTypeResolver());

	ServerWebExchange exchange = MockServerWebExchange.from(get("/path").accept(MediaType.APPLICATION_JSON));
	assertEquals(Collections.singletonList(MediaType.APPLICATION_JSON), resolver.resolveMediaTypes(exchange));
}
 
Example 4
@Test // gh-22853
public void matchAndCompare() {
	RequestedContentTypeResolverBuilder builder = new RequestedContentTypeResolverBuilder();
	builder.headerResolver();
	builder.fixedResolver(MediaType.TEXT_HTML);
	RequestedContentTypeResolver resolver = builder.build();

	ProducesRequestCondition none = new ProducesRequestCondition(new String[0], null, resolver);
	ProducesRequestCondition html = new ProducesRequestCondition(new String[] {"text/html"}, null, resolver);

	MockServerWebExchange exchange = MockServerWebExchange.from(get("/").header("Accept", "*/*"));

	ProducesRequestCondition noneMatch = none.getMatchingCondition(exchange);
	ProducesRequestCondition htmlMatch = html.getMatchingCondition(exchange);

	assertEquals(1, noneMatch.compareTo(htmlMatch, exchange));
}
 
Example 5
private ResponseEntityResultHandler createHandler(HttpMessageWriter<?>... writers) {
	List<HttpMessageWriter<?>> writerList;
	if (ObjectUtils.isEmpty(writers)) {
		writerList = new ArrayList<>();
		writerList.add(new EncoderHttpMessageWriter<>(new ByteBufferEncoder()));
		writerList.add(new EncoderHttpMessageWriter<>(CharSequenceEncoder.textPlainOnly()));
		writerList.add(new ResourceHttpMessageWriter());
		writerList.add(new EncoderHttpMessageWriter<>(new Jaxb2XmlEncoder()));
		writerList.add(new EncoderHttpMessageWriter<>(new Jackson2JsonEncoder()));
		writerList.add(new EncoderHttpMessageWriter<>(CharSequenceEncoder.allMimeTypes()));
	}
	else {
		writerList = Arrays.asList(writers);
	}
	RequestedContentTypeResolver resolver = new RequestedContentTypeResolverBuilder().build();
	return new ResponseEntityResultHandler(writerList, resolver);
}
 
Example 6
private AbstractMessageWriterResultHandler initResultHandler(HttpMessageWriter<?>... writers) {
	List<HttpMessageWriter<?>> writerList;
	if (ObjectUtils.isEmpty(writers)) {
		writerList = new ArrayList<>();
		writerList.add(new EncoderHttpMessageWriter<>(new ByteBufferEncoder()));
		writerList.add(new EncoderHttpMessageWriter<>(CharSequenceEncoder.allMimeTypes()));
		writerList.add(new ResourceHttpMessageWriter());
		writerList.add(new EncoderHttpMessageWriter<>(new Jaxb2XmlEncoder()));
		writerList.add(new EncoderHttpMessageWriter<>(new Jackson2JsonEncoder()));
	}
	else {
		writerList = Arrays.asList(writers);
	}
	RequestedContentTypeResolver resolver = new RequestedContentTypeResolverBuilder().build();
	return new AbstractMessageWriterResultHandler(writerList, resolver) {};
}
 
Example 7
Source Project: java-technology-stack   Source File: RequestMappingInfo.java    License: MIT License 6 votes vote down vote up
@Override
public RequestMappingInfo build() {
	RequestedContentTypeResolver contentTypeResolver = this.options.getContentTypeResolver();

	PathPatternParser parser = (this.options.getPatternParser() != null ?
			this.options.getPatternParser() : new PathPatternParser());
	PatternsRequestCondition patternsCondition = new PatternsRequestCondition(parse(this.paths, parser));

	return new RequestMappingInfo(this.mappingName, patternsCondition,
			new RequestMethodsRequestCondition(this.methods),
			new ParamsRequestCondition(this.params),
			new HeadersRequestCondition(this.headers),
			new ConsumesRequestCondition(this.consumes, this.headers),
			new ProducesRequestCondition(this.produces, this.headers, contentTypeResolver),
			this.customCondition);
}
 
Example 8
@Test
public void requestMappingHandlerMapping() throws Exception {
	ApplicationContext context = loadConfig(WebFluxConfig.class);
	final Field field = ReflectionUtils.findField(PathPatternParser.class, "matchOptionalTrailingSeparator");
	ReflectionUtils.makeAccessible(field);

	String name = "requestMappingHandlerMapping";
	RequestMappingHandlerMapping mapping = context.getBean(name, RequestMappingHandlerMapping.class);
	assertNotNull(mapping);

	assertEquals(0, mapping.getOrder());

	PathPatternParser patternParser = mapping.getPathPatternParser();
	assertNotNull(patternParser);
	boolean matchOptionalTrailingSlash = (boolean) ReflectionUtils.getField(field, patternParser);
	assertTrue(matchOptionalTrailingSlash);

	name = "webFluxContentTypeResolver";
	RequestedContentTypeResolver resolver = context.getBean(name, RequestedContentTypeResolver.class);
	assertSame(resolver, mapping.getContentTypeResolver());

	ServerWebExchange exchange = MockServerWebExchange.from(get("/path").accept(MediaType.APPLICATION_JSON));
	assertEquals(Collections.singletonList(MediaType.APPLICATION_JSON), resolver.resolveMediaTypes(exchange));
}
 
Example 9
private ResponseEntityResultHandler createHandler(HttpMessageWriter<?>... writers) {
	List<HttpMessageWriter<?>> writerList;
	if (ObjectUtils.isEmpty(writers)) {
		writerList = new ArrayList<>();
		writerList.add(new EncoderHttpMessageWriter<>(new ByteBufferEncoder()));
		writerList.add(new EncoderHttpMessageWriter<>(CharSequenceEncoder.textPlainOnly()));
		writerList.add(new ResourceHttpMessageWriter());
		writerList.add(new EncoderHttpMessageWriter<>(new Jaxb2XmlEncoder()));
		writerList.add(new EncoderHttpMessageWriter<>(new Jackson2JsonEncoder()));
		writerList.add(new EncoderHttpMessageWriter<>(CharSequenceEncoder.allMimeTypes()));
	}
	else {
		writerList = Arrays.asList(writers);
	}
	RequestedContentTypeResolver resolver = new RequestedContentTypeResolverBuilder().build();
	return new ResponseEntityResultHandler(writerList, resolver);
}
 
Example 10
private AbstractMessageWriterResultHandler initResultHandler(HttpMessageWriter<?>... writers) {
	List<HttpMessageWriter<?>> writerList;
	if (ObjectUtils.isEmpty(writers)) {
		writerList = new ArrayList<>();
		writerList.add(new EncoderHttpMessageWriter<>(new ByteBufferEncoder()));
		writerList.add(new EncoderHttpMessageWriter<>(CharSequenceEncoder.allMimeTypes()));
		writerList.add(new ResourceHttpMessageWriter());
		writerList.add(new EncoderHttpMessageWriter<>(new Jaxb2XmlEncoder()));
		writerList.add(new EncoderHttpMessageWriter<>(new Jackson2JsonEncoder()));
	}
	else {
		writerList = Arrays.asList(writers);
	}
	RequestedContentTypeResolver resolver = new RequestedContentTypeResolverBuilder().build();
	return new AbstractMessageWriterResultHandler(writerList, resolver) {};
}
 
Example 11
Source Project: spring-analysis-note   Source File: WebFluxConfigurationSupport.java    License: 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 12
Source Project: spring-analysis-note   Source File: WebFluxConfigurationSupport.java    License: 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 13
Source Project: spring-analysis-note   Source File: WebFluxConfigurationSupport.java    License: MIT License 5 votes vote down vote up
@Bean
public ViewResolutionResultHandler viewResolutionResultHandler(
		ReactiveAdapterRegistry webFluxAdapterRegistry,
		RequestedContentTypeResolver webFluxContentTypeResolver) {
	ViewResolverRegistry registry = getViewResolverRegistry();
	List<ViewResolver> resolvers = registry.getViewResolvers();
	ViewResolutionResultHandler handler = new ViewResolutionResultHandler(
			resolvers, webFluxContentTypeResolver, webFluxAdapterRegistry);
	handler.setDefaultViews(registry.getDefaultViews());
	handler.setOrder(registry.getOrder());
	return handler;
}
 
Example 14
Source Project: spring-analysis-note   Source File: ViewResolutionResultHandler.java    License: MIT License 5 votes vote down vote up
/**
 * Constructor with an {@link ReactiveAdapterRegistry} instance.
 * @param viewResolvers the view resolver to use
 * @param contentTypeResolver to determine the requested content type
 * @param registry for adaptation to reactive types
 */
public ViewResolutionResultHandler(List<ViewResolver> viewResolvers,
		RequestedContentTypeResolver contentTypeResolver, ReactiveAdapterRegistry registry) {

	super(contentTypeResolver, registry);
	this.viewResolvers.addAll(viewResolvers);
	AnnotationAwareOrderComparator.sort(this.viewResolvers);
}
 
Example 15
Source Project: spring-analysis-note   Source File: HandlerResultHandlerSupport.java    License: MIT License 5 votes vote down vote up
protected HandlerResultHandlerSupport(RequestedContentTypeResolver contentTypeResolver,
		ReactiveAdapterRegistry adapterRegistry) {

	Assert.notNull(contentTypeResolver, "RequestedContentTypeResolver is required");
	Assert.notNull(adapterRegistry, "ReactiveAdapterRegistry is required");
	this.contentTypeResolver = contentTypeResolver;
	this.adapterRegistry = adapterRegistry;
}
 
Example 16
Source Project: spring-analysis-note   Source File: ResponseEntityResultHandler.java    License: MIT License 5 votes vote down vote up
/**
 * Constructor with an {@link ReactiveAdapterRegistry} instance.
 * @param writers writers for serializing to the response body
 * @param resolver to determine the requested content type
 * @param registry for adaptation to reactive types
 */
public ResponseEntityResultHandler(List<HttpMessageWriter<?>> writers,
		RequestedContentTypeResolver resolver, ReactiveAdapterRegistry registry) {

	super(writers, resolver, registry);
	setOrder(0);
}
 
Example 17
/**
 * Constructor with an additional {@link ReactiveAdapterRegistry}.
 * @param messageWriters for serializing Objects to the response body stream
 * @param contentTypeResolver for resolving the requested content type
 * @param adapterRegistry for adapting other reactive types (e.g. rx.Observable,
 * rx.Single, etc.) to Flux or Mono
 */
protected AbstractMessageWriterResultHandler(List<HttpMessageWriter<?>> messageWriters,
		RequestedContentTypeResolver contentTypeResolver, ReactiveAdapterRegistry adapterRegistry) {

	super(contentTypeResolver, adapterRegistry);
	Assert.notEmpty(messageWriters, "At least one message writer is required");
	this.messageWriters = messageWriters;
}
 
Example 18
Source Project: spring-analysis-note   Source File: ResponseBodyResultHandler.java    License: MIT License 5 votes vote down vote up
/**
 * Constructor with an {@link ReactiveAdapterRegistry} instance.
 * @param writers writers for serializing to the response body
 * @param resolver to determine the requested content type
 * @param registry for adaptation to reactive types
 */
public ResponseBodyResultHandler(List<HttpMessageWriter<?>> writers,
		RequestedContentTypeResolver resolver, ReactiveAdapterRegistry registry) {

	super(writers, resolver, registry);
	setOrder(100);
}
 
Example 19
@Test
public void responseEntityResultHandler() throws Exception {
	ApplicationContext context = loadConfig(WebFluxConfig.class);

	String name = "responseEntityResultHandler";
	ResponseEntityResultHandler handler = context.getBean(name, ResponseEntityResultHandler.class);
	assertNotNull(handler);

	assertEquals(0, handler.getOrder());

	List<HttpMessageWriter<?>> writers = handler.getMessageWriters();
	assertEquals(11, writers.size());

	assertHasMessageWriter(writers, forClass(byte[].class), APPLICATION_OCTET_STREAM);
	assertHasMessageWriter(writers, forClass(ByteBuffer.class), APPLICATION_OCTET_STREAM);
	assertHasMessageWriter(writers, forClass(String.class), TEXT_PLAIN);
	assertHasMessageWriter(writers, forClass(Resource.class), IMAGE_PNG);
	assertHasMessageWriter(writers, forClass(Message.class), new MediaType("application", "x-protobuf"));
	assertHasMessageWriter(writers, forClass(TestBean.class), APPLICATION_XML);
	assertHasMessageWriter(writers, forClass(TestBean.class), APPLICATION_JSON);
	assertHasMessageWriter(writers, forClass(TestBean.class), new MediaType("application", "x-jackson-smile"));
	assertHasMessageWriter(writers, forClass(TestBean.class), MediaType.parseMediaType("text/event-stream"));

	name = "webFluxContentTypeResolver";
	RequestedContentTypeResolver resolver = context.getBean(name, RequestedContentTypeResolver.class);
	assertSame(resolver, handler.getContentTypeResolver());
}
 
Example 20
@Test
public void responseBodyResultHandler() throws Exception {
	ApplicationContext context = loadConfig(WebFluxConfig.class);

	String name = "responseBodyResultHandler";
	ResponseBodyResultHandler handler = context.getBean(name, ResponseBodyResultHandler.class);
	assertNotNull(handler);

	assertEquals(100, handler.getOrder());

	List<HttpMessageWriter<?>> writers = handler.getMessageWriters();
	assertEquals(11, writers.size());

	assertHasMessageWriter(writers, forClass(byte[].class), APPLICATION_OCTET_STREAM);
	assertHasMessageWriter(writers, forClass(ByteBuffer.class), APPLICATION_OCTET_STREAM);
	assertHasMessageWriter(writers, forClass(String.class), TEXT_PLAIN);
	assertHasMessageWriter(writers, forClass(Resource.class), IMAGE_PNG);
	assertHasMessageWriter(writers, forClass(Message.class), new MediaType("application", "x-protobuf"));
	assertHasMessageWriter(writers, forClass(TestBean.class), APPLICATION_XML);
	assertHasMessageWriter(writers, forClass(TestBean.class), APPLICATION_JSON);
	assertHasMessageWriter(writers, forClass(TestBean.class), new MediaType("application", "x-jackson-smile"));
	assertHasMessageWriter(writers, forClass(TestBean.class), null);

	name = "webFluxContentTypeResolver";
	RequestedContentTypeResolver resolver = context.getBean(name, RequestedContentTypeResolver.class);
	assertSame(resolver, handler.getContentTypeResolver());
}
 
Example 21
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 22
@Before
public void setup() throws Exception {
	List<HttpMessageWriter<?>> writerList = new ArrayList<>(5);
	writerList.add(new EncoderHttpMessageWriter<>(new ByteBufferEncoder()));
	writerList.add(new EncoderHttpMessageWriter<>(CharSequenceEncoder.allMimeTypes()));
	writerList.add(new ResourceHttpMessageWriter());
	writerList.add(new EncoderHttpMessageWriter<>(new Jaxb2XmlEncoder()));
	writerList.add(new EncoderHttpMessageWriter<>(new Jackson2JsonEncoder()));
	RequestedContentTypeResolver resolver = new RequestedContentTypeResolverBuilder().build();
	this.resultHandler = new ResponseBodyResultHandler(writerList, resolver);
}
 
Example 23
Source Project: Moss   Source File: AdminServerWebConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerMapping adminHandlerMapping(
    RequestedContentTypeResolver webFluxContentTypeResolver) {
    org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerMapping mapping = new de.codecentric.boot.admin.server.web.reactive.AdminControllerHandlerMapping(
        adminServerProperties.getContextPath());
    mapping.setOrder(0);
    mapping.setContentTypeResolver(webFluxContentTypeResolver);
    return mapping;
}
 
Example 24
/**
 * Constructor with an {@link ReactiveAdapterRegistry} instance.
 * @param viewResolvers the view resolver to use
 * @param contentTypeResolver to determine the requested content type
 * @param registry for adaptation to reactive types
 */
public ViewResolutionResultHandler(List<ViewResolver> viewResolvers,
		RequestedContentTypeResolver contentTypeResolver, ReactiveAdapterRegistry registry) {

	super(contentTypeResolver, registry);
	this.viewResolvers.addAll(viewResolvers);
	AnnotationAwareOrderComparator.sort(this.viewResolvers);
}
 
Example 25
protected HandlerResultHandlerSupport(RequestedContentTypeResolver contentTypeResolver,
		ReactiveAdapterRegistry adapterRegistry) {

	Assert.notNull(contentTypeResolver, "RequestedContentTypeResolver is required");
	Assert.notNull(adapterRegistry, "ReactiveAdapterRegistry is required");
	this.contentTypeResolver = contentTypeResolver;
	this.adapterRegistry = adapterRegistry;
}
 
Example 26
Source Project: java-technology-stack   Source File: ProducesRequestCondition.java    License: MIT License 5 votes vote down vote up
/**
 * Private constructor with already parsed media type expressions.
 */
private ProducesRequestCondition(Collection<ProduceMediaTypeExpression> expressions,
		RequestedContentTypeResolver resolver) {

	this.expressions = new ArrayList<>(expressions);
	Collections.sort(this.expressions);
	this.contentTypeResolver = (resolver != null ? resolver : new RequestedContentTypeResolverBuilder().build());
}
 
Example 27
/**
 * Constructor with an {@link ReactiveAdapterRegistry} instance.
 * @param writers writers for serializing to the response body
 * @param resolver to determine the requested content type
 * @param registry for adaptation to reactive types
 */
public ResponseEntityResultHandler(List<HttpMessageWriter<?>> writers,
		RequestedContentTypeResolver resolver, ReactiveAdapterRegistry registry) {

	super(writers, resolver, registry);
	setOrder(0);
}
 
Example 28
/**
 * Constructor with an additional {@link ReactiveAdapterRegistry}.
 * @param messageWriters for serializing Objects to the response body stream
 * @param contentTypeResolver for resolving the requested content type
 * @param adapterRegistry for adapting other reactive types (e.g. rx.Observable,
 * rx.Single, etc.) to Flux or Mono
 */
protected AbstractMessageWriterResultHandler(List<HttpMessageWriter<?>> messageWriters,
		RequestedContentTypeResolver contentTypeResolver, ReactiveAdapterRegistry adapterRegistry) {

	super(contentTypeResolver, adapterRegistry);
	Assert.notEmpty(messageWriters, "At least one message writer is required");
	this.messageWriters = messageWriters;
}
 
Example 29
Source Project: java-technology-stack   Source File: ResponseBodyResultHandler.java    License: MIT License 5 votes vote down vote up
/**
 * Constructor with an {@link ReactiveAdapterRegistry} instance.
 * @param writers writers for serializing to the response body
 * @param resolver to determine the requested content type
 * @param registry for adaptation to reactive types
 */
public ResponseBodyResultHandler(List<HttpMessageWriter<?>> writers,
		RequestedContentTypeResolver resolver, ReactiveAdapterRegistry registry) {

	super(writers, resolver, registry);
	setOrder(100);
}
 
Example 30
@Test
public void responseEntityResultHandler() throws Exception {
	ApplicationContext context = loadConfig(WebFluxConfig.class);

	String name = "responseEntityResultHandler";
	ResponseEntityResultHandler handler = context.getBean(name, ResponseEntityResultHandler.class);
	assertNotNull(handler);

	assertEquals(0, handler.getOrder());

	List<HttpMessageWriter<?>> writers = handler.getMessageWriters();
	assertEquals(11, writers.size());

	assertHasMessageWriter(writers, forClass(byte[].class), APPLICATION_OCTET_STREAM);
	assertHasMessageWriter(writers, forClass(ByteBuffer.class), APPLICATION_OCTET_STREAM);
	assertHasMessageWriter(writers, forClass(String.class), TEXT_PLAIN);
	assertHasMessageWriter(writers, forClass(Resource.class), IMAGE_PNG);
	assertHasMessageWriter(writers, forClass(Message.class), new MediaType("application", "x-protobuf"));
	assertHasMessageWriter(writers, forClass(TestBean.class), APPLICATION_XML);
	assertHasMessageWriter(writers, forClass(TestBean.class), APPLICATION_JSON);
	assertHasMessageWriter(writers, forClass(TestBean.class), new MediaType("application", "x-jackson-smile"));
	assertHasMessageWriter(writers, forClass(TestBean.class), MediaType.parseMediaType("text/event-stream"));

	name = "webFluxContentTypeResolver";
	RequestedContentTypeResolver resolver = context.getBean(name, RequestedContentTypeResolver.class);
	assertSame(resolver, handler.getContentTypeResolver());
}