/**
  * 解析WebsiteConfig数据
  *
  * @return WebsiteConfig
  */
 protected function parseDataFromResponse()
 {
     $content = $this->rawResponse->body;
     $config = new WebsiteConfig();
     $config->parseFromXml($content);
     return $config;
 }
 public function testWebsiteConstruct()
 {
     $websiteConfig = new WebsiteConfig("index.html", "errorDocument.html");
     $this->assertEquals('index.html', $websiteConfig->getIndexDocument());
     $this->assertEquals('errorDocument.html', $websiteConfig->getErrorDocument());
     $this->assertEquals($this->cleanXml($this->validXml), $this->cleanXml($websiteConfig->serializeToXml()));
 }
示例#3
0
 /**
  * 将bucket设置成静态网站托管模式
  *
  * @param string $bucket bucket名称
  * @param WebsiteConfig $websiteConfig
  * @param array $options 可以为空
  * @throws OssException
  * @return null
  */
 public function putBucketWebsite($bucket, $websiteConfig, $options = NULL)
 {
     $this->precheckCommon($bucket, NULL, $options, false);
     $options[self::OSS_BUCKET] = $bucket;
     $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
     $options[self::OSS_OBJECT] = '/';
     $options[self::OSS_SUB_RESOURCE] = 'website';
     $options[self::OSS_CONTENT_TYPE] = 'application/xml';
     $options[self::OSS_CONTENT] = $websiteConfig->serializeToXml();
     $response = $this->auth($options);
     $result = new PutSetDeleteResult($response);
     return $result->getData();
 }