response = $response; $this->inputParamsResolver = $inputParamsResolver; $this->serviceOutputProcessor = $serviceOutputProcessor; $this->fieldsFilter = $fieldsFilter; $this->deploymentConfig = $deploymentConfig; $this->objectManager = $objectManager; } /** * {@inheritdoc} */ public function process(\Magento\Framework\Webapi\Rest\Request $request) { $inputParams = $this->inputParamsResolver->resolve(); $route = $this->inputParamsResolver->getRoute(); $serviceMethodName = $route->getServiceMethod(); $serviceClassName = $route->getServiceClass(); $service = $this->objectManager->get($serviceClassName); /** * @var \Magento\Framework\Api\AbstractExtensibleObject $outputData */ $outputData = call_user_func_array([$service, $serviceMethodName], $inputParams); $outputData = $this->serviceOutputProcessor->process( $outputData, $serviceClassName, $serviceMethodName ); if ($request->getParam(FieldsFilter::FILTER_PARAMETER) && is_array($outputData)) { $outputData = $this->fieldsFilter->filter($outputData); } $header = $this->deploymentConfig->get(ConfigOptionsListConstants::CONFIG_PATH_X_FRAME_OPT); if ($header) { $this->response->setHeader('X-Frame-Options', $header); } $this->response->prepareResponse($outputData); } /** * {@inheritdoc} */ public function canProcess(\Magento\Framework\Webapi\Rest\Request $request) { if (preg_match(self::PROCESSOR_PATH, $request->getPathInfo()) === 1) { return true; } return false; } }