You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ga...@apache.org on 2006/05/13 17:45:17 UTC

svn commit: r406122 - in /incubator/roller/branches/roller_2.3/src/org/apache/roller: presentation/newsfeeds/NewsfeedCache.java util/RegexUtil.java webservices/adminapi/AtomAdminServlet.java webservices/atomprotocol/AtomServlet.java

Author: gangolli
Date: Sat May 13 08:45:16 2006
New Revision: 406122

URL: http://svn.apache.org/viewcvs?rev=406122&view=rev
Log:
Integrate fixes for ROL-1132 to Roller 2.3 branch.  Changes uses of UTF8 and utf8 to UTF-8 and utf-8.

Modified:
    incubator/roller/branches/roller_2.3/src/org/apache/roller/presentation/newsfeeds/NewsfeedCache.java
    incubator/roller/branches/roller_2.3/src/org/apache/roller/util/RegexUtil.java
    incubator/roller/branches/roller_2.3/src/org/apache/roller/webservices/adminapi/AtomAdminServlet.java
    incubator/roller/branches/roller_2.3/src/org/apache/roller/webservices/atomprotocol/AtomServlet.java

Modified: incubator/roller/branches/roller_2.3/src/org/apache/roller/presentation/newsfeeds/NewsfeedCache.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.3/src/org/apache/roller/presentation/newsfeeds/NewsfeedCache.java?rev=406122&r1=406121&r2=406122&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.3/src/org/apache/roller/presentation/newsfeeds/NewsfeedCache.java (original)
+++ incubator/roller/branches/roller_2.3/src/org/apache/roller/presentation/newsfeeds/NewsfeedCache.java Sat May 13 08:45:16 2006
@@ -1,18 +1 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*  contributor license agreements.  The ASF licenses this file to You
-* under the Apache License, Version 2.0 (the "License"); you may not
-* use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.  For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
-package org.apache.roller.presentation.newsfeeds;

import java.io.InputStreamReader;
import java.net.URL;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.roller.util.LRUCache2;

import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
import java.io.UnsupportedEncodingException;
import java.net.URLConnection;
import org.apache.roller.config.RollerConfig;

/**
 * Returns parsed RSS feed by pulling one from a cache or by retrieving and
 * parging the specified feed using the Flock RSS parser.
 * <br />
 * TODO: use PlanetRoller to implement NewsfeedCache instead.
 * <br />
 * @author Lance Lavandowska
 * @author Dave Johnson
 */
public class NewsfeedCache
{
    private static Log mLogger = LogFactory.getFactory().getInstance(
            NewsfeedCache.class);

    /** Static singleton * */
    private static NewsfeedCache mInstance = null;

    /** Instance vars * */
    private boolean 
 aggregator_enabled = true;
    private boolean aggregator_cache_enabled = true;
    private int aggregator_cache_timeout = 14400;

    /** LRU cache */
    LRUCache2 mCache = null;

    /** Constructor */
    private NewsfeedCache()
    {
        // lookup the props we need
        String enabled = RollerConfig.getProperty("aggregator.enabled");
        String usecache = RollerConfig.getProperty("aggregator.cache.enabled");
        String cachetime = RollerConfig.getProperty("aggregator.cache.timeout");
        
        if("true".equalsIgnoreCase(enabled))
            this.aggregator_enabled = true;
        
        if("true".equalsIgnoreCase(usecache))
            this.aggregator_cache_enabled = true;
        
        try {
            this.aggregator_cache_timeout = Integer.parseInt(cachetime);
        } catch(Exception e) { mLogger.warn(e); }
        
        // finally ... create the cache
        this.mCache = new LRUCache2(100, 1000 * this.aggregator_cache_timeout);
  
   }

    /** static singleton retriever */
    public static NewsfeedCache getInstance()
    {
        synchronized (NewsfeedCache.class)
        {
            if (mInstance == null)
            {
                if (mLogger.isDebugEnabled())
                {
                    mLogger.debug("Instantiating new NewsfeedCache");
                }
                mInstance = new NewsfeedCache();
            }
        }
        return mInstance;
    }

