Introduce media types for application/rss+xml
Issue: SPR-15109
This commit is contained in:
parent
cc53d597c0
commit
8b960099f1
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -123,6 +123,18 @@ public class MediaType extends MimeType implements Serializable {
|
|||
*/
|
||||
public final static String APPLICATION_PDF_VALUE = "application/pdf";
|
||||
|
||||
/**
|
||||
* Public constant media type for {@code application/rss+xml}.
|
||||
* @since 4.3.6
|
||||
*/
|
||||
public final static MediaType APPLICATION_RSS_XML;
|
||||
|
||||
/**
|
||||
* A String equivalent of {@link MediaType#APPLICATION_RSS_XML}.
|
||||
* @since 4.3.6
|
||||
*/
|
||||
public final static String APPLICATION_RSS_XML_VALUE = "application/rss+xml";
|
||||
|
||||
/**
|
||||
* Public constant media type for {@code application/xhtml+xml}.
|
||||
*/
|
||||
|
|
@ -183,6 +195,19 @@ public class MediaType extends MimeType implements Serializable {
|
|||
*/
|
||||
public final static String MULTIPART_FORM_DATA_VALUE = "multipart/form-data";
|
||||
|
||||
/**
|
||||
* Public constant media type for {@code text/event-stream}.
|
||||
* @since 4.3.6
|
||||
* @see <a href="https://www.w3.org/TR/eventsource/">Server-Sent Events W3C recommendation</a>
|
||||
*/
|
||||
public final static MediaType TEXT_EVENT_STREAM;
|
||||
|
||||
/**
|
||||
* A String equivalent of {@link MediaType#TEXT_EVENT_STREAM}.
|
||||
* @since 4.3.6
|
||||
*/
|
||||
public final static String TEXT_EVENT_STREAM_VALUE = "text/event-stream";
|
||||
|
||||
/**
|
||||
* Public constant media type for {@code text/html}.
|
||||
*/
|
||||
|
|
@ -237,12 +262,14 @@ public class MediaType extends MimeType implements Serializable {
|
|||
APPLICATION_JSON_UTF8 = valueOf(APPLICATION_JSON_UTF8_VALUE);
|
||||
APPLICATION_OCTET_STREAM = valueOf(APPLICATION_OCTET_STREAM_VALUE);
|
||||
APPLICATION_PDF = valueOf(APPLICATION_PDF_VALUE);
|
||||
APPLICATION_RSS_XML = valueOf(APPLICATION_RSS_XML_VALUE);
|
||||
APPLICATION_XHTML_XML = valueOf(APPLICATION_XHTML_XML_VALUE);
|
||||
APPLICATION_XML = valueOf(APPLICATION_XML_VALUE);
|
||||
IMAGE_GIF = valueOf(IMAGE_GIF_VALUE);
|
||||
IMAGE_JPEG = valueOf(IMAGE_JPEG_VALUE);
|
||||
IMAGE_PNG = valueOf(IMAGE_PNG_VALUE);
|
||||
MULTIPART_FORM_DATA = valueOf(MULTIPART_FORM_DATA_VALUE);
|
||||
TEXT_EVENT_STREAM = valueOf(TEXT_EVENT_STREAM_VALUE);
|
||||
TEXT_HTML = valueOf(TEXT_HTML_VALUE);
|
||||
TEXT_MARKDOWN = valueOf(TEXT_MARKDOWN_VALUE);
|
||||
TEXT_PLAIN = valueOf(TEXT_PLAIN_VALUE);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -38,7 +38,7 @@ import org.springframework.http.MediaType;
|
|||
public class RssChannelHttpMessageConverter extends AbstractWireFeedHttpMessageConverter<Channel> {
|
||||
|
||||
public RssChannelHttpMessageConverter() {
|
||||
super(new MediaType("application", "rss+xml"));
|
||||
super(MediaType.APPLICATION_RSS_XML);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -433,7 +433,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
|||
Properties props = new Properties();
|
||||
if (romePresent) {
|
||||
props.put("atom", MediaType.APPLICATION_ATOM_XML_VALUE);
|
||||
props.put("rss", "application/rss+xml");
|
||||
props.put("rss", MediaType.APPLICATION_RSS_XML_VALUE);
|
||||
}
|
||||
if (jaxb2Present || jackson2XmlPresent) {
|
||||
props.put("xml", MediaType.APPLICATION_XML_VALUE);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -73,7 +73,6 @@ import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
|||
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
|
||||
import org.springframework.web.servlet.HandlerAdapter;
|
||||
import org.springframework.web.servlet.HandlerExceptionResolver;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.HandlerMapping;
|
||||
import org.springframework.web.servlet.ViewResolver;
|
||||
import org.springframework.web.servlet.handler.AbstractHandlerMapping;
|
||||
|
|
@ -381,7 +380,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
|||
Map<String, MediaType> map = new HashMap<String, MediaType>(4);
|
||||
if (romePresent) {
|
||||
map.put("atom", MediaType.APPLICATION_ATOM_XML);
|
||||
map.put("rss", MediaType.valueOf("application/rss+xml"));
|
||||
map.put("rss", MediaType.APPLICATION_RSS_XML);
|
||||
}
|
||||
if (jaxb2Present || jackson2XmlPresent) {
|
||||
map.put("xml", MediaType.APPLICATION_XML);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -24,6 +24,8 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import com.rometools.rome.feed.rss.Channel;
|
||||
import com.rometools.rome.feed.rss.Item;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
/**
|
||||
* Abstract superclass for RSS Feed views, using the
|
||||
* <a href="https://github.com/rometools/rome">ROME</a> package.
|
||||
|
|
@ -46,9 +48,10 @@ import com.rometools.rome.feed.rss.Item;
|
|||
public abstract class AbstractRssFeedView extends AbstractFeedView<Channel> {
|
||||
|
||||
public AbstractRssFeedView() {
|
||||
setContentType("application/rss+xml");
|
||||
setContentType(MediaType.APPLICATION_RSS_XML_VALUE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new Channel instance to hold the entries.
|
||||
* <p>By default returns an RSS 2.0 channel, but the subclass can specify any channel.
|
||||
|
|
|
|||
Loading…
Reference in New Issue