package com.github.vergnes.albumindexer.container;

import com.rometools.fetcher.FeedFetcher;
import com.rometools.fetcher.impl.FeedFetcherCache;
import com.rometools.fetcher.impl.HashMapFeedInfoCache;
import com.rometools.fetcher.impl.HttpClientFeedFetcher;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.net.MalformedURLException;
import java.net.URL;

/**
 * Created by denis.vergnes on 22/08/2015.
 */
@Configuration
public class AlbumIndexerContainer {

    @Value("${rss.url}")
    private URL feedUrl;

    @Bean
    public FeedFetcher feedFetcher() {
        FeedFetcherCache feedInfoCache = HashMapFeedInfoCache.getInstance();
        return new HttpClientFeedFetcher(feedInfoCache);
    }

    @Bean
    public URL rssFeedUrl() throws MalformedURLException {
        return feedUrl;
    }
}

@@ -248,24 +248,71 @@
 eedFetcher;%0A
+import org.apache.catalina.filters.CorsFilter;%0A
 import org.s
@@ -878,16 +878,103 @@
 %0A    %7D%0A%0A
+    @Bean%0A    public CorsFilter corsFilter() %7B%0A        return new CorsFilter();%0A    %7D%0A%0A
     @Bea

add a cors filter for cross domain request