roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r424781 - /incubator/roller/branches/roller_2.4_appd9/src/org/apache/roller/webservices/atomprotocol/AtomServlet.java
Date Sun, 23 Jul 2006 18:47:35 GMT
Author: snoopdave
Date: Sun Jul 23 11:47:34 2006
New Revision: 424781

URL: http://svn.apache.org/viewvc?rev=424781&view=rev
Log:
Return alt link as location header, not resource link

Modified:
    incubator/roller/branches/roller_2.4_appd9/src/org/apache/roller/webservices/atomprotocol/AtomServlet.java

Modified: incubator/roller/branches/roller_2.4_appd9/src/org/apache/roller/webservices/atomprotocol/AtomServlet.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_2.4_appd9/src/org/apache/roller/webservices/atomprotocol/AtomServlet.java?rev=424781&r1=424780&r2=424781&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.4_appd9/src/org/apache/roller/webservices/atomprotocol/AtomServlet.java
(original)
+++ incubator/roller/branches/roller_2.4_appd9/src/org/apache/roller/webservices/atomprotocol/AtomServlet.java
Sun Jul 23 11:47:34 2006
@@ -180,7 +180,7 @@
                         serializeEntry(savedEntry, writer);
                         writer.close(); 
                     
-                    } else {
+                    } else if (req.getContentType() != null) {
                         // get incoming file name from HTTP header
                         String name = req.getHeader("Title");
 
@@ -191,10 +191,21 @@
                         res.setStatus(HttpServletResponse.SC_CREATED);
                         com.sun.syndication.feed.atom.Content content = 
                             (com.sun.syndication.feed.atom.Content)resource.getContents().get(0);
-                        res.setHeader("Location", content.getSrc());
+
+                        // return alternate link as Location header
+                        Iterator links = resource.getAlternateLinks().iterator();
+                        while (links.hasNext()) {
+                            Link link = (Link) links.next();
+                            if (link.getRel().equals("alternate") || link.getRel() == null)
{
+                                res.addHeader("Location", link.getHref());
+                                break;
+                            }
+                        }
                         Writer writer = res.getWriter();
                         serializeEntry(resource, writer);
                         writer.close(); 
+                    } else {
+                        res.setStatus(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
                     }
                     
                 } else {



Mime
View raw message