    /**
     * Returns a Channel object for the supplied RSS newsfeed URL.
     * 
     * @param feedUrl
     *            RSS newsfeed URL.
     * @return FlockFeedI for specified RSS newsfeed URL.
     */
    public SyndFeed getChannel(String feedUrl)
    {
        SyndFeed feed = null;
        try
        {
            // If aggregator has been disable return null
            if (!aggregator_enabled)
            {
                return null;
            }

            if (aggregator_cache_enabled)
            {
             
    if (mLogger.isDebugEnabled())
                {
                    mLogger.debug("Newsfeed: use Cache for " + feedUrl);
                }

                // Get pre-parsed feed from the cache
                feed = (SyndFeed) mCache.get(feedUrl);
                if (mLogger.isDebugEnabled())
                {
                    mLogger.debug("Newsfeed: got from Cache");
                }

                if (feed == null)
                {
                    try
                    {
                        // Parse the feed
                        SyndFeedInput feedInput = new SyndFeedInput();
                        feed = feedInput.build(new InputStreamReader(
                                new URL(feedUrl).openStream()));
                    }
                    catch (Exception e1)
                    {
                        mLogger.info("Error parsing RSS: " + feedUrl);
                    }
                }
                // Store parsed feed in the cache
 
                mCache.put(feedUrl, feed);
                mLogger.debug("Newsfeed: not in Cache");
            }
            else
            {
                if (mLogger.isDebugEnabled())
                {
                    mLogger.debug("Newsfeed: not using Cache for " + feedUrl);
                }
                try
                {
                        // charset fix from Jason Rumney (see ROL-766)
                        URLConnection connection = new URL(feedUrl).openConnection();
                        connection.connect();
                        String contentType = connection.getContentType();
                        // Default charset to UTF-8, since we are expecting XML
                        String charset = "UTF8";
                        if (contentType != null) {
                            int charsetStart = contentType.indexOf("charset=");
                            if (charsetStart >= 0) {
                                int charsetEnd = conte
 ntType.indexOf(";", charsetStart);
                                if (charsetEnd == -1) charsetEnd = contentType.length();
                                charsetStart += "charset=".length();
                                charset = contentType.substring(charsetStart, charsetEnd);
                                // Check that charset is recognized by Java
                                try {
                                    byte[] test = "test".getBytes(charset);
                                }
                                catch (UnsupportedEncodingException codingEx) {
                                    // default to UTF-8
                                    charset = "UTF8";
                                }
                            }
                        } 
                        // Parse the feed
                        SyndFeedInput feedInput = new SyndFeedInput();
                        feed = feedInput.build(new InputStreamReader(
                 
        connection.getInputStream(), charset)); 
                }
                catch (Exception e1)
                {
                    mLogger.info("Error parsing RSS: " + feedUrl);
                }
            }
        }
        catch (Exception ioe)
        {
            if (mLogger.isDebugEnabled())
            {
                mLogger.debug("Newsfeed: Unexpected exception", ioe);
            }
        }
        return feed;
    }
}
\ No newline at end of file
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
*  contributor license agreements.  The ASF licenses this file to You
* under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.  For additional information regarding
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
package org.apache.roller.presentation.newsfeeds;

import java.io.InputStreamReader;
import java.net.URL;

import org.apache.commons.logging.Log;
import org.apache.com
 mons.logging.LogFactory;
import org.apache.roller.util.LRUCache2;

import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
import java.io.UnsupportedEncodingException;
import java.net.URLConnection;
import org.apache.roller.config.RollerConfig;

/**
 * Returns parsed RSS feed by pulling one from a cache or by retrieving and
 * parging the specified feed using the Flock RSS parser.
 * <br />
 * TODO: use PlanetRoller to implement NewsfeedCache instead.
 * <br />
 * @author Lance Lavandowska
 * @author Dave Johnson
 */
public class NewsfeedCache
{
    private static Log mLogger = LogFactory.getFactory().getInstance(
            NewsfeedCache.class);

    /** Static singleton * */
    private static NewsfeedCache mInstance = null;

    /** Instance vars * */
    private boolean aggregator_enabled = true;
    private boolean aggregator_cache_enabled = true;
    private int aggregator_cache_timeout = 14400;

    /** LRU cache */
    LRUCache2 m
 Cache = null;

