Ground Sunlight

Windowsで作る - PHPプログラミングの開発環境

ユーザ用ツール

サイト用ツール


サイドバー

メインメニュー

XAMPP アレンジ

IED

WSL2

道具箱

リポジトリ編

フレームワーク編

公開ソフトウェア

メタ
リンク


このページへのアクセス
今日: 3 / 昨日: 2
総計: 1284

psr:psr15

文書の過去の版を表示しています。


編集中

PSR-15: HTTP Server Request Handlers

y2sunlight 2020-06-23

本章は、若干の補足を加筆してはいるものの単にPSRのサイトを翻訳したものに過ぎません。英語が堪能な方は原文をご参照下さい。翻訳に当たっては、基本的に機械翻訳を使い、理解できない部分は独断で意訳しております。拙い訳では御座いますが恥を忍んで投稿しておりますので、ご指摘など御座いましたらコメントを頂ければ幸いです。

関連記事


PSR-15: HTTPサーバーリクエストハンドラー

原文より翻訳 PSR-15: HTTP Server Request Handlers 2020-07-28 現在

This document describes common interfaces for HTTP server request handlers (“request handlers”) and HTTP server middleware components (“middleware”) that use HTTP messages as described by PSR-7 or subsequent replacement PSRs.

このドキュメントでは、PSR-7またはその後の代替PSRで説明されているHTTPメッセージを使用するHTTPサーバーリクエストハンドラー(「リクエストハンドラー」)とHTTPサーバーミドルウェアコンポーネント(「ミドルウェア」)の一般的なインターフェースについて説明します。

HTTP request handlers are a fundamental part of any web application. Server-side code receives a request message, processes it, and produces a response message. HTTP middleware is a way to move common request and response processing away from the application layer.

HTTPリクエストハンドラは、あらゆるWebアプリケーションの基本的な部分です。サーバー側コードは、リクエストメッセージを受信して処理し、応答メッセージを生成します。HTTPミドルウェアは、一般的なリクエストとレスポンスの処理をアプリケーション層から分離する方法です。

The interfaces described in this document are abstractions for request handlers and middleware.

このドキュメントで説明するインターフェースは、リクエストハンドラーとミドルウェアを抽象化したものです。

Note: All references to “request handlers” and “middleware” are specific to server request processing.

注:「リクエストハンドラー」および「ミドルウェア」へのすべての参照は、サーバーリクエスト処理に固有です。

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

このドキュメントのキーワード MUST , MUST NOT , REQUIRED , SHALL , SHALL NOT , SHOULD , SHOULD NOT , RECOMMENDED , MAY 及び OPTIONAL は、 RFC 2119で説明されているように解釈して下さい。

RFC 2119の説明
MUST, REQUIRED, SHALL — 絶対必要
MUST NOT, SHALL NOT — 絶対禁止
SHOULD, RECOMMENDED — 推奨(但し、無視できる特定の正当な理由が存在するかもしれない)
SHOULD NOT — 推奨できない(但し、許可できる特定の正当な理由が存在するかもしれない)
MAY, OPTIONAL — オプション

References

  • PSR-7 ・・・ HTTP message interfaces
  • RFC 2119 ・・・ Key words for use in RFCs to Indicate Requirement Levels


1. 仕様

1.1 リクエストハンドラ

A request handler is an individual component that processes a request and produces a response, as defined by PSR-7.

リクエストハンドラーは、PSR-7で定義されているように、リクエストを処理して応答を生成する個別のコンポーネントです。

A request handler MAY throw an exception if request conditions prevent it from producing a response. The type of exception is not defined.

リクエスト条件によりリクエストハンドラーがレスポンスを生成できない場合、リクエストハンドラーは例外をスローする場合があります( MAY )。例外のタイプは定義されていません。

Request handlers using this standard MUST implement the following interface:

この規約を使用するリクエストハンドラは、次のインターフェースを実装する必要があります( MUST ):

  • Psr\Http\Server\RequestHandlerInterface


1.2 ミドルウェア

A middleware component is an individual component participating, often together with other middleware components, in the processing of an incoming request and the creation of a resulting response, as defined by PSR-7.

ミドルウェアコンポーネントは、個別のコンポーネントですが、PSR-7で定義されているように、着信要求の処理と結果の応答の作成に他のミドルウェアコンポーネントと一緒に参加することが多いです。

A middleware component MAY create and return a response without delegating to a request handler, if sufficient conditions are met.

ミドルウェアコンポーネントは、十分な条件が満たされている場合、リクエストハンドラーに委任することなく応答を作成して返すことができます( MAY )。

Middleware using this standard MUST implement the following interface:

この規約を使用するミドルウェアは、次のインターフェースを実装する必要があります( MUST ):

  • Psr\Http\Server\MiddlewareInterface


1.3 レスポンスの生成

It is RECOMMENDED that any middleware or request handler that generates a response will either compose a prototype of a PSR-7 ResponseInterface or a factory capable of generating a ResponseInterface instance in order to prevent dependence on a specific HTTP message implementation.

応答を生成するミドルウェアまたはリクエストハンドラーは、PSR-7の ResponseInterface プロトタイプまたは ResponseInterface インスタンスを生成できるファクトリーを構成することをお勧めします( RECOMMENDED )。それは、特定のHTTPメッセージの実装への依存を防ぐためです。


1.4 例外のハンドリング

TODO


2. インターフェース

2.1 Psr\Http\Server\RequestHandlerInterface

TODO


2.2 Psr\Http\Server\MiddlewareInterface

TODO


コメント

コメントを入力. Wiki文法が有効です:
 
psr/psr15.1595903333.txt.gz · 最終更新: 2020/07/28 11:28 by tanaka