unico       2003/11/14 10:58:45

  Modified:    src/blocks/webdav/samples/davmap sitemap.xmap webdav.js
  Log:
  use FOM sendStatus for empty responses
  
  Revision  Changes    Path
  1.13      +2 -12     cocoon-2.1/src/blocks/webdav/samples/davmap/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/webdav/samples/davmap/sitemap.xmap,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- sitemap.xmap      4 Nov 2003 16:56:30 -0000       1.12
  +++ sitemap.xmap      14 Nov 2003 18:58:45 -0000      1.13
  @@ -31,7 +31,7 @@
       </map:transformers>
       
       <!-- If event caching is enabled you'll need to uncomment this in order
  -         for PROPPATCH to work properly 
  +         for PROPPATCH to work properly
       <map:pipes default="caching">
         <map:pipe name="event-caching" 
           
src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline"
  @@ -100,13 +100,6 @@
           <map:serialize type="xml" />
         </map:match>
         
  -      <map:match pattern="status/*">
  -        <map:generate type="jx" src="status.jx">
  -          <map:parameter name="status" value="{1}" />
  -        </map:generate>
  -        <map:serialize type="xml" status-code="{1}" />
  -      </map:match>
  -      
       </map:pipeline>
       
   <!-- ========================= Public Resources =========================== 
-->
  @@ -189,8 +182,7 @@
         <map:match pattern="MKCOL/**">
           <map:match pattern="MKCOL/**.*">
             <map:call function="sendStatus">
  -            <map:parameter name="status" value="409" />
  -            <map:parameter name="message" value="Not a valid collection 
name." />
  +            <map:parameter name="status" value="405" />
             </map:call>
           </map:match>
           <map:call function="mkcol">
  @@ -215,7 +207,6 @@
           </map:match>
           <map:call function="sendStatus">
             <map:parameter name="status" value="405" />
  -          <map:parameter name="message" value="Destination resource out of 
scope." />
           </map:call>
         </map:match>
         
  @@ -230,7 +221,6 @@
           </map:match>
           <map:call function="sendStatus">
             <map:parameter name="status" value="405" />
  -          <map:parameter name="message" value="Destination resource out of 
scope." />
           </map:call>
         </map:match>
         
  
  
  
  1.7       +13 -38    cocoon-2.1/src/blocks/webdav/samples/davmap/webdav.js
  
  Index: webdav.js
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/webdav/samples/davmap/webdav.js,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- webdav.js 4 Nov 2003 16:56:30 -0000       1.6
  +++ webdav.js 14 Nov 2003 18:58:45 -0000      1.7
  @@ -9,9 +9,8 @@
     cocoon.sendPage(method+"/"+page, null);
   }
   
  -function sendStatus(status,msg) {
  -  //cocoon.response.setStatus(status);
  -  cocoon.sendPage("status/"+status,{message:msg});
  +function sendStatus(sc) {
  +  cocoon.sendStatus(sc);
   }
   
   function put() {
  @@ -19,11 +18,11 @@
     var dest = cocoon.parameters["dest"];
     try {
       var status = repository.save(src,dest);
  -    sendStatus(status,"");
  +    sendStatus(status);
     }
     catch (e) {
       cocoon.log.error(e);
  -    sendStatus(500,"unknown error");
  +    sendStatus(500);
     }
   }
   
  @@ -31,11 +30,11 @@
     var location = cocoon.parameters["location"];
     try {
       var status = repository.remove(location);
  -    sendStatus(status,"");
  +    sendStatus(status);
     }
     catch (e) {
       cocoon.log.error(e);
  -    sendStatus(500,"unknown error");
  +    sendStatus(500);
     }
   }
   
  @@ -43,11 +42,11 @@
     var location = cocoon.parameters["location"];
     try {
       var status = repository.makeCollection(location);
  -    sendStatus(status,"");
  +    sendStatus(status);
     }
     catch (e) {
       cocoon.log.error(e);
  -    sendStatus(500,"unknown error");
  +    sendStatus(500);
     }
   }
   
  @@ -58,9 +57,9 @@
     var overwrite = isOverwrite(cocoon.parameters["overwrite"]);
     try {
       var status = repository.copy(from,to,recurse,overwrite);
  -    sendStatus(status,"");
  +    sendStatus(status);
     } catch (e) {
  -    sendStatus(500,"unknown error");
  +    sendStatus(500);
     }
   }
   
  @@ -71,9 +70,9 @@
     var overwrite = isOverwrite(cocoon.parameters["overwrite"]);
     try {
       var status = repository.move(from,to,recurse,overwrite);
  -    sendStatus(status,"");
  +    sendStatus(status);
     } catch (e) {
  -    sendStatus(500,"unknown error");
  +    sendStatus(500);
     }
   }
   
  @@ -82,7 +81,7 @@
     var options = "OPTIONS,GET,HEAD,POST,DELETE,TRACE,PUT" 
                 + ",MKCOL,PROPFIND,PROPPATCH,COPY,MOVE";
     cocoon.response.setHeader("Allow",options);
  -  sendStatus(200,"");
  +  sendStatus(200);
   }
   
   /*
  @@ -113,27 +112,3 @@
     }
     return overwrite;
   }
  -
  -/*
  -function getDestination() {
  -  var destination = cocoon.request.getHeader("Destination");
  -  var index = destination.indexOf('://');
  -  if (index != -1) {
  -    destination = destination.substring(index+3);
  -    index = destination.indexOf('/');
  -    if (index != -1) {
  -      destination = destination.substring(index);
  -    }
  -  }
  -  return destination;
  -}
  -
  -function getUserAgent() {
  -  var userAgent = cocoon.request.getHeader("User-Agent");
  -  var index = userAgent.indexOf('/');
  -  if (index != -1) {
  -    return userAgent.substring(0,index);
  -  }
  -  return userAgent;
  -}
  -*/
  \ No newline at end of file
  
  
  

Reply via email to