This commit is contained in:
as2252258@163.com
2021-09-12 03:46:24 +08:00
parent 989158bc3d
commit b91199671a
8 changed files with 1151 additions and 1090 deletions
+4 -5
View File
@@ -69,10 +69,9 @@ class Node
} }
/** /**
* @throws NotFindClassException * @param \Http\Route\Router $router
* @throws ReflectionException */
*/
public function __construct(public Router $router) public function __construct(public Router $router)
{ {
$eventDispatcher = di(EventProvider::class); $eventDispatcher = di(EventProvider::class);
@@ -197,7 +196,7 @@ class Node
* @param RequestInterface $request * @param RequestInterface $request
* @return bool * @return bool
*/ */
#[Pure] public function methodAllow(RequestInterface $request): bool public function methodAllow(RequestInterface $request): bool
{ {
if (!in_array($request->getMethod(), $this->method)) { if (!in_array($request->getMethod(), $this->method)) {
return true; return true;
File diff suppressed because it is too large Load Diff
+238 -191
View File
@@ -3,7 +3,7 @@
namespace Protocol\Message; namespace Protocol\Message;
use JetBrains\PhpStorm\Pure; use JetBrains\PhpStorm\Pure;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface; use Psr\Http\Message\StreamInterface;
@@ -13,236 +13,283 @@ use Psr\Http\Message\StreamInterface;
trait Message trait Message
{ {
/** /**
* @var string * @var string
*/ */
protected string $version; protected string $version;
/** /**
* @var StreamInterface * @var StreamInterface
*/ */
protected StreamInterface $stream; protected StreamInterface $stream;
/** /**
* @var array * @var array
*/ */
protected array $headers = []; protected array $headers = [];
/**
/** * @var array|null
* @var array|null */
*/ protected ?array $cookieParams = [];
protected ?array $cookieParams = [];
/** /**
* @return string * @return string
*/ */
public function getProtocolVersion(): string public function getProtocolVersion(): string
{ {
return $this->version; return $this->version;
} }
/** /**
* @param $version * @param $version
* @return static * @return static
*/ */
public function withProtocolVersion($version): static public function withProtocolVersion($version): static
{ {
$this->version = $version; $this->version = $version;
return $this; return $this;
} }
/** /**
* @return array * @return array
*/ */
public function getHeaders(): array public function getHeaders(): array
{ {
return $this->headers; return $this->headers;
} }
/** /**
* @param $name * @param $name
* @return bool * @return bool
*/ */
public function hasHeader($name): bool public function hasHeader($name): bool
{ {
return array_key_exists($name, $this->headers); return array_key_exists($name, $this->headers);
} }
/** /**
* @param $name * @param $name
* @return string|array|null * @return string|array|null
*/ */
#[Pure] public function getHeader($name): string|null|array #[Pure] public function getHeader($name): string|null|array
{ {
if (!$this->hasHeader($name)) { if (!$this->hasHeader($name)) {
return null; return null;
} }
return $this->headers[$name]; return $this->headers[$name];
} }
/** /**
* @param \Swoole\Http\Request $request * @return array
* @return static */
*/ public function parse_curl_header(): array
public function parseRequestHeaders(\Swoole\Http\Request $request): static {
{ $_headers = [];
$index = strpos($request->getData(), "\r\n\r\n"); foreach ($this->headers as $key => $val) {
$headers = explode("\r\n", substr($request->getData(), 0, $index)); $_headers[] = $key . ': ' . implode(';', $val);
array_shift($headers); }
foreach ($headers as $header) { return $_headers;
[$key, $value] = explode(': ', $header); }
$this->addRequestHeader($key, $value);
}
return $this;
}
/** /**
* @param $key * @throws \Exception
* @param $value */
*/ public function withData(string $headerString): static
private function addRequestHeader($key, $value) {
{ [$headers, $body] = explode("\r\n\r\n", $headerString);
$this->headers[$key] = [$value];
} $this->stream = new Stream($body);
return $this->slip_headers($headers);
}
/** /**
* @param $name * @param $headers
* @return string|null * @return $this
*/ * @throws \Exception
#[Pure] public function getHeaderLine($name): string|null */
{ private function slip_headers($headers): static
if ($this->hasHeader($name)) { {
return implode(';', $this->headers[$name]); $headers = explode("\r\n", $headers);
}
return null; $this->resolve_status(array_shift($headers));
}
foreach ($headers as $header) {
[$key, $value] = explode(': ', $header);
$this->withHeader($key, $value);
}
return $this;
}
/** /**
* @return string|null * @param string $protocol
*/ */
#[Pure] public function getContentType(): ?string private function resolve_status(string $protocol)
{ {
return $this->getHeaderLine('Content-Type'); if ($this instanceof ResponseInterface) {
} [$sch, $status, $message] = explode(' ', $protocol);
[$sch, $protocolVersion] = explode('/', $sch);
$this->withProtocolVersion($protocolVersion)
->withStatus(intval($status));
}
}
/** /**
* @param $name * @param $key
* @param $value * @param $value
* @return static */
*/ private function addRequestHeader($key, $value)
public function withHeader($name, $value): static {
{ $this->headers[$key] = [$value];
if (!is_array($value)) { }
$value = [$value];
}
$this->headers[$name] = $value;
return $this;
}
/** /**
* @param $name * @param $name
* @param $value * @return string|null
* @return static */
* @throws #[Pure] public function getHeaderLine($name): string|null
*/ {
public function withAddedHeader($name, $value): static if ($this->hasHeader($name)) {
{ return implode(';', $this->headers[$name]);
if (!array_key_exists($name, $this->headers)) { }
throw new \Exception('Headers `' . $name . '` not exists.'); return null;
} }
$this->headers[$name][] = $value;
return $this;
}
/** /**
* @param $name * @return string|null
* @return static */
*/ #[Pure] public function getContentType(): ?string
public function withoutHeader($name): static {
{ return $this->getHeaderLine('Content-Type');
unset($this->headers[$name]); }
return $this;
}
/** /**
* @return null|array * @param $name
*/ * @param $value
public function getCookieParams(): ?array * @return static
{ */
return $this->cookieParams; public function withHeader($name, $value): static
} {
if (!is_array($value)) {
$value = [$value];
}
$this->headers[$name] = $value;
return $this;
}
/** /**
* @param array|null $cookies * @param $name
* @return static * @param $value
*/ * @return static
public function withCookieParams(?array $cookies): static * @throws
{ */
$this->cookieParams = $cookies; public function withAddedHeader($name, $value): static
return $this; {
} if (!array_key_exists($name, $this->headers)) {
throw new \Exception('Headers `' . $name . '` not exists.');
/** }
* @return StreamInterface $this->headers[$name][] = $value;
*/ return $this;
public function getBody(): StreamInterface }
{
return $this->stream;
}
/** /**
* @param StreamInterface $body * @param $name
* @return static * @return static
*/ */
public function withBody(StreamInterface $body): static public function withoutHeader($name): static
{ {
$this->stream = $body; unset($this->headers[$name]);
return $this; return $this;
} }
/** /**
* @return string|null * @return null|array
*/ */
#[Pure] public function getAccessControlAllowOrigin(): ?string public function getCookieParams(): ?array
{ {
return $this->getHeaderLine('Access-Control-Allow-Origin'); return $this->cookieParams;
} }
/** /**
* @return string|null * @param array|null $cookies
*/ * @return static
#[Pure] public function getAccessControlAllowHeaders(): ?string */
{ public function withCookieParams(?array $cookies): static
return $this->getHeaderLine('Access-Control-Allow-Headers'); {
} $this->cookieParams = $cookies;
return $this;
}
/**
* @return StreamInterface
*/
public function getBody(): StreamInterface
{
return $this->stream;
}
/** /**
* @return string|null * @param StreamInterface $body
*/ * @return static
#[Pure] public function getAccessControlRequestMethod(): ?string */
{ public function withBody(StreamInterface $body): static
return $this->getHeaderLine('Access-Control-Request-Method'); {
} $this->stream = $body;
return $this;
}
/**
* @return string|null
*/
#[Pure] public function getAccessControlAllowOrigin(): ?string
{
return $this->getHeaderLine('Access-Control-Allow-Origin');
}
/**
* @return string|null
*/
#[Pure] public function getAccessControlAllowHeaders(): ?string
{
return $this->getHeaderLine('Access-Control-Allow-Headers');
}
/**
* @return string|null
*/
#[Pure] public function getAccessControlRequestMethod(): ?string
{
return $this->getHeaderLine('Access-Control-Request-Method');
}
protected function setStore($key, callable $callback)
{
}
} }
+1 -1
View File
@@ -11,7 +11,7 @@ use Psr\Http\Message\UriInterface;
/** /**
* *
*/ */
abstract class Request implements RequestInterface class Request implements RequestInterface
{ {
use Message; use Message;
+159 -157
View File
@@ -14,193 +14,195 @@ class ServerRequest extends Request implements ServerRequestInterface
{ {
/** const PARSE_BODY = 'with.parsed.body.callback';
* @var mixed
*/
protected ?array $parsedBody = null;
/** /**
* @var array|null * @var mixed
*/ */
protected ?array $serverParams; protected ?array $parsedBody = null;
/** /**
* @var array|null * @var array|null
*/ */
protected ?array $queryParams; protected ?array $serverParams;
/**
* @var array|null
*/
protected ?array $uploadedFiles;
protected \Swoole\Http\Request $serverTarget; /**
* @var array|null
*/
protected ?array $queryParams;
/**
* @var array|null
*/
protected ?array $uploadedFiles;
/** protected \Swoole\Http\Request $serverTarget;
* @param array $server
* @return static
*/
public function withServerParams(array $server): static
{
$this->serverParams = $server;
return $this;
}
/**
* @param \Swoole\Http\Request $server
* @return static
*/
public function withServerTarget(\Swoole\Http\Request $server): static
{
$this->serverTarget = $server;
return $this;
}
/** /**
* @param \Swoole\Http\Request $request * @param array $server
* @return static|ServerRequestInterface * @return static
*/ */
public static function createServerRequest(\Swoole\Http\Request $request): static|ServerRequestInterface public function withServerParams(array $server): static
{ {
return (new static())->parseRequestHeaders($request) $this->serverParams = $server;
->withServerParams($request->server) return $this;
->withServerTarget($request) }
->withCookieParams($request->cookie)
->withUri(Uri::parseUri($request)) /**
->withBody(new Stream($request->getContent())) * @param \Swoole\Http\Request $server
->withQueryParams($request->get ?? []) * @return static
->withUploadedFiles($request->files ?? []) */
->withMethod($request->getMethod()) public function withServerTarget(\Swoole\Http\Request $server): static
->withParsedBody(function (StreamInterface $stream, ?array $posts) { {
try { $this->serverTarget = $server;
$content = Parse::data($stream->getContents()); return $this;
if (!empty($content)) { }
return $content;
}
return $posts;
} catch (\Throwable $throwable) {
return $posts;
}
});
}
/** /**
* @return null|array * @param \Swoole\Http\Request $request
*/ * @return static|ServerRequestInterface
public function getServerParams(): ?array * @throws \Exception
{ */
return $this->serverParams; public static function createServerRequest(\Swoole\Http\Request $request): static|ServerRequestInterface
} {
$serverRequest = new ServerRequest();
$serverRequest->withData($request->getData());
$serverRequest->withServerParams($request->server);
$serverRequest->withServerTarget($request);
$serverRequest->withCookieParams($request->cookie);
$serverRequest->withUri(Uri::parseUri($request));
$serverRequest->withQueryParams($request->get ?? []);
$serverRequest->withUploadedFiles($request->files ?? []);
$serverRequest->withMethod($request->getMethod());
$serverRequest->withParsedBody($request->post);
return $serverRequest;
}
/** /**
* @return array|null * @return null|array
*/ */
public function getQueryParams(): ?array public function getServerParams(): ?array
{ {
return $this->queryParams; return $this->serverParams;
} }
/** /**
* @param array $query * @return array|null
* @return ServerRequestInterface */
*/ public function getQueryParams(): ?array
public function withQueryParams(array $query): ServerRequestInterface {
{ return $this->queryParams;
$this->queryParams = $query; }
return $this;
}
/** /**
* @return array|null * @param array $query
*/ * @return ServerRequestInterface
public function getUploadedFiles(): ?array */
{ public function withQueryParams(array $query): ServerRequestInterface
return $this->uploadedFiles; {
} $this->queryParams = $query;
return $this;
}
/** /**
* @param array $uploadedFiles * @return array|null
* @return ServerRequestInterface */
*/ public function getUploadedFiles(): ?array
public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface {
{ return $this->uploadedFiles;
$this->uploadedFiles = $uploadedFiles; }
return $this;
}
/** /**
* @return array|object|null * @param array $uploadedFiles
*/ * @return ServerRequestInterface
public function getParsedBody(): object|array|null */
{ public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface
if (empty($this->parsedBody)) { {
$callback = Context::getContext('with.parsed.body.callback'); $this->uploadedFiles = $uploadedFiles;
return $this;
$this->parsedBody = $callback($this->getBody(), $this->serverTarget->post); }
}
return $this->parsedBody;
}
/** /**
* @param array|object|null $data * @return array|object|null
* @return ServerRequestInterface */
*/ public function getParsedBody(): object|array|null
public function withParsedBody($data): ServerRequestInterface {
{ if (empty($this->parsedBody)) {
Context::setContext('with.parsed.body.callback', $data); $callback = Context::getContext(self::PARSE_BODY);
return $this;
} $this->parsedBody = $callback($this->getBody(), $this->serverTarget->post);
}
return $this->parsedBody;
}
/** /**
* @return array * @param array|object|null $data
*/ * @return ServerRequestInterface
public function getAttributes(): array */
{ public function withParsedBody($data): ServerRequestInterface
throw new \BadMethodCallException('Not Accomplish Method.'); {
} $functions = function (StreamInterface $stream) use ($data) {
$content = Parse::data($stream->getContents());
if (!empty($content)) {
return $content;
}
return $data;
};
Context::setContext(self::PARSE_BODY, $functions);
return $this;
}
/** /**
* @param string $name * @return array
* @param null $default */
* @return mixed public function getAttributes(): array
*/ {
public function getAttribute($name, $default = null): mixed throw new \BadMethodCallException('Not Accomplish Method.');
{ }
throw new \BadMethodCallException('Not Accomplish Method.');
}
/** /**
* @param string $name * @param string $name
* @param mixed $value * @param null $default
* @return ServerRequestInterface * @return mixed
*/ */
public function withAttribute($name, $value): ServerRequestInterface public function getAttribute($name, $default = null): mixed
{ {
throw new \BadMethodCallException('Not Accomplish Method.'); throw new \BadMethodCallException('Not Accomplish Method.');
} }
/** /**
* @param string $name * @param string $name
* @return ServerRequestInterface * @param mixed $value
*/ * @return ServerRequestInterface
public function withoutAttribute($name): ServerRequestInterface */
{ public function withAttribute($name, $value): ServerRequestInterface
throw new \BadMethodCallException('Not Accomplish Method.'); {
} throw new \BadMethodCallException('Not Accomplish Method.');
}
/**
* @param string $name
* @return ServerRequestInterface
*/
public function withoutAttribute($name): ServerRequestInterface
{
throw new \BadMethodCallException('Not Accomplish Method.');
}
} }
+202 -201
View File
@@ -10,246 +10,247 @@ class Uri implements UriInterface
{ {
protected string $scheme = ''; protected string $scheme = '';
protected string $host = ''; protected string $host = '';
protected string $path = ''; protected string $path = '';
protected string $fragment = ''; protected string $fragment = '';
protected int $port = 80; protected int $port = 80;
protected string $queryString = ''; protected string $queryString = '';
/** /**
* @return string * @return string
*/ */
public function getScheme(): string public function getScheme(): string
{ {
return $this->scheme; return $this->scheme;
} }
/** /**
* @return string * @return string
*/ */
public function getAuthority(): string public function getAuthority(): string
{ {
throw new \BadMethodCallException('Not Accomplish Method.'); throw new \BadMethodCallException('Not Accomplish Method.');
} }
/** /**
* @return string * @return string
*/ */
public function getUserInfo(): string public function getUserInfo(): string
{ {
throw new \BadMethodCallException('Not Accomplish Method.'); throw new \BadMethodCallException('Not Accomplish Method.');
} }
/** /**
* @return string * @return string
*/ */
public function getHost(): string public function getHost(): string
{ {
return $this->host; return $this->host;
} }
/**
* @return int|null
*/
public function getPort(): ?int
{
return $this->port;
}
/** /**
* @return string * @return int|null
*/ */
public function getPath(): string public function getPort(): ?int
{ {
return $this->path; return $this->port;
} }
/** /**
* @return string * @return string
*/ */
public function getQuery(): string public function getPath(): string
{ {
return $this->queryString; return $this->path;
} }
/** /**
* @return string * @return string
*/ */
public function getFragment(): string public function getQuery(): string
{ {
throw new \BadMethodCallException('Not Accomplish Method.'); return $this->queryString;
} }
/** /**
* @param string $scheme * @return string
* @return $this|Uri */
*/ public function getFragment(): string
public function withScheme($scheme): UriInterface {
{ throw new \BadMethodCallException('Not Accomplish Method.');
$this->scheme = $scheme; }
return $this;
}
/** /**
* @param string $user * @param string $scheme
* @param null $password * @return $this|Uri
* @return Uri */
*/ public function withScheme($scheme): UriInterface
public function withUserInfo($user, $password = null): UriInterface {
{ $this->scheme = $scheme;
throw new \BadMethodCallException('Not Accomplish Method.'); return $this;
} }
/** /**
* @param string $host * @param string $user
* @return $this|Uri * @param null $password
*/ * @return Uri
public function withHost($host): UriInterface */
{ public function withUserInfo($user, $password = null): UriInterface
$this->host = $host; {
return $this; throw new \BadMethodCallException('Not Accomplish Method.');
} }
/** /**
* @param int|null $port * @param string $host
* @return $this|Uri * @return $this|Uri
*/ */
public function withPort($port): UriInterface public function withHost($host): UriInterface
{ {
$this->port = $port; $this->host = $host;
return $this; return $this;
} }
/** /**
* @param string $path * @param int|null $port
* @return $this|Uri * @return $this|Uri
*/ */
public function withPath($path): UriInterface public function withPort($port): UriInterface
{ {
$this->path = $path; $this->port = $port;
return $this; return $this;
} }
/** /**
* @param string $query * @param string $path
* @return $this|Uri * @return $this|Uri
*/ */
public function withQuery($query): UriInterface public function withPath($path): UriInterface
{ {
$this->queryString = $query; $this->path = $path;
return $this; return $this;
} }
/** /**
* @param string $fragment * @param string $query
* @return Uri * @return $this|Uri
*/ */
public function withFragment($fragment): UriInterface public function withQuery($query): UriInterface
{ {
throw new \BadMethodCallException('Not Accomplish Method.'); $this->queryString = $query;
} return $this;
}
/** /**
* @return string * @param string $fragment
*/ * @return Uri
public function __toString(): string */
{ public function withFragment($fragment): UriInterface
$domain = sprintf('%s://%s', $this->scheme, $this->host); {
if (!in_array($this->port, [80, 443])) { throw new \BadMethodCallException('Not Accomplish Method.');
$domain .= ':' . $this->port; }
}
if (empty($this->query) && empty($this->fragment)) {
return $domain . $this->path;
}
return sprintf('%s?%s#%s', $domain . $this->path,
$this->queryString, $this->fragment);
}
/** /**
* @return int * @return string
*/ */
public function getDefaultPort(): int public function __toString(): string
{ {
return $this->scheme == 'https' ? 443 : 80; $domain = sprintf('%s://%s', $this->scheme, $this->host);
} if (!in_array($this->port, [80, 443])) {
$domain .= ':' . $this->port;
}
if (empty($this->query) && empty($this->fragment)) {
return $domain . $this->path;
}
return sprintf('%s?%s#%s', $domain . $this->path,
$this->queryString, $this->fragment);
}
/** /**
* @param Request $request * @return int
* @return UriInterface */
*/ public function getDefaultPort(): int
public static function parseUri(Request $request): UriInterface {
{ return $this->scheme == 'https' ? 443 : 80;
$server = $request->server; }
$header = $request->header;
$uri = new static();
$uri = $uri->withScheme(!empty($server['https']) && $server['https'] !== 'off' ? 'https' : 'http');
if (isset($request->header['x-forwarded-proto'])) {
$uri->withScheme($request->header['x-forwarded-proto'])->withPort(443);
}
$hasPort = false;
if (isset($server['http_host'])) {
$hostHeaderParts = explode(':', $server['http_host']);
$uri = $uri->withHost($hostHeaderParts[0]);
if (isset($hostHeaderParts[1])) {
$hasPort = true;
$uri = $uri->withPort($hostHeaderParts[1]);
}
} elseif (isset($server['server_name'])) {
$uri = $uri->withHost($server['server_name']);
} elseif (isset($server['server_addr'])) {
$uri = $uri->withHost($server['server_addr']);
} elseif (isset($header['host'])) {
$hasPort = true;
if (strpos($header['host'], ':')) {
[$host, $port] = explode(':', $header['host'], 2);
if ($port != $uri->getDefaultPort()) {
$uri = $uri->withPort($port);
}
} else {
$host = $header['host'];
}
$uri = $uri->withHost($host); /**
} * @param Request $request
* @return UriInterface
*/
public static function parseUri(Request $request): UriInterface
{
$server = $request->server;
$header = $request->header;
$uri = new static();
$uri = $uri->withScheme(!empty($server['https']) && $server['https'] !== 'off' ? 'https' : 'http');
if (isset($request->header['x-forwarded-proto'])) {
$uri->withScheme($request->header['x-forwarded-proto'])->withPort(443);
}
if (!$hasPort && isset($server['server_port'])) { $hasPort = false;
$uri = $uri->withPort($server['server_port']); if (isset($server['http_host'])) {
} $hostHeaderParts = explode(':', $server['http_host']);
$uri = $uri->withHost($hostHeaderParts[0]);
if (isset($hostHeaderParts[1])) {
$hasPort = true;
$uri = $uri->withPort($hostHeaderParts[1]);
}
} elseif (isset($server['server_name'])) {
$uri = $uri->withHost($server['server_name']);
} elseif (isset($server['server_addr'])) {
$uri = $uri->withHost($server['server_addr']);
} elseif (isset($header['host'])) {
$hasPort = true;
if (strpos($header['host'], ':')) {
[$host, $port] = explode(':', $header['host'], 2);
if ($port != $uri->getDefaultPort()) {
$uri = $uri->withPort($port);
}
} else {
$host = $header['host'];
}
$hasQuery = false; $uri = $uri->withHost($host);
if (isset($server['request_uri'])) { }
$requestUriParts = explode('?', $server['request_uri']);
$uri = $uri->withPath($requestUriParts[0]);
if (isset($requestUriParts[1])) {
$hasQuery = true;
$uri = $uri->withQuery($requestUriParts[1]);
}
}
if (!$hasQuery && isset($server['query_string'])) { if (!$hasPort && isset($server['server_port'])) {
$uri = $uri->withQuery($server['query_string']); $uri = $uri->withPort($server['server_port']);
} }
return $uri; $hasQuery = false;
} if (isset($server['request_uri'])) {
$requestUriParts = explode('?', $server['request_uri']);
$uri = $uri->withPath($requestUriParts[0]);
if (isset($requestUriParts[1])) {
$hasQuery = true;
$uri = $uri->withQuery($requestUriParts[1]);
}
}
if (!$hasQuery && isset($server['query_string'])) {
$uri = $uri->withQuery($server['query_string']);
}
return $uri;
}
} }
+5 -4
View File
@@ -49,10 +49,11 @@ class Request implements RequestInterface
} }
/** /**
* @param \Swoole\Http\Request $request * @param \Swoole\Http\Request $request
* @return Request * @return Request
*/ * @throws \Exception
*/
public static function create(\Swoole\Http\Request $request): Request public static function create(\Swoole\Http\Request $request): Request
{ {
$serverRequest = ServerRequest::createServerRequest($request); $serverRequest = ServerRequest::createServerRequest($request);
+1 -1
View File
@@ -42,7 +42,7 @@ class Http extends \Server\Abstracts\Http implements OnClose, OnConnect
public function onRequest(Request $request, Response $response): void public function onRequest(Request $request, Response $response): void
{ {
try { try {
$node = $this->router->Branch_search($Psr7Request = ScRequest::create($request)); $node = $this->router->radix_tree($Psr7Request = ScRequest::create($request));
if (!($node instanceof Node)) { if (!($node instanceof Node)) {
throw new RequestException(Constant::STATUS_404_MESSAGE, 404); throw new RequestException(Constant::STATUS_404_MESSAGE, 404);
} }