本文整理汇总了PHP中RequestHandler类的典型用法代码示例。如果您正苦于以下问题:PHP RequestHandler类的具体用法?PHP RequestHandler怎么用?PHP RequestHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RequestHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$this->configure();
\yapaf\DevServer::handle();
$requestHandler = new RequestHandler($this->configuration);
return $requestHandler->handle();
}
示例2: factory
/**
* @param DomDocument $context
* @param \BaseXMS\Mvc\SiteAccess $siteAccess
* @return Ambigous <NULL, unknown, \BaseXMS\RequestHandler\RequestHandler>
*/
public static function factory($context, \BaseXMS\Mvc\SiteAccess $siteAccess)
{
$return = null;
$services = $siteAccess->getServiceLocator();
// Get Request handler class
$requestHandlerClass = $context->queryToValue('//contentclass');
//TODO: contentclass is not really the right name
if (!$requestHandlerClass) {
$requestHandlerClass = '\\BaseXMS\\RequestHandler\\RequestHandler';
$services->get('log')->warn('No RequestHandler class specified - falling back to default class.');
}
if (!class_exists($requestHandlerClass)) {
$services->get('log')->warn('Could not find RequestHandler class: "' . $requestHandlerClass . '".');
$requestHandlerClass = '\\BaseXMS\\RequestHandler\\RequestHandler';
}
$services->get('log')->info('Loading RequestHandler class: "' . $requestHandlerClass . '".');
$return = new $requestHandlerClass();
// couldn't get a valid class
if (!$return instanceof RequestHandler) {
$services->get('log')->warn('"' . $requestHandlerClass . '" is not a RequestHandler - falling back to default class.');
$return = new RequestHandler();
}
$return->setContext($context)->setServiceLocator($services)->setSiteAccess($siteAccess);
return $return;
}
示例3: __construct
public function __construct(RequestHandler $request)
{
$this->request = $request;
$this->container = $request->getContainer();
$this->view = $this->container->getTwig();
$this->acquireBaseUrl();
$this->session = ApplicationSession::getInstance();
}
示例4: processRequest
public static function processRequest()
{
global $logger;
$request = $rawResponse = $response = null;
try {
/* Authenticate */
$valid = self::authenticateRequest($_SERVER);
/* Fetch POST data */
$post = file_get_contents("php://input");
$logger->debug("POST Data Received: " . $post);
/* Formulate the request object */
$request = RequestParser::parseInput($_SERVER, $_GET, $post);
$logger->debug("REQUEST Object: " . $request->toString());
/* Handle the request */
$rawResponse = RequestHandler::process($request);
$logger->debug("RESPONSE Object: " . json_encode($rawResponse));
} catch (ApiException $e) {
/* Generate response from Exception details */
$logger->error("ApiException encountered!! " . $e->toString());
$rawResponse = array('httpStatusCode' => $e->getHttpStatusCode(), 'httpStatusCodeMessage' => $e->getHttpStatusCodeMessage(), 'otherHeaders' => $e->getOtherHeaders(), 'code' => $e->getCode(), 'message' => $e->getMessage(), 'debug' => false, 'data' => null);
}
// Format the $rawResponse variable and output
$format = !isset($request) ? 'json' : $request->getFormat();
$debug = !isset($request) ? false : $request->getDebug();
$response = ResponseHandler::respond($rawResponse, $format, $debug);
$logger->debug("Output: " . $response);
}
示例5: getInstance
/**
* Creates single for whole application RequestHandler object.
* Singleton pattern implementation.
*
* @return RequestHandler Either existing or new.
*/
public static function getInstance()
{
if (!self::$instance) {
self::$instance = new RequestHandler();
}
return self::$instance;
}
示例6: playGame
/**
* Handle request and set message to.
*/
public function playGame()
{
$this->model->processShot(RequestHandler::getRequest());
$this->view->setMessage($this->model->getMessage());
$this->view->setData($this->model->getData()['grid']);
$this->view->display();
}
示例7: CurrentUser
/**
* Returns user information such as first name, last name, and email address.
*
* @return SimpleXMLElement Xml of Disconnect response
*/
public function CurrentUser()
{
$this->requestXmlDocument = '';
$uriFragment = implode(CoreConstants::SLASH_CHAR, array('v1', 'user', 'current'));
$requestParameters = new RequestParameters(NULL, 'GET', NULL, $uriFragment);
list($respCode, $respXml, $respError) = $this->restRequestHandler->GetResponse($requestParameters, $this->requestXmlDocument, NULL);
return simplexml_load_string($respXml);
}
示例8: buildRequestForm
function buildRequestForm($method, $button_name)
{
$reqHandler = new RequestHandler();
$reqHandler->init();
$reqHandler = $this->__inithandler($reqHandler);
//待请求参数数组
$reqHandler->createSign();
$params = $reqHandler->getAllParameters();
ksort($params);
$sHtml = "<form id='tenpaysubmit' name='tenpaysubmit' action='" . $reqHandler->getGateUrl() . "' method='" . $method . "'>";
while (list($key, $val) = each($params)) {
$sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>";
}
//submit按钮控件请不要含有name属性
$sHtml = $sHtml . "<input type='submit' value='" . $button_name . "'></form>";
$sHtml = $sHtml . "<script>document.forms['tenpaysubmit'].submit();</script>";
return $sHtml;
}
示例9: matches
/**
* @see \wcf\system\request\IRoute::matches()
*/
public function matches($requestURL)
{
if (parent::matches($requestURL)) {
$this->routeData['application'] = $this->staticApplication;
$this->routeData['controller'] = RequestHandler::getTokenizedController($this->staticController);
$this->routeData['isDefaultController'] = false;
return true;
}
return false;
}
示例10: fillMenu
/**
* recursive fill the menu.
*
* @param string $lbl
* @param array $page
* @param string $class
* @access private
* @return DomElement
*/
private function fillMenu($lbl, $page, $class = null)
{
if ($class === null) {
$rq = new RequestHandler(DEFAULTPAGE, $this->basepath);
}
if (is_array($page)) {
if (isset($page['default'])) {
$li = $this->document->createElement('li');
$a = $this->document->createElement('a', $lbl);
$a->setAttribute('href', $this->basepath . '/' . $page['default']);
if ($class === null && $rq->getPage() == $page['default']) {
$li->setAttribute('class', 'selected');
}
$li->appendChild($a);
unset($page['default']);
} else {
$li = $this->document->createElement('li', $lbl);
}
if (count($page) > 0) {
$subList = $this->document->createElement('ul');
if (!empty($class)) {
$subList->setAttribute('class', 'sub');
} else {
$subList->setAttribute('class', 'sub first');
}
foreach ($page as $slbl => $spage) {
$subList->appendChild($this->fillMenu($slbl, $spage, 'sub'));
}
$li->appendChild($subList);
}
return $li;
} else {
$li = $this->document->createElement('li');
$a = $this->document->createElement('a', $lbl);
$a->setAttribute('href', $this->basepath . '/' . $page);
if ($class === null && $rq->getPage() == $page) {
$li->setAttribute('class', 'selected');
}
$li->appendChild($a);
return $li;
}
}
示例11: __construct
public function __construct(GridField $grid, GridFieldComponent $component, $name)
{
$this->grid = $grid;
$this->component = $component;
$this->name = $name;
parent::__construct();
}
开发者ID:helpfulrobot,项目名称:ajshort-silverstripe-gridfieldextensions,代码行数:7,代码来源:GridFieldRequestHandler.php
示例12: __construct
public function __construct($grid, $button)
{
$this->grid = $grid;
$this->button = $button;
$this->context = singleton($grid->getModelClass())->getDefaultSearchContext();
parent::__construct();
}
开发者ID:helpfulrobot,项目名称:ajshort-silverstripe-gridfieldextensions,代码行数:7,代码来源:GridFieldAddExistingSearchHandler.php
示例13: getInstance
public static function getInstance()
{
if (null === self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
示例14:
/**
* Create a new page comment interface
* @param controller The controller that the interface is used on
* @param methodName The method to return this PageCommentInterface object
* @param page The page that we're commenting on
*/
function __construct($controller, $methodName, $page)
{
$this->controller = $controller;
$this->methodName = $methodName;
$this->page = $page;
parent::__construct();
}
示例15: __construct
/**
* Handler's constructor
*
* @param GridFIeld $gridField
* @param GridField_URLHandler $component
* @param Controller $controller
*/
public function __construct($gridField, $component, $controller)
{
$this->gridField = $gridField;
$this->component = $component;
$this->controller = $controller;
parent::__construct();
}
开发者ID:helpfulrobot,项目名称:colymba-gridfield-bulk-editing-tools,代码行数:14,代码来源:GridFieldBulkUpload_Request.php