Commit 93942866e6115048c013d5c6b0af9a9a8684cc1c
1 parent
f3438102
First attempt at setting correct headers - servicedocument
Story ID:2713417. CMIS working with PHP client Committed by: Paul Barrett
Showing
4 changed files
with
15 additions
and
2 deletions
webservice/atompub/cmis/index.php
| @@ -79,6 +79,9 @@ $APP = new KT_cmis_atom_server(); | @@ -79,6 +79,9 @@ $APP = new KT_cmis_atom_server(); | ||
| 79 | 79 | ||
| 80 | $queryArray = split('/', trim($_SERVER['QUERY_STRING'], '/')); | 80 | $queryArray = split('/', trim($_SERVER['QUERY_STRING'], '/')); |
| 81 | $workspace = strtolower(trim($queryArray[0])); | 81 | $workspace = strtolower(trim($queryArray[0])); |
| 82 | +if (empty($workspace)) { | ||
| 83 | + $workspace = 'servicedocument'; | ||
| 84 | +} | ||
| 82 | if ($workspace == 'servicedocument') | 85 | if ($workspace == 'servicedocument') |
| 83 | { | 86 | { |
| 84 | // CMIS service document setup | 87 | // CMIS service document setup |
webservice/classes/atompub/KT_atom_server.inc.php
| @@ -33,6 +33,10 @@ class KT_atom_server { | @@ -33,6 +33,10 @@ class KT_atom_server { | ||
| 33 | $rawRequest=@file_get_contents('php://input'); | 33 | $rawRequest=@file_get_contents('php://input'); |
| 34 | 34 | ||
| 35 | $workspace=strtolower(trim($queryArray[0])); | 35 | $workspace=strtolower(trim($queryArray[0])); |
| 36 | + if (empty($workspace)) { | ||
| 37 | + $workspace = 'servicedocument'; | ||
| 38 | + } | ||
| 39 | + | ||
| 36 | $serviceName=strtolower(trim($queryArray[1])); | 40 | $serviceName=strtolower(trim($queryArray[1])); |
| 37 | $requestParams=array_slice($queryArray,2); | 41 | $requestParams=array_slice($queryArray,2); |
| 38 | $this->queryArray=$queryArray; | 42 | $this->queryArray=$queryArray; |
webservice/classes/atompub/cmis/KT_cmis_atom_server.inc.php
| @@ -58,6 +58,10 @@ class KT_cmis_atom_server extends KT_atom_server { | @@ -58,6 +58,10 @@ class KT_cmis_atom_server extends KT_atom_server { | ||
| 58 | public function serviceDocument() | 58 | public function serviceDocument() |
| 59 | { | 59 | { |
| 60 | $service = new KT_cmis_atom_serviceDoc(KT_APP_BASE_URI); | 60 | $service = new KT_cmis_atom_serviceDoc(KT_APP_BASE_URI); |
| 61 | + | ||
| 62 | + header('Content-Type: application/atomsvc+xml;charset=UTF-8'); | ||
| 63 | + header('Content-Disposition', 'attachment;filename="knowledgetree_cmis"'); | ||
| 64 | + $this->headersSet = true; | ||
| 61 | 65 | ||
| 62 | foreach($this->services as $workspace => $collection) | 66 | foreach($this->services as $workspace => $collection) |
| 63 | { | 67 | { |
webservice/classes/atompub/cmis/KT_cmis_atom_service.inc.php
| @@ -66,9 +66,11 @@ class KT_cmis_atom_service extends KT_atom_service { | @@ -66,9 +66,11 @@ class KT_cmis_atom_service extends KT_atom_service { | ||
| 66 | return $this->serviceType; | 66 | return $this->serviceType; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | - public function setHeader($header = null, $value = null) | 69 | + public function setHeader($header, $value = null) |
| 70 | { | 70 | { |
| 71 | - if ($header) header($header . ': ' . $value); | 71 | + if (!empty($header)) { |
| 72 | + header($header . ': ' . $value); | ||
| 73 | + } | ||
| 72 | } | 74 | } |
| 73 | 75 | ||
| 74 | public function getStatusCode($exception) | 76 | public function getStatusCode($exception) |