<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Concepts on GenHTTP Webserver</title><link>https://genhttp.org/documentation/content/concepts/</link><description>Recent content in Concepts on GenHTTP Webserver</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://genhttp.org/documentation/content/concepts/index.xml" rel="self" type="application/rss+xml"/><item><title>Request API</title><link>https://genhttp.org/documentation/content/concepts/request-api/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://genhttp.org/documentation/content/concepts/request-api/</guid><description>&lt;h2 id="request-api"&gt;Request API&lt;a class="anchor" href="#request-api" aria-label="Link to this section"&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="M4 9h16M4 15h16M10 3 8 21M16 3l-2 18"/&gt;&lt;/svg&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;To handle incoming HTTP requests, GenHTTP uses the &lt;code&gt;IRequest&lt;/code&gt; abstraction, which - besides granting access to&#10;infrastructure components such as the &lt;code&gt;IServer&lt;/code&gt;, &lt;code&gt;IEndPoint&lt;/code&gt; or &lt;code&gt;IClientConnection&lt;/code&gt;, is intended to represent the data&#10;on the wire as it was received by the connected client.&lt;/p&gt;&#10;&lt;p&gt;The core entry points to handle requests are &lt;a href="../../handlers/"&gt;handlers&lt;/a&gt; and &lt;a href="../../concerns/"&gt;concerns&lt;/a&gt;. The server&#10;host is passed a handler instance (known as root handler) which is then responsible for handling all incoming requests.&#10;If needed, it can use other handlers to delegate work (see &lt;a href="../../handlers/layouting/"&gt;layouting&lt;/a&gt; as a starting point).&lt;/p&gt;</description></item><item><title>Routing</title><link>https://genhttp.org/documentation/content/concepts/routing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://genhttp.org/documentation/content/concepts/routing/</guid><description>&lt;p&gt;When the server receives a request from the client, it passes it to the root handler&#10;specified by your application. Depending on the requested path, this handler&#10;may invoke additional handlers to actually produce a response. The tree of handlers&#10;available in your application is called &lt;em&gt;handler chain&lt;/em&gt;. As requests are passed&#10;from one handler to another, they need to track, which segments of the requested&#10;path have already been considered and which still need to be evaluated,&#10;effectively decoupling them from each other. This&#10;capability is provided by the routing feature of the framework.&lt;/p&gt;</description></item><item><title>Method Definitions</title><link>https://genhttp.org/documentation/content/concepts/definitions/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://genhttp.org/documentation/content/concepts/definitions/</guid><description>&lt;p&gt;All API frameworks share a common base provided by the &lt;code&gt;Reflection&lt;/code&gt; and &lt;code&gt;Conversion&lt;/code&gt; modules which&#10;define some of the capabilities that can be used when defining an API method&#10;signature.&lt;/p&gt;&#10;&lt;h2 id="injection"&gt;Injection&lt;a class="anchor" href="#injection" aria-label="Link to this section"&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="M4 9h16M4 15h16M10 3 8 21M16 3l-2 18"/&gt;&lt;/svg&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;This section describes how parameters of your methods are initialized and which&#10;kind of types can be used.&lt;/p&gt;&#10;&lt;h3 id="primitives"&gt;Primitives&lt;a class="anchor" href="#primitives" aria-label="Link to this section"&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="M4 9h16M4 15h16M10 3 8 21M16 3l-2 18"/&gt;&lt;/svg&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;By default, a parameter type can be used within a method definition if it is either &lt;code&gt;string&lt;/code&gt;,&#10;&lt;code&gt;bool&lt;/code&gt;, an &lt;code&gt;enum&lt;/code&gt;, one of &lt;code&gt;DateTime&lt;/code&gt;, &lt;code&gt;DateTimeOffset&lt;/code&gt;, &lt;code&gt;DateOnly&lt;/code&gt;, &lt;code&gt;TimeOnly&lt;/code&gt; or &lt;code&gt;TimeSpan&lt;/code&gt;, or&#10;implements &lt;code&gt;IUtf8SpanFormattable&lt;/code&gt; (which covers the numeric primitives such as &lt;code&gt;int&lt;/code&gt;, &lt;code&gt;long&lt;/code&gt; or&#10;&lt;code&gt;Guid&lt;/code&gt;).&lt;/p&gt;</description></item><item><title>Code Generation</title><link>https://genhttp.org/documentation/content/concepts/code-generation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://genhttp.org/documentation/content/concepts/code-generation/</guid><description>&lt;p&gt;By default, the server compiles a delegate for each webservice method that fetches the input&#10;arguments from the request, executes the method, and maps the result into an HTTP response -&#10;this is faster than analyzing and invoking the method via the reflection APIs on every request.&#10;The delegate is compiled once, during &lt;code&gt;PrepareAsync&lt;/code&gt; (i.e. server start), so it does not add any&#10;latency to the first request handled by the endpoint.&lt;/p&gt;</description></item><item><title>Response Content</title><link>https://genhttp.org/documentation/content/concepts/response-content/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://genhttp.org/documentation/content/concepts/response-content/</guid><description>&lt;div class="cards"&gt;&#13;&#10;&lt;a class="card card-icon" href="https://www.nuget.org/packages/GenHTTP.Modules.IO/" rel="noopener"&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="m16.5 9.4-9-5.19"/&gt;&lt;path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/&gt;&lt;path d="M3.29 7 12 12l8.71-5M12 22V12"/&gt;&lt;/svg&gt;&lt;span class="card-title"&gt;GenHTTP.Modules.IO&lt;/span&gt; &lt;span class="card-text"&gt;Package on NuGet&lt;/span&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="M7 17 17 7M8 7h9v9"/&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&#13;&#10;&lt;/div&gt;&#10;&#10;&lt;p&gt;When sending content in response to a client request, &lt;code&gt;IResponseBuilder&lt;/code&gt; has a single entry point for it:&#10;&lt;code&gt;Content(IResponseContent? content)&lt;/code&gt;. Everything about the content itself - its &lt;code&gt;Length&lt;/code&gt;, &lt;code&gt;Type&lt;/code&gt; and&#10;encoding - is a property of the &lt;code&gt;IResponseContent&lt;/code&gt; implementation being passed in, not something configured&#10;separately on the builder. &lt;code&gt;Length&lt;/code&gt; is the number of bytes the content will produce; if it is not known,&#10;chunked transfer encoding is applied.&lt;/p&gt;</description></item><item><title>Resources</title><link>https://genhttp.org/documentation/content/concepts/resources/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://genhttp.org/documentation/content/concepts/resources/</guid><description>&lt;div class="cards"&gt;&#13;&#10;&lt;a class="card card-icon" href="https://www.nuget.org/packages/GenHTTP.Modules.IO/" rel="noopener"&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="m16.5 9.4-9-5.19"/&gt;&lt;path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/&gt;&lt;path d="M3.29 7 12 12l8.71-5M12 22V12"/&gt;&lt;/svg&gt;&lt;span class="card-title"&gt;GenHTTP.Modules.IO&lt;/span&gt; &lt;span class="card-text"&gt;Package on NuGet&lt;/span&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="M7 17 17 7M8 7h9v9"/&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&#13;&#10;&lt;/div&gt;&#10;&#10;&lt;p&gt;GenHTTP provides a thin abstraction layer to control access of binary resources&#10;(such as files or blobs). This allows to re-use file-dependent handlers, independent from&#10;whether the data comes from the file system, a database or somewhere else.&lt;/p&gt;</description></item><item><title>Dependency Injection</title><link>https://genhttp.org/documentation/content/concepts/dependency-injection/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://genhttp.org/documentation/content/concepts/dependency-injection/</guid><description>&lt;div class="cards"&gt;&#13;&#10;&lt;a class="card card-icon" href="https://www.nuget.org/packages/GenHTTP.Modules.DependencyInjection/" rel="noopener"&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="m16.5 9.4-9-5.19"/&gt;&lt;path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/&gt;&lt;path d="M3.29 7 12 12l8.71-5M12 22V12"/&gt;&lt;/svg&gt;&lt;span class="card-title"&gt;GenHTTP.Modules.DependencyInjection&lt;/span&gt; &lt;span class="card-text"&gt;Package on NuGet&lt;/span&gt;&lt;svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&lt;path d="M7 17 17 7M8 7h9v9"/&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&#13;&#10;&lt;/div&gt;&#10;&#10;&lt;p&gt;This optional module allows to use Microsoft&amp;rsquo;s abstraction layer to inject dependencies into handlers,&#10;concerns and framework classes as well as their methods.&lt;/p&gt;</description></item></channel></rss>