public function handleRequest()
    {
        try {
            $server = $this->environment->getRequestHelper()->getServerParams();
            $serviceName = preg_replace('/^(.*?)(\?.*)?$/', '$1', $this->getURI($server));
            $className = $this->findServiceClassName($this->services, $serviceName);
            $method = $this->getMethod($server);
            $this->handleAllowedOrigins();

            if ($method != 'options') {
                $this->callService($className, $serviceName, $method);
            }
        } catch (InvalidParameterException $e) {
            $msg = $e->getMessage() ?: "Missing parameter";
            $this->environment->sendResult('400 Bad Request', 'text/plain; charset=utf-8', $msg);
        } catch (DenyException $e) {
            $this->environment->sendResult('403 Forbidden', "text/plain; charset=utf-8", $e->getMessage());
        } catch (\Exception $e) {
            $this->environment->sendResult('500 Server error', "text/plain; charset=utf-8", $e->getMessage());
        }
    }
public function handleRequest()
    {
        try {
            $server = $this->environment->getRequestHelper()->getServerParams();
            $serviceName = preg_replace('/^(.*?)(\?.*)?$/', '$1', $this->getURI($server));
            $className = $this->findServiceClassName($this->services, $serviceName);
            $method = $this->getMethod($server);
            $this->handleAllowedOrigins();

            if ($method != 'options') {
                $this->callService($className, $serviceName, $method);
            }
        } catch (InvalidParameterException $e) {
            $msg = $e->getMessage() ?: "Missing parameter";
            $this->environment->sendResult('400 Bad Request', 'text/plain; charset=utf-8', $msg);
        } catch (DenyException $e) {
            $this->environment->sendResult('403 Forbidden', "text/plain; charset=utf-8", $e->getMessage());
        } catch (\Exception $e) {
            $this->environment->sendResult('500 Server error', "text/plain; charset=utf-8", $e->getMessage());
        }
    }
public function handleRequest ( ) { try { $ server = $ this -> environment -> getRequestHelper ( ) -> getServerParams ( ) ; $ serviceName = preg_replace ( '/^(.*?)(\?.*)?$/' , '$1' , $ this -> getURI ( $ server ) ) ; $ className = $ this -> findServiceClassName ( $ this -> services , $ serviceName ) ; $ method = $ this -> getMethod ( $ server ) ; $ this -> handleAllowedOrigins ( ) ; if ( $ method != 'options' ) { $ this -> callService ( $ className , $ serviceName , $ method ) ; } } catch ( InvalidParameterException $ e ) { $ msg = $ e -> getMessage ( ) ? : "Missing parameter" ; $ this -> environment -> sendResult ( '400 Bad Request' , 'text/plain; charset=utf-8' , $ msg ) ; } catch ( DenyException $ e ) { $ this -> environment -> sendResult ( '403 Forbidden' , "text/plain; charset=utf-8" , $ e -> getMessage ( ) ) ; } catch ( \ Exception $ e ) { $ this -> environment -> sendResult ( '500 Server error' , "text/plain; charset=utf-8" , $ e -> getMessage ( ) ) ; } }
Handles a request by instantiating the matching REST service class in the current project.
Handles a request by instantiating the matching REST service class in the current project .