    /** Constructor */
    private NewsfeedCache()
    {
        // lookup the props we need
        String enabled = RollerConfig.getProperty("aggregator.enabled");
        String usecache = RollerConfig.getProperty("aggregator.cache.enabled");
        String cachetime = RollerConfig.getProperty("aggregator.cache.timeout");
        
        if("true".equalsIgnoreCase(enabled))
            this.aggregator_enabled = true;
        
        if("true".equalsIgnoreCase(usecache))
            this.aggregator_cache_enabled = true;
        
        try {
            this.aggregator_cache_timeout = Integer.parseInt(cachetime);
        } catch(Exception e) { mLogger.warn(e); }
        
        // finally ... create the cache
        this.mCache = new LRUCache2(100, 1000 * this.aggregator_cache_timeout);
    }

    /** static singleton retriever */
    public static NewsfeedCache getInstance()
    {
        synchronized (NewsfeedCache.class)
        {
            if (mIn
 stance == null)
            {
                if (mLogger.isDebugEnabled())
                {
                    mLogger.debug("Instantiating new NewsfeedCache");
                }
                mInstance = new NewsfeedCache();
            }
        }
        return mInstance;
    }

    /**
     * Returns a Channel object for the supplied RSS newsfeed URL.
     * 
     * @param feedUrl
     *            RSS newsfeed URL.
     * @return FlockFeedI for specified RSS newsfeed URL.
     */
    public SyndFeed getChannel(String feedUrl)
    {
        SyndFeed feed = null;
        try
        {
            // If aggregator has been disable return null
            if (!aggregator_enabled)
            {
                return null;
            }

            if (aggregator_cache_enabled)
            {
                if (mLogger.isDebugEnabled())
                {
                    mLogger.debug("Newsfeed: use Cache for " + feedUrl);
                }

                // Get p
 re-parsed feed from the cache
                feed = (SyndFeed) mCache.get(feedUrl);
                if (mLogger.isDebugEnabled())
                {
                    mLogger.debug("Newsfeed: got from Cache");
                }

                if (feed == null)
                {
                    try
                    {
                        // Parse the feed
                        SyndFeedInput feedInput = new SyndFeedInput();
                        feed = feedInput.build(new InputStreamReader(
                                new URL(feedUrl).openStream()));
                    }
                    catch (Exception e1)
                    {
                        mLogger.info("Error parsing RSS: " + feedUrl);
                    }
                }
                // Store parsed feed in the cache
                mCache.put(feedUrl, feed);
                mLogger.debug("Newsfeed: not in Cache");
            }
            else
            {
                if (m
 Logger.isDebugEnabled())
                {
                    mLogger.debug("Newsfeed: not using Cache for " + feedUrl);
                }
                try
                {
                        // charset fix from Jason Rumney (see ROL-766)
                        URLConnection connection = new URL(feedUrl).openConnection();
                        connection.connect();
                        String contentType = connection.getContentType();
                        // Default charset to UTF-8, since we are expecting XML
                        String charset = "UTF-8";
                        if (contentType != null) {
                            int charsetStart = contentType.indexOf("charset=");
                            if (charsetStart >= 0) {
                                int charsetEnd = contentType.indexOf(";", charsetStart);
                                if (charsetEnd == -1) charsetEnd = contentType.length();
                                charsetSta
 rt += "charset=".length();
                                charset = contentType.substring(charsetStart, charsetEnd);
                                // Check that charset is recognized by Java
                                try {
                                    byte[] test = "test".getBytes(charset);
                                }
                                catch (UnsupportedEncodingException codingEx) {
                                    // default to UTF-8
                                    charset = "UTF-8";
                                }
                            }
                        } 
                        // Parse the feed
                        SyndFeedInput feedInput = new SyndFeedInput();
                        feed = feedInput.build(new InputStreamReader(
                        connection.getInputStream(), charset)); 
                }
                catch (Exception e1)
                {
                    mLogger.info("Error pars
 ing RSS: " + feedUrl);
                }
            }
        }
        catch (Exception ioe)
        {
            if (mLogger.isDebugEnabled())
            {
                mLogger.debug("Newsfeed: Unexpected exception", ioe);
            }
        }
        return feed;
    }
}
\ No newline at end of file

Modified: incubator/roller/branches/roller_2.3/src/org/apache/roller/util/RegexUtil.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.3/src/org/apache/roller/util/RegexUtil.java?rev=406122&r1=406121&r2=406122&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.3/src/org/apache/roller/util/RegexUtil.java (original)
+++ incubator/roller/branches/roller_2.3/src/org/apache/roller/util/RegexUtil.java Sat May 13 08:45:16 2006
@@ -1,49 +1 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*  contributor license agreements.  The ASF licenses this file to You
-* under the Apache License, Version 2.0 (the "License"); you may not
-* use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.  For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
-/*
- * Created on Nov 8, 2003
- *
- */
-package org.apache.roller.util;
-import org.apache.commons.codec.binary.Hex;
-
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-

/**
 * @author lance
 */
public class RegexUtil
{
    public static final Pattern mailtoPattern = Pattern.compile("mailto:([a-zA-Z0-9\\.]+@[a-zA-Z0-9\\.]+\\.[a-zA-Z0-9]+)");
    public static final Pattern emailPattern = Pattern.compile("\\b[a-zA-Z0-9\\.]+(@)([a-zA-Z0-9\\.]+)(\\.)([a-zA-Z0-9]+)\\b");
    
