Service Oriented Architecture (SOA)
Request-response Pipeline
- ICmsClient is a reference to the request client (user-agent, address, etc...)
- Location holds the requested address. Location is a specialized Uri wrapper, which is capable of showing a Smartsite mapping (Channel, ItemNumber properties) and has a Query NameValueCollection instead of a string.
- State is a read/write dictionary with the lifecycle of the request-response pipeline.
- ILocale and IPrincipal point to the current localized resources and the current user.
- StatusCode is an enumeration based on the well defined HTTP status codes
- Encoding sets or gets the current Response encoding
- MetaData points to the response headers
- The Stream property is used internally to write data into de response, or can be used directly to stream data to the client.
The Smartsite core architecture is fully service oriented. It allows for integration at many different levels, whether in-process in IIS (HttpHandler), in a custom webserver, from inside Smartsite itself, through webservices and Microsoft WCF, or from other servers/platforms such as Linux/Apache.
The abstract class CmsRequest defines the contract for Cms requests.
CmsRequest class:
The CmsReponse represents the response side of the pipeline:
CmsResponse class:
The built-in CmsRequest implementation, SimpleCmsRequest, is used to internally request data from the Cms. The IIS integration is done through an HttpHandler class and specialized versions of CmsRequest and CmsResponse.
A typical request for a Cms rendering would look like this:{formatexample('SimpleCmsRequest req = new SimpleCmsRequest(url); // url == standard Uri RenderEngine engine = site.Channels.CreateRenderEngine(req); ICmsResponse response = engine.Render(); ResponseTextbox.Text = response.Data.ToString();','csharp')}
Under IIS (from the HttpHandler), this is what's happening:{formatexample('AspNetCmsRequest req = new AspNetCmsRequest(context); // context == Asp Runtime HttpContext object RenderEngine engine = site.Channels.CreateRenderEngine(req); AspNetCmsResponse response = new AspNetCmsResponse(req, context); engine.Render();','csharp')}
Smartsite does not have to know who implements the pipeline. The SimpleCmsRequest for instance uses the built-in CmsResponse class that has a MemoryStream implemention, while the AspNetCmsResponse class internally leverages the System.Web.HttpContext object and directly maps most properties and methods to underlying state.