Inversion.Web
, project notes
Extensions provided for ``WebBehaviour` providing basic checks performed in behaviour conditions.
Determines whether or not the current context user is in any of the required-user-roles
configured for this behaviour.
self
: The behaviour to act upon.ctx
: The context to consult.
returns:
Returns true if the current context user is in any of the required-user-roles
configured for this behaviour.
A behaviour responsible for boostrapping the request processing. Out of the box it simply imports the prameters configured for this behaviour into the contexts params, so can be seen as a way to configure a context with default prameters. It should be see as a point of extensibility for setting up the default state of a context prior to processing a request.
.#ctor(System.String,System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{System.String,System.String}})
Instantiates a new bootstrap behaviour configured with the key-value pairs provided as parameters.
respondsTo
: The message this behaviour should respond to.parms
: The key value-pairs to configure as parameters for this behaviour.
If the conditions of this behaviour are met, copies the parameters configured for this behaviour into the context parameters.
ev
: The event that gave rise to this action.context
: The context within which this action is being performed.
Gives access to the prameters configured for the bootstrap behaviour that should be copied into the context params early in the request life-cycle.
A web behaviour that has been provided with a configuration.
An specification of basic web-centric features for process behaviours being used in a web application.
The considtion that determines whether of not the behaviours action is valid to run.
ev
: The event to consider with the condition.context
: The context to use.
returns:
true
if the condition is met; otherwise, returns false
.
The action to perform if this behaviours condition is met.
ev
: The event to consult.context
: The context upon which to perform any action.
Creates a new instance of the behaviour with no configuration.
respondsTo
: The message the behaviour will respond to.
:Inversion.Web.Behaviour.ConfiguredWebBehaviour.#ctor(System.String,Inversion.Process.Configuration)
Creates a new instance of the behaviour.
respondsTo
: The message the behaviour will respond to.config
: Configuration for the behaviour.
:Inversion.Web.Behaviour.ConfiguredWebBehaviour.#ctor(System.String,System.Collections.Generic.IEnumerable{Inversion.Process.Configuration.Element})
Creates a new instance of the behaviour.
respondsTo
: The message the behaviour will respond to.config
: Configuration for the behaviour.
:Inversion.Web.Behaviour.ConfiguredWebBehaviour.Condition(Inversion.Process.IEvent,Inversion.Web.IWebContext)
The considtion that determines whether of not the behaviours action is valid to run.
ev
: The event to consider with the condition.context
: The context to use.
returns:
true
if the condition is met; otherwise, returns false
.
:Inversion.Web.Behaviour.ConfiguredWebBehaviour.Action(Inversion.Process.IEvent,Inversion.Web.IWebContext)
The action to perform if this behaviours condition is met.
ev
: The event to consult.context
: The context upon which to perform any action.
Provides a web behaviour with common config driven selection criteria.
Creates a new instance of the behaviour with no configuration.
respondsTo
: The message the behaviour will respond to.
Creates a new instance of the behaviour.
respondsTo
: The message the behaviour will respond to.config
: Configuration for the behaviour.
.#ctor(System.String,System.Collections.Generic.IEnumerable{Inversion.Process.Configuration.Element})
Creates a new instance of the behaviour.
respondsTo
: The message the behaviour will respond to.config
: Configuration for the behaviour.
The considtion that determines whether of not the behaviours action is valid to run.
ev
: The event to consider with the condition.context
: The context to use.
returns:
true
if the condition is met; otherwise, returns false
.
The action to perform if this behaviours condition is met.
ev
: The event to consult.context
: The context upon which to perform any action.
Behaviour responsible for deconstructing the request into a set of conext prameters.
An abstract provision of basic web-centric features for process behaviours being used in a web application.
Creates a new instance of the behaviour.
respondsTo
: The name of the behaviour.
Determines if this behaviours action should be executed in response to the provided event.
ev
: The event to consider.
returns: Returns true if this behaviours action to execute in response to this event; otherwise returns false.
Determines if this behaviours action should be executed in response to the provided event and context.
ev
: The event to consider.context
: The context to consider.
returns:
The action to perform if this behaviours condition is met.
ev
: The event to consult.
The action to perform if this behaviours condition is met.
ev
: The event to consult.context
: The context upon which to perform any action.
Implementors should impliment this behaviour with the desired action for their behaviour.
ev
: The event to consult.context
: The context upon which to perform any action.
Instantiates a behaviour that decontructs the request into context parameters.
respondsTo
: The message that the behaviour will respond to.
Instantiates a behaviour that decontructs the request into context parameters.
respondsTo
: The message that the behaviour will respond to.appDirectory
: Configures an application directory to be regarded for the application. The application directory is that part of the request path that is not significant to the request but instead represents the root directory of the application.
:Inversion.Web.Behaviour.ParseRequestBehaviour.Action(Inversion.Process.IEvent,Inversion.Web.IWebContext)
Deconstructs the contexts request into a set of prameters for the context.
The deafult implementation uses the convention of /area/concern/action.aspc/tail?querystring
ev
: The vent that was considered for this action.context
: The context to act upon.
Behaviour responsible for driving the view pipeline expressed as view-steps.
Instantiates a new behaviour responsible for processes the inversion view pipeline.
respondsTo
: The message that the behaviour will respond to.
Iterates over each view-step object for the provided context and fires the event for that viiews processing. This is a driving behaviour.
ev
: The vent that was considered for this action.context
: The context to act upon.
Controls the writting of results from the last view step in the view pipeline to the response stream.
This behaviour is not responsible for producing or transforming views, merely the writting of results. Consult Inversion.Web.Behaviour.ProcessViewsBehaviour for the actually processing of views.
Creates a new instance of a render behaviour.
respondsTo
: The name of the render behaviour. Throws an exception is there is no view step to actually render.
Constructs the initial view state of the reuqest as a Inversion.Process.ViewStep composed of the current Inversion.Process.ProcessContext.ControlState .
This is basically a filtering of the Inversion.Process.ProcessContext.ControlState into the model called the view state, that is going to be rendered. Any item in the control state with a key starting with the underscore character '_' is regarded as protected, and will not be copied forward to the view state.
If one wished to present a model for render by different means, or wanted to change how the filtering was done, this is the behaviour you would swap out for an alternate implementation.
Instantiates a new view state behaviour configured with the message provided.
respondsTo
: The message the behaviour has set as responding to.
Takes the control state of the provided context and from it produces a view state model that is used as the basis of the view-step render pipeline.
This is what you'd override if you wanted to govern your own model presented to your view layer.
ev
: The event that gave rise to this action.context
: The context within which this action is being performed.
Serialise the model of the last view step to json.
Instantiates a new xml view behaviour to provide production of json views.
Defaults the content-type to "application/json"
respondsTo
: The message the behaviour has set as responding to.
Instantiates a new xml view behaviour to provide production of json views.
respondsTo
: The message the behaviour has set as responding to.contentType
: The content type of the view step produced from this behaviour.
Writes the model of the last view-step as json to the content of a new view-step.
ev
: The event that gave rise to this action.context
: The context within which this action is being performed.
A web behaviour that resolves razor templates to generate views.
Razor isn't getting a lot of attention in Inversion initially, at some point I'll pay it some attention, but it's really not a priority as personally I'm not a big fan.
Razor is the fast food of templating. It's really tasting and super-saturated with utility, and it's bad for you. When rendering a view you really shouldn't be able to yield side-effects, and you shouldn't be able to consider anything other than the view you're rendering. In Razor you can do anything you want. And you will. Especially when people aren't looking.
Worse, you'll start architecting clever helpers, and mappings, and... you'll start refactoring, and all your templates will become enmeshed in one glorious front-end monolith.
Razor. Just say "no"... Okay, I'm over-egging it a bit.
Joking aside, I get why Razor is so popular. It's simple, bendy, easy for .NET devs to dive into, and you can brute force yourself out of any situation. It does however in my view encourage poor practice and blurs an important application layer so the middle and front of the application risk becoming quickly enmeshed.
Conclave favours XML/XSL, I understand why you might not, hence Inversion.Web.Behaviour.View.RazorViewBehaviour .
respondsTo
:
This constructor defaults the content type to text/html
.
respondsTo
:contentType
:
Tranforms the last view-step using a razor template.
ev
: The vent that was considered for this action.context
: The context to act upon.
A behaviour that will transform the last view step by attempting to locate a template based on the context parameters of area, concern and action.
Locates possible templates of the specified extension.
ctx
: The context to consult.extension
: The file extension of templates to look for.
returns: Returns an enumerable of template names.
The locations checked are produced by the following series of yields:-
//area/concern/action
yield return Path.Combine(area, concern, action);
yield return Path.Combine(area, concern, "default.ext");
// area/action
yield return Path.Combine(area, action);
yield return Path.Combine(area, "default.ext");
// concern/action
yield return Path.Combine(concern, action);
yield return Path.Combine(concern, "default.ext");
// action
yield return action;
yield return "default.xslt";
Where ".ext" referes to the extension specified.
Creates a new instance of the behaviour.
respondsTo
: The name of the behaviour.contentType
: The content type of the view step produced from this behaviour.
The content type of this behaviours transformation.
Serialise the model of the last view step to XML.
Instantiates a new xml view behaviour to provide production of xml views.
Defaults the content-type to "text/xml"
respondsTo
: The message the behaviour has set as responding to.
Instantiates a new xml view behaviour to provide production of xml views.
respondsTo
: The message the behaviour has set as responding to.contentType
: The content type of the view step produced from this behaviour.
Writes the model of the last view-step as xml to the content of a new view-step.
ev
: The event that gave rise to this action.context
: The context within which this action is being performed.
A behaviour that will transform the last view step by attempting to find an appropriate XSL style sheet, based upon the context params of area, concern, and action.
This is intended for use in Web application, not as a general purpose XSL transform.
Instantiates a new xslt view behaviour used to provide xslt templating primarily for web applications.
respondsTo
: The message the behaviour has set as responding to.
Defaults to caching compiled xslt, to a content type of "text/xml".
Instantiates a new xslt view behaviour used to provide xslt templating primarily for web applications.
respondsTo
: The message the behaviour has set as responding to.contentType
: The content type of the view step produced from this behaviour.
Defaults to caching compiled xslt.
Instantiates a new xslt view behaviour used to provide xslt templating primarily for web applications.
respondsTo
: The message the behaviour has set as responding to.contentType
: The content type of the view step produced from this behaviour.enableCache
: Specifies whether or not the xslt compilation should be cached.
Instantiates a new xslt view behaviour used to provide xslt templating primarily for web applications.
respondsTo
: The message the behaviour has set as responding to.enableCache
: Specifies whether or not the xslt compilation should be cached.
Defaults to a content type of "text/xml".
Takes the content of the last view-step and transforms it with the xslt with the location that best matches the path of the url.
ev
: The event that gave rise to this action.context
: The context within which this action is being performed.
A base handler for Conclave.
Process the current request with the provided WebContext
.
context
: TheWebContext
being used for the current request.
Extends the process context with web specific information about an individual request being processed.
The context object is threaded through the whole stack and provides a controled pattern and workflow of state, along with access to resources and services external to the application. Everything hangs off the context.
Provides access to the running web application to which this context belongs.
Gives access to the web response of this context.
Gives access to the web request for this context.
Gives access to the cache being used for this context.
Gives access to the IPrinciple
user object that represents the current user for this context.
Represent the structure of a url.
The default regex that is used to deconstruct urls.
Instantiates a new url-info object from the uri object provided.
uri
: The uri object to contrsut the url-info from.
Instantiates a new url-info object from the url string representation provided.
url
: The url to construct the url-info from.
Instantiates a new url-info object from the uri provided using the regex provided to deconstruct it.
uri
: The uri object to contrsut the url-info from.regex
: The regex to use in deconstructing the uri.
Instantiates a new url-info object from the url string representation provided, using the regex provided to deconstruct it.
url
: The url to construct the url-info from.regex
: The regex to use in deconstructing the uri.
Instantiates a url-info object as a copy of the url-info object provided.
info
: The url-info obect to create a copy from.
Processes the url with a deconstruction regex.
Instantiates a new url-info object that is a copy of the current instance.
returns:
The regular expression being used to break URLs down into their parts.
If a regular expression isn't provided via the contructor then the default Inversion.Web.UrlInfo.DefaultRegex is used.
The matches produced by matching the Inversion.Web.UrlInfo.Regex against the Inversion.Web.UrlInfo.Url .
The url being processed.
The protocol specified by the Inversion.Web.UrlInfo.Url
The domain specified by the Inversion.Web.UrlInfo.Url
The full path specified by the Inversion.Web.UrlInfo.Url
The application path specified by the Inversion.Web.UrlInfo.Url
The URL of the current application.
The file specified by the Inversion.Web.UrlInfo.Url
The extension specified by the Inversion.Web.UrlInfo.Url
The tail specified by the Inversion.Web.UrlInfo.Url
The query string specified by the Inversion.Web.UrlInfo.Url
A name / value dictionary as the propduct of parsing the Inversion.Web.UrlInfo.QueryString
Represents a running web application application.
Instantiates a new web application, defaulting to the base directory of the current app domain.
The base directory from which the application is running.
Extends the process context with web specific information about an individual request being processed.
The context object is threaded through the whole stack and provides a controled pattern and workflow of state, along with access to resources and services external to the application. Everything hangs off the context.
Instantiates a new context object purposed for Web applications.
underlyingContext
: The underlying http context to wrap.services
: The service container the context will use.
The underlying http context that is being wrapped by this web context.
Provides access to the running web application to which this context belongs.
Gives access to the web response of this context.
Gives access to the web request for this context.
Gives access to the cache being used for this context.
Gives access to the IPrinciple
user object that represents the current user for this context.
An exception that is thrown when an general error occurs within a web application that would correspond to a http status code.
Instantiates a new web exception with the message provided.
message
: The message to be output if the exception is unhandled.
Defaults the status code to 500.
Instantiates a new web exception with the status code and message provided.
status
: The status code that should be produced for this error if it is unhandled.message
: The message that should be produced for this error if it is unhandled.
The http status code that should be produced for this error if it is unhandled and recovered from.
Provides a wrapper for the underlying web request for application developers to use.
This wrapping is mindful of providing a common interface that can port to other platforms. Along with providing a point of extensibility and control.
Instantiates a new web request by wrapping the http request of the http context provided.
context
: The http context from which to obtain the http request to wrap.
Instantiates a new web request wrapping the http request provided.
request
: The underlying http request to wrap.
The underlying http request being wrapped.
Gives access to any files uploaded by the user agent as part of this request.
Gives access to a url-info object that provides info about the structure of the url of the request.
The http method of the request.
Returns true if the http method of this request is GET; otherwise returns false.
Returns true if the http method of this request is POST; otherwise returns false.
Provides access to the request parameters from both the querystring and those that are posted.
First params are read from the querystring and then those posted which will override any from the querystring.
Gives access to the payload if any of the request.
Gives access to any flags present in the querystring.
Any querystring parameter that is a single value rather that a key-value pair is regarded as a flag.
Gives access to the headers of the reuqest.
Gives access to the request cookies.
Provides a wrapper of the underlying http response for application developers to use.
This wrapping is mindful of providing a common interface that can port to other platforms. Along with providing a point of extensibility and control.
Instantiates a new web response by wrapping the http response of the http context provided.
context
: The http context from which to obtain the http response to wrap.
Instantiates a new web response wrapping the http response provided.
underlyingResponse
: The underlying http response to wrap.
Flushes the response steam and ends the response.
Writes the provided text to the response stream.
text
: The text to write to the response stream.
Writes the provided formatted text to the response stream.
text
: The text to write to the response stream.args
: The arguments to interpolate into the text.
Redirects the request to the provided url.
url
: The url to redirect to.
Redirects the request permanently to the provided url issuing a 301
in the response.
url
:
The underlying http response being wrapped.
The text writer used for writing to the response stream.
The response stream.
The status code of the response.
The status description of the response stream.
The content type of the response stream.
Access to the response cookies.