Author: sevein
Date: Sat Oct  8 02:46:46 2011
New Revision: 9985

Log:
Response HTTP 405 is X-Packaging not supported

Modified:
   trunk/plugins/qtSwordPlugin/config/qtSwordPluginConfiguration.class.php
   
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/depositAction.class.php
   
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/servicedocumentAction.class.php
   
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/templates/servicedocumentSuccess.xml.php

Modified: 
trunk/plugins/qtSwordPlugin/config/qtSwordPluginConfiguration.class.php
==============================================================================
--- trunk/plugins/qtSwordPlugin/config/qtSwordPluginConfiguration.class.php     
Fri Oct  7 17:35:43 2011        (r9984)
+++ trunk/plugins/qtSwordPlugin/config/qtSwordPluginConfiguration.class.php     
Sat Oct  8 02:46:46 2011        (r9985)
@@ -21,7 +21,11 @@
 {
   public static
     $summary = 'SWORD plugin.',
-    $version = '1.0.0';
+    $version = '1.0.0',
+
+    // See http://www.swordapp.org/docs/sword-type-1.0.html
+    $packaging = array(
+      '1.0' => 'http://www.loc.gov/METS/'); // METS
 
   public function initialize()
   {

Modified: 
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/depositAction.class.php
==============================================================================
--- 
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/depositAction.class.php
   Fri Oct  7 17:35:43 2011        (r9984)
+++ 
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/depositAction.class.php
   Sat Oct  8 02:46:46 2011        (r9985)
@@ -21,9 +21,18 @@
 {
   public function execute($request)
   {
-    $this->resource = $this->getRoute()->resource;      
 
-    // 201 Created 
+    $this->resource = $this->getRoute()->resource;
+
+    if ($request->isMethod('post'))
+    {
+      if (!in_array($request->getHttpHeader('X-Packaging'), 
qtSwordPluginConfiguration::$packaging))
+      {
+        $this->response->setStatusCode('405');
+      }
+    }
+
+    // 201 Created
     $this->response->setStatusCode('201');
 
     // Location

Modified: 
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/servicedocumentAction.class.php
==============================================================================
--- 
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/servicedocumentAction.class.php
   Fri Oct  7 17:35:43 2011        (r9984)
+++ 
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/servicedocumentAction.class.php
   Sat Oct  8 02:46:46 2011        (r9985)
@@ -26,13 +26,9 @@
     $this->noOp = 'false';
     $this->maxUploadSize = QubitDigitalObject::getMaxUploadSize() / 1024; // 
From bytes to kilobytes
 
-    // See http://www.swordapp.org/docs/sword-type-1.0.html
-    $this->packaging = array(
-      'METS' => 'http://www.loc.gov/METS/');
-
     if (isset($request->getAttribute('sf_route')->resource))
     {
-      $this->resource = $this->getRoute()->resource;      
+      $this->resource = $this->getRoute()->resource;
 
       $this->title = $this->resource->__toString();
 

Modified: 
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/templates/servicedocumentSuccess.xml.php
==============================================================================
--- 
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/templates/servicedocumentSuccess.xml.php
  Fri Oct  7 17:35:43 2011        (r9984)
+++ 
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/templates/servicedocumentSuccess.xml.php
  Sat Oct  8 02:46:46 2011        (r9985)
@@ -32,7 +32,7 @@
         <sword:treatment>This is a server</sword:treatment>
 
         <!-- MAY be included. Used to identify the content packaging types 
supported by this collection. SHOULD be a URI from [SWORD-TYPES]. The q 
attribute MAY be used to indicate relative preferences between packaging 
formats (See Part A Section 1.1). -->
-        <?php foreach ($packaging as $key => $value): ?>
+        <?php foreach (qtSwordPluginConfiguration::$packaging as $key => 
$value): ?>
           <sword:acceptPackaging q="<?php echo $key ?>"><?php echo $value 
?></sword:acceptPackaging>
         <?php endforeach; ?>
 

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to