Documentation
Overview
md.http.server component provides psr.http.server contract implementation to build generic low-level web-application.
Implementation does not define the architecture design of high-level application how request will be handled, for example with Middleware or Dispatcher design pattern. It depends on high-level application implementation that will be injected.
Consider to look for md.http.server.lifecycle component that provides high-level application based on event model.
Architecture overview
Install
Usage
Request store
RequestStore
class designed to store request which is currently in process in the thread.
Info
Typically, current request management is low-level application
responsibility, it set request in RequestStore
on processing start,
and unset when processing is finished.
Notice
Data of this class is thread-aware, it means that each attribute has different values in diffrent threads.
Application
Application
component is an implementation of psr.http.server.RequestHandlerInterface
,
designed as low-level application to ,
that means it responds for common request processing
Info
Application is designed as stateless and could be accessed from few threads simultaneously.
high-level application:
- convert response type
low-level application:
- log request/response facts
- set request identifier
- put request into store
- calls [high-level application]
- tracks response status
- handles any RuntimeException
- measure request processing time