001/* 002 * Copyright 2002-2014 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.http.converter.feed; 018 019import com.rometools.rome.feed.atom.Feed; 020 021import org.springframework.http.MediaType; 022 023/** 024 * Implementation of {@link org.springframework.http.converter.HttpMessageConverter} 025 * that can read and write Atom feeds. Specifically, this converter can handle {@link Feed} 026 * objects from the <a href="https://github.com/rometools/rome">ROME</a> project. 027 * 028 * <p>><b>NOTE: As of Spring 4.1, this is based on the {@code com.rometools} 029 * variant of ROME, version 1.5. Please upgrade your build dependency.</b> 030 * 031 * <p>By default, this converter reads and writes the media type ({@code application/atom+xml}). 032 * This can be overridden through the {@link #setSupportedMediaTypes supportedMediaTypes} property. 033 * 034 * @author Arjen Poutsma 035 * @since 3.0.2 036 * @see Feed 037 */ 038public class AtomFeedHttpMessageConverter extends AbstractWireFeedHttpMessageConverter<Feed> { 039 040 public AtomFeedHttpMessageConverter() { 041 super(new MediaType("application", "atom+xml")); 042 } 043 044 @Override 045 protected boolean supports(Class<?> clazz) { 046 return Feed.class.isAssignableFrom(clazz); 047 } 048 049}