    public static String encodeEmail(String str)
    {
        // obfuscate mailto's: turns them into hex encoded,
        // so that browsers can still understand the mailto link
        Matcher mailtoMatch = mailtoPattern.matcher(str);
        while (mailtoMatch.find())
        {
            String email = mailtoMatch.group(1);
            //System.out.println("email=" + email);
            String hexed = encode(email);
            str = str.replaceFirst("mailto:"+email, "mailto:"+hexed);
        }
        
        return obfuscateEmail(str);
    }

    /**
     * obfuscate plaintext emails: makes them
     * "human-readable" - still too easy for
     * machines to pars
 e however.
     * 
     * @param str
     * @return
     */
    public static String obfuscateEmail(String str)
    {
        Matcher emailMatch = emailPattern.matcher(str);
        while (emailMatch.find())
        {
            String at = emailMatch.group(1);
            //System.out.println("at=" + at);
            str = str.replaceFirst(at, "-AT-");
            
            String dot = emailMatch.group(2) + emailMatch.group(3) + emailMatch.group(4);
            String newDot = emailMatch.group(2) + "-DOT-" + emailMatch.group(4);
            //System.out.println("dot=" + dot);
            str = str.replaceFirst(dot, newDot);
        }
        return str;
    }
-    
-    /**
-     * Return the specified match "groups" from the pattern.
-     * For each group matched a String will be entered in the ArrayList.
-     * 
-     * @param pattern The Pattern to use.
-     * @param match The String to match against.
-     * @param group The group number to return in case of a match.
-     * @return
-     */
-    public static ArrayList getMatches(Pattern pattern, String match, int group)
-    {
-        ArrayList matches = new ArrayList();
-        Matcher matcher = pattern.matcher(match);
-        while (matcher.find()) 
-        {
-            matches.add( matcher.group(group) );
-        }
-        return matches;
-    }

	/**
     * Thanks to the folks at Blojsom (http://sf.net/projects/blojsom)
     * for showing me what I was doing wrong with the Hex class.
     * 
	 * @param email
	 * @return
	 */
	public static String encode(String email)
	{
        StringBuffer result = new StringBuffer();
        try {
            char[] hexString = Hex.encodeHex(email.getBytes("UTF8"));
            for (int i = 0; i < hexString.length; i++) {
                if (i % 2 == 0) {
                    result.append("%");
                }
                result.append(hexString[i]);
            }
        } catch (UnsupportedEncodingException e) {
            return email;
        }

        return result.toString();
	}
}
\ No newline at end of file
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
*  contributor license agreements.  The ASF licenses this file to You
* under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.  For additional information regarding
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
/*
 * Created on Nov 8, 2003
 *
 */
package org.apache.roller.util;
import org.apache.commons.codec.binary.Hex;

import java.io.UnsupportedEncodingException;
import ja
 va.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


/**
 * @author lance
 */
public class RegexUtil
{
    public static final Pattern mailtoPattern = Pattern.compile("mailto:([a-zA-Z0-9\\.]+@[a-zA-Z0-9\\.]+\\.[a-zA-Z0-9]+)");
    public static final Pattern emailPattern = Pattern.compile("\\b[a-zA-Z0-9\\.]+(@)([a-zA-Z0-9\\.]+)(\\.)([a-zA-Z0-9]+)\\b");
    
