class RailPhase.App
The main class for RailPhase web applications.
Constructors
- App ()
Methods
- void AddUrlPattern (RailPhase.UrlPattern pattern)
Adds a new URL pattern.
When the App receives a request with a URL that matches the given pattern, the specified view will be called. Please note that there are overloads of this method with more convenient signatures, like AddUrlPattern .
- void AddUrlPattern (string pattern, RailPhase.View view)
Adds a new URL pattern.
When the App receives a request with a URL that matches the given pattern, the specified view will be called.
- void AddUrlPattern (string pattern, RailPhase.Templates.TemplateRenderer template, [string contentType])
Adds a new URL pattern that responds to requests with a template.
- void AddUrlPattern (string pattern, string templateFile, [string contentType])
Adds a new URL pattern that responds to requests with a template.
- RailPhase.RawHttpResponse HandleRequest (RailPhase.HttpRequest request)
Handles an incoming HTTP request. You usually do not need to call this.
When called, this method will go through the registered URL patterns and pass the request to the view of the pattern that matches first. If not URL pattern matches the URL of the request, a 404 page is returned.
- void ReceiveFcgiRequest (Object sender, FastCGI.Request fcgiRequest)
Handles an incoming FastCGI request. You usually do not need to call this.
- void Run ([int port])
Starts listening as a FastCGI client. This method never returns!
This method starts the FastCGI client and will respond to any requests that are received over FastCGI. Any URL patterns have to be registered before calling this, because this method never returns.
class RailPhase.HttpRequest
Represents an incoming HTTP request.
Constructors
- HttpRequest (FastCGI.Request fcgiRequest)
Creates a new request object.
Methods
- string GetParameterASCII (string name)
- string GetParameterUTF8 (string name)
Properties and Fields
- IDictionary<string, Byte[]> ServerParameters
A dictionary of all HTTP parameters included in the request
- Dictionary<string, string> GET
A dictionary of all GET parameters included in the request.
- string Uri
The URI of this request
- string Body
The HTTP body of the request.
- RailPhase.HttpMethod Method
The HTTP method of the request.
- FastCGI.Request FcgiRequest
The underlying FastCGI request. Contains some more detailed information.
enum RailPhase.HttpMethod
Specifies a Http Method.
Enum Values
- GET
- POST
- PUT
- DELETE
- UNKNOWN
class RailPhase.RawHttpResponse
Base class for HTTP responses. Use HttpResponse if you want to create a simple HTTP response.
Constructors
- RawHttpResponse ([string body])
Creates a new raw http response, without any headers pre-set.
Properties and Fields
- string Body
The raw body of the HTTP response, including all headers.
class RailPhase.HttpResponse
Extends RailPhase.RawHttpResponse
Represents a HTTP response.
If you need full control over the raw response content, use RawHttpResponse instead.
Constructors
- HttpResponse (string body, [string status], [string contentType], [string additionalHeaders])
Creates a HTTP response, with the most important headers already set.
If you need full control over the raw response content, use RawHttpResponse instead.
class RailPhase.UrlPattern
Represents a URL pattern, used by the App class to handle incoming requests.
Constructors
- UrlPattern (System.Text.RegularExpressions.Regex pattern, RailPhase.View view)
Creates a new URL pattern.
- UrlPattern (string pattern, RailPhase.View view)
Creates a new URL pattern.
Properties and Fields
- System.Text.RegularExpressions.Regex Pattern
The regular expression for the URL pattern.
- RailPhase.View View
The view that should be called for requests that match the pattern.
class RailPhase.Templates.TemplateParserException
Extends System.Exception
Represents a syntax error in a template.
Constructors
- TemplateParserException (string message)
class RailPhase.Templates.Template
Provides functions to work with templates.
Static Methods
- RailPhase.Templates.TemplateRenderer FromFile (string filename)
Loads a TemplateRenderer from a file.
- RailPhase.Templates.TemplateRenderer FromString (string text)
Loads a TemplateRenderer from a string.