public function index()
    {
        try {
            $uri = null;
            if ($this->hasRequestParameter("uri")) {
                $uri = $this->getRequestParameter("uri");
                if (!common_Utils::isUri($uri)) {
                    throw new common_exception_InvalidArgumentType();
                }
            }

            switch ($this->getRequestMethod()) {
                case "GET":
                    $response = $this->get($uri);
                    break;
                case "PUT":
                    $response = $this->put($uri);
                    break;
                case "POST":
                    $response = $this->post();
                    break;
                case "DELETE":
                    $response = $this->delete($uri);
                    break;
                default:
                    throw new common_exception_BadRequest($this->getRequestURI());
            }

            $this->returnSuccess($response);

        } catch (Exception $e) {
            if ($e instanceof \common_exception_ValidationFailed &&
                $alias = $this->reverseSearchAlias($e->getField())
            ) {
                $e = new \common_exception_ValidationFailed($alias, null, $e->getCode());
            }

            $this->returnFailure($e);
        }
    }