    public static String encodeEmail(String str)
    {
        // obfuscate mailto's: turns them into hex encoded,
        // so that browsers can still understand the mailto link
        Matcher mailtoMatch = mailtoPattern.matcher(str);
        while (mailtoMatch.find())
        {
            String email = mailtoMatch.group(1);
            //System.out.println("email=" + email);
            String hexed = encode(email);
            str = str.replaceFirst("mailto:"+email, "mailto:"+hexed);
        }
        
        return obfuscateEmail(str);
    }

    /**
     * obfuscate plaintext emai
 ls: makes them
     * "human-readable" - still too easy for
     * machines to parse however.
     * 
     * @param str
     * @return
     */
    public static String obfuscateEmail(String str)
    {
        Matcher emailMatch = emailPattern.matcher(str);
        while (emailMatch.find())
        {
            String at = emailMatch.group(1);
            //System.out.println("at=" + at);
            str = str.replaceFirst(at, "-AT-");
            
            String dot = emailMatch.group(2) + emailMatch.group(3) + emailMatch.group(4);
            String newDot = emailMatch.group(2) + "-DOT-" + emailMatch.group(4);
            //System.out.println("dot=" + dot);
            str = str.replaceFirst(dot, newDot);
        }
        return str;
    }
    
    /**
     * Return the specified match "groups" from the pattern.
     * For each group matched a String will be entered in the ArrayList.
     * 
     * @param pattern The Pattern to use.
     * @param match The String to m
 atch against.
     * @param group The group number to return in case of a match.
     * @return
     */
    public static ArrayList getMatches(Pattern pattern, String match, int group)
    {
        ArrayList matches = new ArrayList();
        Matcher matcher = pattern.matcher(match);
        while (matcher.find()) 
        {
            matches.add( matcher.group(group) );
        }
        return matches;
    }

	/**
     * Thanks to the folks at Blojsom (http://sf.net/projects/blojsom)
     * for showing me what I was doing wrong with the Hex class.
     * 
	 * @param email
	 * @return
	 */
	public static String encode(String email)
	{
        StringBuffer result = new StringBuffer();
        try {
            char[] hexString = Hex.encodeHex(email.getBytes("UTF-8"));
            for (int i = 0; i < hexString.length; i++) {
                if (i % 2 == 0) {
                    result.append("%");
                }
                result.append(hexString[i]);
            }
 
        } catch (UnsupportedEncodingException e) {
            return email;
        }

        return result.toString();
	}
}
\ No newline at end of file

Modified: incubator/roller/branches/roller_2.3/src/org/apache/roller/webservices/adminapi/AtomAdminServlet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.3/src/org/apache/roller/webservices/adminapi/AtomAdminServlet.java?rev=406122&r1=406121&r2=406122&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.3/src/org/apache/roller/webservices/adminapi/AtomAdminServlet.java (original)
+++ incubator/roller/branches/roller_2.3/src/org/apache/roller/webservices/adminapi/AtomAdminServlet.java Sat May 13 08:45:16 2006
@@ -53,7 +53,7 @@
             EntrySet c = handler.processGet();
             
             res.setStatus(HttpServletResponse.SC_OK);            
-            res.setContentType("application/xml; charset=utf8");
+            res.setContentType("application/xml; charset=utf-8");
             String s = c.toString();
             Writer writer = res.getWriter();
             writer.write(s);            
@@ -77,7 +77,7 @@
             EntrySet c = handler.processPost(new InputStreamReader(req.getInputStream()));
             
             res.setStatus(HttpServletResponse.SC_CREATED);            
-            res.setContentType("application/xml; charset=utf8");
+            res.setContentType("application/xml; charset=utf-8");
             String s = c.toString();
             Writer writer = res.getWriter();
             writer.write(s);            
@@ -101,7 +101,7 @@
             EntrySet c = handler.processPut(new InputStreamReader(req.getInputStream()));
             
