コード例 #1
0
 /**
  * Admin instance
  * @param KoSolr_Server_Admin $server 
  */
 public function __construct(KoSolr_Server_Admin &$server)
 {
     parent::__construct();
     $this->_server_instance = $server;
 }
コード例 #2
0
 /**
  * Execute request
  * @param KoSolr_Server_Request $request
  * @param int|bool $timeout
  * @return KoSolr_Server_Response_IExtend
  * @throws Exception 
  */
 public function execute(KoSolr_Server_Request $request, $timeout = FALSE)
 {
     $context = stream_context_create();
     $url = $this->getRequestUrl() . $request->getRequestHandler();
     $header = array('http' => array('timeout' => $timeout ? $timeout : $request->getTimeout()));
     if ($request->getSendMethod() == KoSolr_Server_Request::SEND_METHOD_POST) {
         $header['http']['method'] = $request->getSendMethod();
         $header['http']['content'] = $request->getContentRaw();
         $header['http']['header'] = 'Content-Type: ' . $request->getRequestContentType();
     } elseif ($request->getSendMethod() == KoSolr_Server_Request::SEND_METHOD_GET) {
         $url .= '?' . $request->getContentRaw();
     }
     stream_context_set_option($context, $header);
     $raw_response = @file_get_contents($url, false, $context);
     $raw_headerResponse = KoSolr_Utils::http_content_response($http_response_header);
     if ($raw_headerResponse['httpStatus'] != 200) {
         throw new KoSolr_Exception("Request url : {$url} Request " . print_r($header, true) . ' Solr Service : ' . $raw_headerResponse['httpStatusMessage']);
     }
     return KoSolr_Server_Response::factory($request, $context, $raw_response);
 }
コード例 #3
0
 /**
  *Constructor 
  */
 public function __construct()
 {
     parent::__construct();
     $this->select('*');
 }