abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r603815 - /incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractServiceProvider.java
Date Thu, 13 Dec 2007 04:22:43 GMT
Author: dandiep
Date: Wed Dec 12 20:22:42 2007
New Revision: 603815

URL: http://svn.apache.org/viewvc?rev=603815&view=rev
Log:
Set the status explicitly on the ResponseContext - this was causing my app to fail because
we were calling setStatus(0).

Modified:
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractServiceProvider.java

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractServiceProvider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractServiceProvider.java?rev=603815&r1=603814&r2=603815&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractServiceProvider.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractServiceProvider.java
Wed Dec 12 20:22:42 2007
@@ -55,7 +55,6 @@
   private static final Log log = LogFactory.getLog(AbstractServiceProvider.class);
   public static final String COLLECTION_PROVIDER_ATTRIBUTE = "collectionProvider";
   
-    private EntityTag service_etag = new EntityTag("simple");
     private String servicesPath = "/";
     
     protected AbstractServiceProvider(int count) {
@@ -135,7 +134,7 @@
     public ResponseContext getService(RequestContext request) {
       Abdera abdera = request.getAbdera();
       AbstractResponseContext rc = getServicesDocument(abdera, getEncoding(request));
-      rc.setEntityTag(service_etag);
+      rc.setStatus(200);
       return rc;
     }
 
@@ -143,46 +142,44 @@
       return "utf-8";
     }
 
-    private AbstractResponseContext getServicesDocument(
-      final Abdera abdera, 
-      final String enc) {
-      return new StreamWriterResponseContext(abdera) { 
-        @SuppressWarnings({"serial","unchecked"}) 
-        protected void writeTo(
-          StreamWriter sw) 
-            throws IOException {
-          
-          sw.startDocument()
-            .startService();          
-          
+    private AbstractResponseContext getServicesDocument(final Abdera abdera, 
+                                                        final String enc) {
+      
+      return new StreamWriterResponseContext(abdera) {
+
+        @SuppressWarnings( {"serial", "unchecked"})
+        protected void writeTo(StreamWriter sw) throws IOException {
+          sw.startDocument().startService();
+  
           for (WorkspaceInfo wp : getWorkspaces()) {
             sw.startWorkspace().writeTitle(wp.getName());
-            Set<Map.Entry<String, CollectionProvider>> entrySet = 
-              (Set<Map.Entry<String, CollectionProvider>>) (wp.getCollectionProviders().entrySet());
-            
+            Set<Map.Entry<String, CollectionProvider>> entrySet = (Set<Map.Entry<String,
CollectionProvider>>)(wp
+              .getCollectionProviders().entrySet());
+  
             for (Map.Entry<String, CollectionProvider> entry : entrySet) {
               CollectionProvider cp = entry.getValue();
-
+  
               String href;
               try {
                 href = Escaping.encode(entry.getKey(), enc, Profile.PATH);
               } catch (UnsupportedEncodingException e) {
                 throw new RuntimeException(e);
               }
-
+  
               try {
                 sw.startCollection(href)
                   .writeTitle(cp.getTitle())
-                  .writeAcceptsEntry() 
+                  .writeAcceptsEntry()
                   .endCollection();
-              } catch (RuntimeException e) {}
+              } catch (RuntimeException e) {
+              }
             }
-            
-            sw.endWorkspace();    
-          }          
-          sw.endService()
-            .endDocument();
-          
+  
+            sw.endWorkspace();
+          }
+  
+          sw.endService().endDocument();
+  
         }
       };
     }



Mime
View raw message