             res.setStatus(HttpServletResponse.SC_OK);            
-            res.setContentType("application/xml; charset=utf8");
+            res.setContentType("application/xml; charset=utf-8");
             String s = c.toString();
             Writer writer = res.getWriter();
             writer.write(s);            
@@ -124,7 +124,7 @@
             EntrySet es = handler.processDelete();
             
             res.setStatus(HttpServletResponse.SC_OK);                        
-            res.setContentType("application/xml; charset=utf8");
+            res.setContentType("application/xml; charset=utf-8");
             String s = es.toString();
             Writer writer = res.getWriter();
             writer.write(s);            

Modified: incubator/roller/branches/roller_2.3/src/org/apache/roller/webservices/atomprotocol/AtomServlet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.3/src/org/apache/roller/webservices/atomprotocol/AtomServlet.java?rev=406122&r1=406121&r2=406122&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.3/src/org/apache/roller/webservices/atomprotocol/AtomServlet.java (original)
+++ incubator/roller/branches/roller_2.3/src/org/apache/roller/webservices/atomprotocol/AtomServlet.java Sat May 13 08:45:16 2006
@@ -90,7 +90,7 @@
                     // return an Atom Service document
                     AtomService service = handler.getIntrospection(pathInfo);
                     Document doc = AtomService.serviceToDocument(service);
-                    res.setContentType("application/xml; charset=utf8");
+                    res.setContentType("application/xml; charset=utf-8");
                     Writer writer = res.getWriter();
                     XMLOutputter outputter = new XMLOutputter();
                     outputter.setFormat(Format.getPrettyFormat());
@@ -103,7 +103,7 @@
                     col.setFeedType(FEED_TYPE);
                     WireFeedOutput wireFeedOutput = new WireFeedOutput();
                     Document feedDoc = wireFeedOutput.outputJDom(col);
-                    res.setContentType("application/atom+xml; charset=utf8");
+                    res.setContentType("application/atom+xml; charset=utf-8");
                     Writer writer = res.getWriter();
                     XMLOutputter outputter = new XMLOutputter();
                     outputter.setFormat(Format.getPrettyFormat());
@@ -115,7 +115,7 @@
                     Entry entry = handler.getEntry(pathInfo);
                     if (entry != null) {
                         Writer writer = res.getWriter();
-                        res.setContentType("application/atom+xml; charset=utf8");
+                        res.setContentType("application/atom+xml; charset=utf-8");
                         serializeEntry(entry, writer);
                         writer.close();
                     } else {
@@ -126,7 +126,7 @@
                     Entry entry = handler.getMedia(pathInfo);
                     if (entry != null) {
                         Writer writer = res.getWriter();
-                        res.setContentType("application/atom+xml; charset=utf8");
+                        res.setContentType("application/atom+xml; charset=utf-8");
                         serializeEntry(entry, writer);
                         writer.close();
                     } else {
@@ -178,7 +178,7 @@
                     }
                     // write entry back out to response
                     res.setStatus(HttpServletResponse.SC_CREATED);
-                    res.setContentType("application/atom+xml; charset=utf8");
+                    res.setContentType("application/atom+xml; charset=utf-8");
                     Writer writer = res.getWriter();
                     serializeEntry(savedEntry, writer);
                     writer.close(); 
@@ -231,7 +231,7 @@
                     Entry updatedEntry = handler.putEntry(pathInfo, unsavedEntry);
                     
                     // write entry back out to response
-                    res.setContentType("application/atom+xml; charset=utf8");
+                    res.setContentType("application/atom+xml; charset=utf-8");
                     Writer writer = res.getWriter();
                     serializeEntry(updatedEntry, writer);
                     res.setStatus(HttpServletResponse.SC_OK);
@@ -242,7 +242,7 @@
                         pathInfo, req.getContentType(), req.getInputStream());
                                         
                     // write entry back out to response
-                    res.setContentType("application/atom+xml; charset=utf8");
+                    res.setContentType("application/atom+xml; charset=utf-8");
                     Writer writer = res.getWriter();
                     serializeEntry(updatedEntry, writer);
                     writer.close();