From c243ae43f23be20ec3388ed30e8b7b806ad2a2a7 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 21 Jul 2009 06:47:29 +0000 Subject: * Updated C# WebServer to the latest available source download (r19869) and applied a few mods from the old version (now up on opensim-libs (VS 3.5 project). * Made various changes to BaseHttpServer to accommodate the new interfaces. * This version has been significantly re-architected and may fail in unusual and insidious ways. * Please pay attention to any errors you get and post a Mantis if you can reproduce an issue with the HTTPServer. I'm including the pdb and having the http server compiled in debug for a few weeks so that when an error occurs, it'll print the pertenant data. * Once again, this is the full C# WebServer, not the lite branch that is included in LibOMV (we need SSL!) --- bin/HttpServer_OpenSim.xml | 8168 ++++++++++++++++++-------------------------- 1 file changed, 3300 insertions(+), 4868 deletions(-) (limited to 'bin/HttpServer_OpenSim.xml') diff --git a/bin/HttpServer_OpenSim.xml b/bin/HttpServer_OpenSim.xml index 747f35d..22cc1c0 100644 --- a/bin/HttpServer_OpenSim.xml +++ b/bin/HttpServer_OpenSim.xml @@ -4,1814 +4,1686 @@ HttpServer_OpenSim - + - Cookies that should be set. + Interface for sessions - + - Adds a cookie in the collection. + Remove everything from the session - cookie to add - cookie is null - + - Copy a request cookie + Remove everything from the session - - When the cookie should expire + True if the session is cleared due to expiration - + - Gets a collection enumerator on the cookie list. + Session id - collection enumerator - + - Remove all cookies + Should + Name of the session variable + null if it's not set + If the object cant be serialized. - + - Returns an enumerator that iterates through the collection. + When the session was last accessed. + This property is touched by the http server each time the + session is requested. - - - A that can be used to iterate through the collection. - - 1 - + - Gets the count of cookies in the collection. + Number of session variables. - + - Gets the cookie of a given identifier (null if not existing). + Event triggered upon clearing the session - + - Generates C#/HTML from HAML code. + Arguments sent when a is cleared - HAML documentation: http://haml.hamptoncatlin.com/docs/rdoc/classes/Haml.html - + - A code generator is used to convert template code to something that we can - work with, as HTML or c# code. + Instantiates the arguments for the event - + True if the session is cleared due to expiration - + - Generate C# code from the template. + Returns true if the session is cleared due to expiration - A that the generated code will be written to. - If the template have not been parsed first. - If template is incorrect - + - Parse a file and convert into to our own template object code. + Delegate for when a IHttpSession is cleared - Path and filename to a template - If something is incorrect in the template. - - - - - + this is being cleared. + Arguments for the clearing - + - Parse a file and convert into to our own template object code. + Contains a listener that doesn't do anything with the connections. - A containing our template - If something is incorrect in the template. - + - Initializes a new instance of the class. + Listen for regular HTTP connections + IP Address to accept connections on + TCP Port to listen on, default HTTP port is 80. + Factory used to create es. + address is null. + Port must be a positive number. - + - Initializes a new instance of the class. + Initializes a new instance of the class. - The log writer. + IP Address to accept connections on + TCP Port to listen on, default HTTPS port is 443 + Factory used to create es. + Certificate to use - + - Check and validate indentation + Initializes a new instance of the class. - line to check - number of white spaces - number of indentations (2 white spaces = 1 intend, 1 tab = 1 intend) + IP Address to accept connections on + TCP Port to listen on, default HTTPS port is 443 + Factory used to create es. + Certificate to use + which HTTPS protocol to use, default is TLS. - + + Exception. + + - Check indentation + Will try to accept connections one more time. - fills line with intend info + If any exceptions is thrown. - + - check if current line is a multi line + Can be used to create filtering of new connections. - previous line - current line + Accepted socket + true if connection can be accepted; otherwise false. - + - Generate HTML code from the template. - Code is encapsulated in <% and <%= + Start listen for new connections - A that the generated code will be written to. - If the template have not been parsed first. - If template is incorrect + Number of connections that can stand in a queue to be accepted. + Listener have already been started. - + - Get the first word (letters and digits only) from the specified offset. + Stop the listener - - - + - + - Check indentation / node placement + Gives you a change to receive log entries for all internals of the HTTP library. + + You may not switch log writer after starting the listener. + - + - Parse a node - todo: improve doc + True if we should turn on trace logs. - - - - - + - PreParse goes through the text add handles indentation - and all multi line cases. + Catch exceptions not handled by the listener. - Reader containing the text + + Exceptions will be thrown during debug mode if this event is not used, + exceptions will be printed to console and suppressed during release mode. + - + - print the entire document + A request have been received from a . - + - Print line information to the console + The server encountered an unexpected condition which prevented it from fulfilling the request. - - + - Read next line from file + All HTTP based exceptions will derive this class. - true if line could be read; false if EOF. - + - Generates a string with spaces. + Create a new HttpException - number of spaces. - string of spaces. + http status code (sent in the response) + error description - + - Parse a file and convert into to our own template object code. + Create a new HttpException - Path and filename to a template - If something is incorrect in the template. - - - - - - + http status code (sent in the response) + error description + inner exception - + - Parse a file and convert into to our own template object code. + status code to use in the response. - A containing our template - If something is incorrect in the template. - + - Generate C# code from the template. + Initializes a new instance of the class. - A that the generated code will be written to. - If the template have not been parsed first. - If template is incorrect - + - Property to retrieve the root node for the latest parsed document + Initializes a new instance of the class. + error message. - + - Class to make dynamic binding of redirects. Instead of having to specify a number of similar redirect rules - a regular expression can be used to identify redirect urls and thier targets. + Initializes a new instance of the class. - - [a-z0-9]+)", "/users/${target}?find=true", RegexOptions.IgnoreCase) - ]]> - + error message. + inner exception. - + - redirects from one url to another. + Used to inform http server that - + - Rules are used to perform operations before a request is being handled. - Rules can be used to create routing etc. + Eventarguments used when an exception is thrown by a module + the exception - + - Process the incoming request. + Exception thrown in a module - incoming http request - outgoing http response - true if response should be sent to the browser directly (no other rules or modules will be processed). - - returning true means that no modules will get the request. Returning true is typically being done - for redirects. - - If request or response is null. - + - Initializes a new instance of the class. + Container to bind resource names to assemblies - Absolute path (no servername) - Absolute path (no servername) - - server.Add(new RedirectRule("/", "/user/index")); - - + - Initializes a new instance of the class. + Instantiates an instance of - Absolute path (no servername) - Absolute path (no servername) - true if request should be redirected, false if the request uri should be replaced. - - server.Add(new RedirectRule("/", "/user/index")); - + The dot seperated uri the resource maps to + The full resource name + The assembly the resource exists in - + - Process the incoming request. + Retrieves a stream to the resource - incoming http request - outgoing http response - true if response should be sent to the browser directly (no other rules or modules will be processed). - - returning true means that no modules will get the request. Returning true is typically being done - for redirects. - + Null if the resource couldn't be located somehow - + - string to match request url with. + Retrieves the assembly the resource resides in - Is compared to request.Uri.AbsolutePath - + - Where to redirect. + Retrieves the full name/path of the assembly - + - true if we should redirect. + Retrieves the extension of the resource - - false means that the rule will replace - the current request uri with the new one from this class. - - + + Returns the Uri without extension + + + Retrieves the full path name to the resource file + + - Initializes a new instance of the class. + - Expression to match url - Expression to generate url - - [a-zA-Z0-9]+)", "/user/${first}")); - Result of ie. /employee1 will then be /user/employee1 - ]]> - + + + - + + Represents a field in a multipart form + + - Initializes a new instance of the class. + Event arguments used when a new header have been parsed. - Expression to match url - Expression to generate url - Regular expression options to use, can be null - - [a-zA-Z0-9]+)", "/user/{first}", RegexOptions.IgnoreCase)); - Result of ie. /employee1 will then be /user/employee1 - ]]> - - + - Initializes a new instance of the class. + Initializes a new instance of the class. - Expression to match url - Expression to generate url - Regular expression options to apply - true if request should be redirected, false if the request uri should be replaced. - - [a-zA-Z0-9]+)", "/user/${first}", RegexOptions.None)); - Result of ie. /employee1 will then be /user/employee1 - ]]> - + Name of header. + Header value. - + - Process the incoming request. + Initializes a new instance of the class. - incoming http request - outgoing http response - true if response should be sent to the browser directly (no other rules or modules will be processed). - - returning true means that no modules will get the request. Returning true is typically being done - for redirects. - - If request or response is null - + - Interface used to load templates from different sources. + Gets or sets header name. - + - Load a template into a and return it. + Gets or sets header value. - Relative path (and filename) to template. - a if file was found; otherwise null. - + - Fetch all files from the resource that matches the specified arguments. + New implementation of the HTTP listener. - Where the file should reside. - Files to check - a list of files if found; or an empty array if no files are found. + + Use the Create methods to create a default listener. + - + - Check's whether a template should be reloaded or not. + Initializes a new instance of the class. - template information - true if template is OK; false if it do not exist or are old. + IP Address to accept connections on + TCP Port to listen on, default HTTP port is 80. + Factory used to create es. + address is null. + Port must be a positive number. - + - Returns whether or not the loader has an instance of the file requested + Initializes a new instance of the class. - The name of the template/file - True if the loader can provide the file + The address. + The port. + The factory. + The certificate. - + - Webhelper provides helpers for common tasks in HTML. + Initializes a new instance of the class. + The address. + The port. + The factory. + The certificate. + The protocol. - + - Used to let the website use different javascript libraries. - Default is + Creates a new instance with default factories. + Address that the listener should accept connections on. + Port that listener should accept connections on. + Created HTTP listener. - + - Creates a link that invokes through ajax. + Creates a new instance with default factories. - url to fetch - link title - - optional options in format "key, value, key, value". - Javascript options starts with ':'. - - a link tag - - WebHelper.AjaxRequest("/users/add/", "Add user", "method:", "post", "onclick", "validate('this');"); - + Address that the listener should accept connections on. + Port that listener should accept connections on. + Certificate to use + Created HTTP listener. - + - Builds a link that updates an element with the fetched ajax content. + Creates a new instance with default factories. - Url to fetch content from - link title - html element to update with the results of the ajax request. - optional options in format "key, value, key, value" - A link tag. + Address that the listener should accept connections on. + Port that listener should accept connections on. + Certificate to use + which HTTPS protocol to use, default is TLS. + Created HTTP listener. - + - A link that pop ups a Dialog (overlay div) + Can be used to create filtering of new connections. - url to contents of dialog - link title - name/value of html attributes. - A "a"-tag that popups a dialog when clicked - - WebHelper.DialogLink("/user/show/1", "show user", "onmouseover", "alert('booh!');"); - - - - - Create/Open a dialog box using ajax - - - - - + Accepted socket + + true if connection can be accepted; otherwise false. + - + - Close a javascript dialog window/div. + A client have been accepted, but not handled, by the listener. - javascript for closing a dialog. - - + - Create a <form> tag. + This decoder converts XML documents to form items. + Each element becomes a subitem in the form, and each attribute becomes an item. - name of form - action to invoke on submit - form should be posted as ajax - html code - WebHelper.FormStart("frmLogin", "/user/login", Request.IsAjax); + // xml: somethingdata + // result: + // form["hello"].Value = "something" + // form["hello"]["id"].Value = 1 + // form["hello"]["world]["id"].Value = 1 + // form["hello"]["world"].Value = "data" + + The original xml document is stored in form["__xml__"].Value. + - + - Create a link tag. + Interface for form content decoders. - url to go to - link title (text that is displayed) - html attributes, name, value, name, value - html code - - WebHelper.Link("/user/show/1", "Show user", "id", "showUser", "onclick", "return confirm('Are you shure?');"); - - + - Build a link + - url to go to. - title of link (displayed text) - extra html attributes. - a complete link + Stream containing the content + Content type (with any additional info like boundry). Content type is always supplied in lower case + Stream enconding + A http form, or null if content could not be parsed. + If contents in the stream is not valid input data. - + - Build a link + Checks if the decoder can handle the mime type - url to go to. - title of link (displayed text) - extra html attributes. - a complete link - more options + Content type (with any additional info like boundry). Content type is always supplied in lower case. + True if the decoder can parse the specified content type - + - Obsolete + - Obsolete - Obsolete - Obsolete - Obsolete - Obsolete - Obsolete + Stream containing the content + Content type (with any additional info like boundry). Content type is always supplied in lower case + Stream encoding + Note: contentType and encoding are not used? + A http form, or null if content could not be parsed. + - + - Obsolete + Recursive function that will go through an xml element and store it's content + to the form item. - Obsolete - Obsolete - Obsolete - Obsolete - Obsolete - Obsolete - Obsolete + (parent) Item in form that content should be added to. + Node that should be parsed. - + - Render errors into a UL with class "errors" + Checks if the decoder can handle the mime type - class used by UL-tag. - items to list - an unordered html list. + Content type (with any additional info like boundry). Content type is always supplied in lower case. + True if the decoder can parse the specified content type - + - Render errors into a UL with class "errors" + We dont want to let the server to die due to exceptions thrown in worker threads. + therefore we use this delegate to give you a change to handle uncaught exceptions. - class used by UL-tag. - items to list - an unordered html list. + Class that the exception was thrown in. + Exception + + Server will throw a InternalServerException in release version if you dont + handle this delegate. + - + - Render errors into a UL with class "errors" + Implements HTTP Digest authentication. It's more secure than Basic auth since password is + encrypted with a "key" from the server. - - + + Keep in mind that the password is encrypted with MD5. Use a combination of SSL and digest auth to be secure. + - + - Generates a list with html attributes. + Authentication modules are used to implement different + kind of HTTP authentication. - StringBuilder that the options should be added to. - attributes set by user. - attributes set by any of the helper classes. - + - Generates a list with html attributes. + Tag used for authentication. - StringBuilder that the options should be added to. - - + - Purpose of this class is to create a javascript toolkit independent javascript helper. + Initializes a new instance of the class. + Delegate used to provide information used during authentication. + Delegate used to determine if authentication is required (may be null). - + - Generates a list with JS options. + Initializes a new instance of the class. - StringBuilder that the options should be added to. - the javascript options. name, value pairs. each string value should be escaped by YOU! - true if we should start with a comma. + Delegate used to provide information used during authentication. - + - Removes any javascript parameters from an array of parameters + Create a response that can be sent in the WWW-Authenticate header. - The array of parameters to remove javascript params from - An array of html parameters + Realm that the user should authenticate in + Array with optional options. + A correct authentication request. + If realm is empty or null. - + - javascript action that should be added to the "onsubmit" event in the form tag. + An authentication response have been received from the web browser. + Check if it's correct - - All javascript option names should end with colon. - - - JSHelper.AjaxRequest("/user/show/1", "onsuccess:", "$('userInfo').update(result);"); - - + Contents from the Authorization header + Realm that should be authenticated + GET/POST/PUT/DELETE etc. + options to specific implementations + Authentication object that is stored for the request. A user class or something like that. + if is invalid + If any of the parameters is empty or null. - + - Requests a url through ajax + Used to invoke the authentication delegate that is used to lookup the user name/realm. - url to fetch - optional options in format "key, value, key, value", used in JS request object. - a link tag - All javascript option names should end with colon. - - - JSHelper.AjaxRequest("/user/show/1", "onsuccess:", "$('userInfo').update(result);"); - - + Realm (domain) that user want to authenticate in + User name + Password used for validation. Some implementations got password in clear text, they are then sent to client. + object that will be stored in the request to help you identify the user if authentication was successful. + true if authentication was successful - + - Ajax requests that updates an element with - the fetched content + Determines if authentication is required. - Url to fetch content from - element to update - optional options in format "key, value, key, value", used in JS updater object. - A link tag. - All javascript option names should end with colon. - - - JSHelper.AjaxUpdater("/user/show/1", "userInfo", "onsuccess:", "alert('Successful!');"); - - + HTTP request from browser + true if user should be authenticated. + throw from your delegate if no more attempts are allowed. + If no more attempts are allowed - + - A link that pop ups a Dialog (overlay div) + name used in HTTP request. - url to contents of dialog - link title - A "a"-tag that popups a dialog when clicked - name/value of html attributes - - WebHelper.DialogLink("/user/show/1", "show user", "onmouseover", "alert('booh!');"); - - + - Close a javascript dialog window/div. + Initializes a new instance of the class. - javascript for closing a dialog. - + Delegate used to provide information used during authentication. + Delegate used to determine if authentication is required (may be null). - + - Creates a new modal dialog window + Initializes a new instance of the class. - url to open in window. - window title (may not be supported by all js implementations) - - + Delegate used to provide information used during authentication. - + - Contains a connection to a browser/client. + Used by test classes to be able to use hardcoded values - + - Contains a connection to a browser/client. + An authentication response have been received from the web browser. + Check if it's correct + Contents from the Authorization header + Realm that should be authenticated + GET/POST/PUT/DELETE etc. + First option: true if username/password is correct but not cnonce + + Authentication object that is stored for the request. A user class or something like that. + + if authenticationHeader is invalid + If any of the paramters is empty or null. - + - Disconnect from client + Encrypts parameters into a Digest string - error to report in the delegate. + Realm that the user want to log into. + User logging in + Users password. + HTTP method. + Uri/domain that generated the login prompt. + Quality of Protection. + "Number used ONCE" + Hexadecimal request counter. + "Client Number used ONCE" + Digest encrypted string - + - Send a response. + - Either HttpHelper.HTTP10 or HttpHelper.HTTP11 - http status code - reason for the status code. - html body contents, can be null or empty. - If httpVersion is invalid. + Md5 hex encoded "userName:realm:password", without the quotes. + Md5 hex encoded "method:uri", without the quotes + Quality of Protection + "Number used ONCE" + Hexadecimal request counter. + Client number used once + - + - Send a response. + Create a response that can be sent in the WWW-Authenticate header. - Either HttpHelper.HTTP10 or HttpHelper.HTTP11 - http status code - reason for the status code. + Realm that the user should authenticate in + First options specifies if true if username/password is correct but not cnonce. + A correct auth request. + If realm is empty or null. - + - Send a response. + Decodes authorization header value - + header value + Encoding that the buffer is in + All headers and their values if successful; otherwise null + + NameValueCollection header = DigestAuthentication.Decode("response=\"6629fae49393a05397450978507c4ef1\",\r\nc=00001", Encoding.ASCII); + + Can handle lots of whitespaces and new lines without failing. - + - send a whole buffer + Gets the current nonce. - buffer to send - + - + - Send data using the stream + Gets the Md5 hash bin hex2. - Contains data to send - Start position in buffer - number of bytes to send - - + To be hashed. + - + - Using SSL or other encryption method. + determines if the nonce is valid or has expired. + + nonce value (check wikipedia for info) + true if the nonce has not expired. + + + + name used in http request. - + - Buffersize determines how large the HTTP header can be. + Gets or sets whether the token supplied in is a + HA1 generated string. - + - Initializes a new instance of the class. + Class that receives Requests from a . - true if the connection is secured (SSL/TLS) - client that connected. - delegate handling incoming requests. - delegate being called when a client disconnectes - Stream used for communication - If beginreceive fails - delegate used to write log entries - - - + - Initializes a new instance of the class. + Client have been disconnected. - true if the connection is secured (SSL/TLS) - delegate handling incoming requests. - client that connected - Stream used for communication - If beginreceive fails - - + Client that was disconnected. + Reason + - + - Disconnect from client + Invoked when a client context have received a new HTTP request - error to report in the delegate. + Client that received the request. + Request that was received. + - + - This method checks the request if a responde to 100-continue should be sent. + Delegate used to find a realm/domain. + + - 100 continue is a value in the Expect header. - It's used to let the webserver determine if a request can be handled. The client - waits for a reply before sending the body. + Realms are used during HTTP Authentication + + - + - Send a response. + A complete HTTP server, you need to add a module to it to be able to handle incoming requests. - Either HttpHelper.HTTP10 or HttpHelper.HTTP11 - http status code - reason for the status code. - html body contents, can be null or empty. - If httpVersion is invalid. + + + // this small example will add two web site modules, thus handling + // two different sites. In reality you should add Controller modules or something + // two the website modules to be able to handle different requests. + HttpServer server = new HttpServer(); + server.Add(new WebSiteModule("www.gauffin.com", "Gauffin Telecom AB")); + server.Add(new WebSiteModule("www.vapadi.se", "Remote PBX")); + + // start regular http + server.Start(IPAddress.Any, 80); + + // start https + server.Start(IPAddress.Any, 443, myCertificate); + + + + + - + - Send a response. + Initializes a new instance of the class. - Either HttpHelper.HTTP10 or HttpHelper.HTTP11 - http status code - reason for the status code. + Used to get all components used in the server.. - + - Send a response. + Initializes a new instance of the class. - - + - send a whole buffer + Initializes a new instance of the class. - buffer to send - + Form decoders are used to convert different types of posted data to the object types. + + - + - Send data using the stream + Initializes a new instance of the class. - Contains data to send - Start position in buffer - number of bytes to send - - + A session store is used to save and retrieve sessions + - + - Using SSL or other encryption method. + Initializes a new instance of the class. + The log writer. + - + - Client have been disconnected. + Initializes a new instance of the class. - Client that was disconnected. - Reason - + Form decoders are used to convert different types of posted data to the object types. + The log writer. + + + - + - Invoked when a client context have received a new HTTP request + Initializes a new instance of the class. - Client that received the request. - Request that was received. - + Form decoders are used to convert different types of posted data to the object types. + A session store is used to save and retrieve sessions + The log writer. + + + + - + - A controller module is a part of the ModelViewController design pattern. - It gives you a way to create user friendly URLs. + Adds the specified rule. - - The controller module uses the flyweight pattern which means that - the memory usage will continue to increase until the module have - enough objects in memory to serve all concurrent requests. The objects - are reused and will not be freed. - - - - ControllerModule module = new ControllerModule(); - module.Add(new UserController()); - module.Add(new SearchController()); - myWebsite.Add(module); - - + The rule. - + - A HttpModule can be used to serve urls. The module itself - decides if it should serve a url or not. In this way, you can - get a very flexible http app since you can let multiple modules - serve almost similiar urls. + Add a to the server. - - Throw UnauthorizedException if you are using a AuthenticationModule and want to prompt for username/password. - + mode to add - + - Method that process the url + Decodes the request body. - Information sent by the browser about the request - Information that is being sent back to the client. - Session used to - true if this module handled the request. + The request. + Failed to decode form data. - + - Set the log writer to use. + Generate a HTTP error page (that will be added to the response body). + response status code is also set. - logwriter to use. + Response that the page will be generated in. + . + response body contents. - + - Log something. + Generate a HTTP error page (that will be added to the response body). + response status code is also set. - importance of log message - message + Response that the page will be generated in. + exception. - + - If true specifies that the module doesn't consume the processing of a request so that subsequent modules - can continue processing afterwards. Default is false. + Realms are used by the s. + HTTP request + domain/realm. - + - The controller module uses the prototype design pattern - to be able to create new controller objects for requests - if the stack is empty. + Process an incoming request. - A prototype which will be cloned for each request - - If a controller with that name have been added already. + connection to client + request information + response that should be filled + session information - + - Method that process the incoming request. + Can be overloaded to implement stuff when a client have been connected. - Information sent by the browser about the request - Information that is being sent back to the client. - Session used to + + Default implementation does nothing. + + client that disconnected + disconnect reason - + - Get a prototype + Handle authentication - in lowercase, without "Controller" - The controller if found; otherwise null. - - - //fetches the class UserController - RequestController userController = controllerModule["user"]; - - + + + + true if request can be handled; false if not. + Invalid authorization header - + - Initializes a new instance of the class. + Will request authentication. - A controller used to handle certain URLs. Will be cloned for each parallel request. + + Sends respond to client, nothing else can be done with the response after this. + + + + - + - Retrieve a previously created controller (or a new one if none exist). + Received from a when a request have been parsed successfully. - + that received the request. + The request. - + - Add a controller + To be able to track request count. - + + - + - Prototype controller used for cloning. + Start the web server using regular HTTP. - The prototype. + IP Address to listen on, use IpAddress.Any to accept connections on all IP addresses/network cards. + Port to listen on. 80 can be a good idea =) + address is null. + Port must be a positive number. - + - Will contain helper functions for javascript. + Accept secure connections. + IP Address to listen on, use to accept connections on all IP Addresses / network cards. + Port to listen on. 80 can be a good idea =) + Certificate to use + address is null. + Port must be a positive number. - + - Requests a url through ajax + shut down the server and listeners - url to fetch. Url is NOT enclosed in quotes by the implementation. You need to do that yourself. - optional options in format "key, value, key, value", used in JS request object. All keys should end with colon. - a link tag - onclick attribute is used by this method. - - - // plain text - JSHelper.AjaxRequest("'/user/show/1'"); - - // ajax request using this.href - string link = "<a href=\"/user/call/1\" onclick=\"" + JSHelper.AjaxRequest("this.href") + "/<call user</a>"; - - - + - Ajax requests that updates an element with - the fetched content + write an entry to the log file - url to fetch. Url is NOT enclosed in quotes by the implementation. You need to do that yourself. - element to update - options in format "key, value, key, value". All keys should end with colon. - A link tag. - - - JSHelper.AjaxUpdater("'/user/show/1'", "user", "onsuccess:", "alert('hello');", "asynchronous:", "true"); - - + importance of the message + log message - + - Opens contents in a dialog window. + write an entry to the log file - url to contents of dialog - link title - name, value, name, value, all parameter names should end with colon. + object that wrote the message + importance of the message + log message - + - Close a javascript dialog window/div. + Server that is handling the current request. - javascript for closing a dialog. - + + Will be set as soon as a request arrives to the object. + - + - Delegate used by to populate select options. + Modules used for authentication. The module that is is added first is used as + the default authentication module. - current object (for instance a User). - Text that should be displayed in the value part of a <optiongt;-tag. - Text shown in the select list. - - // Class that is going to be used in a SELECT-tag. - public class User - { - private readonly string _realName; - private readonly int _id; - public User(int id, string realName) - { - _id = id; - _realName = realName; - } - public string RealName - { - get { return _realName; } - } - - public int Id - { - get { return _id; } - } - } - - // Using an inline delegate to generate the select list - public void UserInlineDelegate() - { - List<User> items = new List<User>(); - items.Add(new User(1, "adam")); - items.Add(new User(2, "bertial")); - items.Add(new User(3, "david")); - string htmlSelect = Select("users", "users", items, delegate(object o, out object id, out object value) - { - User user = (User)o; - id = user.Id; - value = user.RealName; - }, 2, true); - } - - // Using an method as delegate to generate the select list. - public void UseExternalDelegate() - { - List<User> items = new List<User>(); - items.Add(new User(1, "adam")); - items.Add(new User(2, "bertial")); - items.Add(new User(3, "david")); - string htmlSelect = Select("users", "users", items, UserOptions, 1, true); - } - - // delegate returning id and title - public static void UserOptions(object o, out object id, out object title) - { - User user = (User)o; - id = user.Id; - value = user.RealName; - } /// + Use the corresponding property + in the if you are using multiple websites. - + - Methods marked with BeforeFilter will be invoked before each request. + Form decoder providers are used to decode request body (which normally contains form data). - - BeforeFilters should take no arguments and return false - if controller method should not be invoked. - - - + - Initializes a new instance of the class. + Server name sent in HTTP responses. - BeforeFilters should take no arguments and return false - if controller method should not be invoked. + Do NOT include version in name, since it makes it + easier for hackers. - + - Initializes a new instance of the class. + Name of cookie where session id is stored. - Specify if the filter should be invoked among the first filters, in between or among the last. - - BeforeFilters should take no arguments and return false - if controller method should not be invoked. - - + - Filters position in before filter queue + Specified where logging should go. + + + - + - Determins when a before filter is executed. + Number of connections that can wait to be accepted by the server. - + Default is 10. - + - Filter will be invoked first (unless another filter is added after this one with the First position) + Gets or sets maximum number of allowed simultaneous requests. + + + This property is useful in busy systems. The HTTP server + will start queuing new requests if this limit is hit, instead + of trying to process all incoming requests directly. + + + The default number if allowed simultaneous requests are 10. + + - + - Invoke after all first filters, and before the last filters. + Gets or sets maximum number of requests queuing to be handled. + + + The WebServer will start turning requests away if response code + to indicate that the server + is too busy to be able to handle the request. + + - + - Filter will be invoked last (unless another filter is added after this one with the Last position) + Realms are used during HTTP authentication. + Default realm is same as server name. - + - The "basic" authentication scheme is based on the model that the - client must authenticate itself with a user-ID and a password for - each realm. The realm value should be considered an opaque string - which can only be compared for equality with other realms on that - server. The server will service the request only if it can validate - the user-ID and password for the protection space of the Request-URI. - There are no optional authentication parameters. + Let's to receive unhandled exceptions from the threads. + + Exceptions will be thrown during debug mode if this event is not used, + exceptions will be printed to console and suppressed during release mode. + - + - Authentication modules are used to implement different - kind of http authentication. + Webhelper provides helpers for common tasks in HTML. - + - Initializes a new instance of the class. + Used to let the website use different javascript libraries. + Default is - Delegate used to provide information used during authentication. - Delegate used to determine if authentication is required (may be null). - + - Initializes a new instance of the class. + Creates a link that invokes through ajax. - Delegate used to provide information used during authentication. + url to fetch + link title + + optional options in format "key, value, key, value". + Javascript options starts with ':'. + + a link tag + + WebHelper.AjaxRequest("/users/add/", "Add user", "method:", "post", "onclick", "validate('this');"); + - + - Create a response that can be sent in the WWW-Authenticate header. + Builds a link that updates an element with the fetched ajax content. - Realm that the user should authenticate in - Array with optional options. - A correct auth request. - If realm is empty or null. + Url to fetch content from + link title + html element to update with the results of the ajax request. + optional options in format "key, value, key, value" + A link tag. - + - An authentication response have been received from the web browser. - Check if it's correct + A link that pop ups a Dialog (overlay div) - Contents from the Authorization header - Realm that should be authenticated - GET/POST/PUT/DELETE etc. - options to specific implementations - Authentication object that is stored for the request. A user class or something like that. - if authenticationHeader is invalid - If any of the paramters is empty or null. + url to contents of dialog + link title + name/value of html attributes. + A "a"-tag that popups a dialog when clicked + + WebHelper.DialogLink("/user/show/1", "show user", "onmouseover", "alert('booh!');"); + - + - Used to invoke the auth delegate that is used to lookup the username/realm. + Create/Open a dialog box using ajax - Realm (domain) that user want to authenticate in - Username - Password used for validation. Some implementations got password in clear text, they are then sent to client. - object that will be stored in the request to help you identify the user if authentication was successful. - true if authentication was successful + + + + - + - Determines if authentication is required. + Close a javascript dialog window/div. - Http request from browser - true if user should be authenticated. - throw ForbiddenException from your delegate if no more attempts are allowed. - If no more attempts are allowed + javascript for closing a dialog. + - + - name used in http request. + Create a <form> tag. + name of form + action to invoke on submit + form should be posted as ajax + html code + + WebHelper.FormStart("frmLogin", "/user/login", Request.IsAjax); + - + - Initializes a new instance of the class. + Create a link tag. - Delegate used to provide information used during authentication. - Delegate used to determine if authentication is required (may be null). + url to go to + link title (text that is displayed) + html attributes, name, value, name, value + html code + + WebHelper.Link("/user/show/1", "Show user", "id", "showUser", "onclick", "return confirm('Are you shure?');"); + - + - Initializes a new instance of the class. + Build a link - Delegate used to provide information used during authentication. + url to go to. + title of link (displayed text) + extra html attributes. + a complete link - + - Create a response that can be sent in the WWW-Authenticate header. + Build a link - Realm that the user should authenticate in - Not used in basic auth - A correct auth request. + url to go to. + title of link (displayed text) + extra html attributes. + a complete link + more options - + - An authentication response have been received from the web browser. - Check if it's correct + Obsolete - Contents from the Authorization header - Realm that should be authenticated - GET/POST/PUT/DELETE etc. - Not used in basic auth - Authentication object that is stored for the request. A user class or something like that. - if authenticationHeader is invalid - If any of the paramters is empty or null. + Obsolete + Obsolete + Obsolete + Obsolete + Obsolete + Obsolete - + - name used in http request. + Obsolete + Obsolete + Obsolete + Obsolete + Obsolete + Obsolete + Obsolete + Obsolete - + - The follow node allows users to display code in a haml document + Render errors into a UL with class "errors" - - #main Welcome =user.FirstName - + class used by UL-tag. + items to list + an unordered html list. - + - Child nodes may not be the first node on a line + Render errors into a UL with class "errors" + class used by UL-tag. + items to list + an unordered html list. - + - A node represents a controller code and contents. For example a html tag, an attribute list or something else. + Render errors into a UL with class "errors" + + - + - Add a new node + Generates a list with html attributes. - parent node. + StringBuilder that the options should be added to. + attributes set by user. + attributes set by any of the helper classes. - + - Modifiers are used to modify the first node on the line. - Typical modifiers are attribute lists, class names and IDs. + Generates a list with html attributes. - Modifier node + StringBuilder that the options should be added to. + - + - Parse node contents add return a fresh node. + Purpose of this class is to create a javascript toolkit independent javascript helper. - List containing all node types - Node that this is a subnode to. Can be null - Line to parse - Where to start the parsing. Should be set to where the next node should start parsing. - A node corresponding to the bla bla; null if parsing failed. - - + - determines if this node can handle the line (by checking the first word); + Generates a list with JS options. - Controller char (word) - true if text belongs to this node type - First node on line, used since some nodes cannot exist on their own on a line. + StringBuilder that the options should be added to. + the javascript options. name, value pairs. each string value should be escaped by YOU! + true if we should start with a comma. - + - Generate HTML code (with ASP tags) + Removes any javascript parameters from an array of parameters - + The array of parameters to remove javascript params from + An array of html parameters - + - Converts the node to c# code + javascript action that should be added to the "onsubmit" event in the form tag. - true if we are inside the internal stringbuilder - c# code + + All javascript option names should end with colon. + + + JSHelper.AjaxRequest("/user/show/1", "onsuccess:", "$('userInfo').update(result);"); + + - + - Convert the node to c# code + Requests a url through ajax - True if we are inside the internal stringbuilder - true if all subnodes fit on one line - c# code + url to fetch + optional options in format "key, value, key, value", used in JS request object. + a link tag + All javascript option names should end with colon. + + + JSHelper.AjaxRequest("/user/show/1", "onsuccess:", "$('userInfo').update(result);"); + + - + - Generate C# code of the node + Ajax requests that updates an element with + the fetched content - true if we are inside the internal stringbuilder - code is small enough to fit on one row. - smallEnough is a default value, recalc it - c# code + Url to fetch content from + element to update + optional options in format "key, value, key, value", used in JS updater object. + A link tag. + All javascript option names should end with colon. + + + JSHelper.AjaxUpdater("/user/show/1", "userInfo", "onsuccess:", "alert('Successful!');"); + + - + - Get intendation level for this node. + A link that pop ups a Dialog (overlay div) - + url to contents of dialog + link title + A "a"-tag that popups a dialog when clicked + name/value of html attributes + + WebHelper.DialogLink("/user/show/1", "show user", "onmouseover", "alert('booh!');"); + - + - Returns true if the node is applicable after another node as text instead of being applied as a modifier + Close a javascript dialog window/div. + javascript for closing a dialog. + - + - Count our children and our childrens children and so on... + Creates a new modal dialog window + url to open in window. + window title (may not be supported by all js implementations) + + - + - All child nodes for this node. + PrototypeJS implementation of the javascript functions. - + - Should only be set for each parent. + Requests a url through ajax + url to fetch. Url is NOT enclosed in quotes by the implementation. You need to do that yourself. + optional options in format "key, value, key, value", used in JS request object. All keys should end with colon. + a link tag + onclick attribute is used by this method. + + + // plain text + JSHelper.AjaxRequest("'/user/show/1'"); + + // ajax request using this.href + string link = "<a href=\"/user/call/1\" onclick=\"" + JSHelper.AjaxRequest("this.href") + "/<call user</a>"; + + - + - Modifiers are used to modify the first node on the line. - Typical modifiers are attribute lists, class names and IDs. + Determins if a list of strings contains a specific value + options to check in + value to find + true if value was found + case insensitive - + - Last modifier for this node + Ajax requests that updates an element with + the fetched content - + URL to fetch. URL is NOT enclosed in quotes by the implementation. You need to do that yourself. + element to update + options in format "key, value, key, value". All keys should end with colon. + A link tag. + + + JSHelper.AjaxUpdater("'/user/show/1'", "user", "onsuccess:", "alert('hello');", "asynchronous:", "true"); + + - + - Number of modifiers for this line. + A link that pop ups a Dialog (overlay div) + URL to contents of dialog + link title + name, value, name, value + + A "a"-tag that popups a dialog when clicked + + Requires Control.Modal found here: http://livepipe.net/projects/control_modal/ + And the following JavaScript (load it in application.js): + + Event.observe(window, 'load', + function() { + document.getElementsByClassName('modal').each(function(link){ new Control.Modal(link); }); + } + ); + + + + WebHelper.DialogLink("/user/show/1", "show user", "onmouseover", "alert('booh!');"); + - + - Parent node. + create a modal dialog (usually using DIVs) + url to fetch + dialog title + javascript/html attributes. javascript options ends with colon ':'. + - + - Child nodes may not be the first node on a line + Close a javascript dialog window/div. - parent node + javascript for closing a dialog. + - + - Creates a DIV node and add's the specified node to it. + javascript action that should be added to the "onsubmit" event in the form tag. - Contains all prototypes for each control char. used to instanciate new nodes. - parent node - current line information - node to add to the DIV node - current node + remember to encapsulate strings in '' + + All javascript option names should end with colon. + + + JSHelper.AjaxRequest("/user/show/1", "onsuccess:", "$('userInfo').update(result);"); + + - + - Get endposition for this modifier. + Event driven parser used to parse incoming HTTP requests. - where to start searching - contents of the current line - char that tells us that this is the end position - index on the current line + + The parser supports partial messages and keeps the states between + each parsed buffer. It's therefore important that the parser gets + ed if a client disconnects. + - + - Get endposition for this modifier. + Parse partial or complete message. - where to start searching - contents of the current line - index on the current line + buffer containing incoming bytes + where in buffer that parsing should start + number of bytes to parse + Unparsed bytes left in buffer. + BadRequestException. - + - This is a plain text node + Clear parser state. - + - Contains C# code that will be rendered into the view. + Current state in parser. - Parent node - + - Parse node contents add return a fresh node. + A request have been successfully parsed. - List containing all node types - Node that this is a subnode to. Can be null - Line to parse - Where to start the parsing. Should be set to where the next node should start parsing. - A node corresponding to the bla bla; null if parsing failed. - - + - determines if this node can handle the line (by checking the first word); + More body bytes have been received. - Controller char (word) - true if text belongs to this node type - first node on line - + - Generate HTML for this node (with asp tags for code) + Request line have been received. - - + - = is placed at the end of a tag definition, after class, id, and attribute declarations. - It’s just a shortcut for inserting Ruby code into an element. It works the same as = without a tag: - it inserts the result of the Ruby code into the template. - However, if the result is short enough, it is displayed entirely on one line. + A header have been received. - True if we are inside the internal stringbuilder - true if all subnodes fit on one line - smallEnough is a default value, recalc it - c# code - + - Determines if this is a textnode (containg plain text) + Gets or sets the log writer. - + - Contains HTML attributes. + Current state in the parsing. - + - Create a new node + Should parse the request line - parent node - collection of attributes - + - create an attribute node + Searching for a complete header name - parent node - + - Get an attribute + Searching for colon after header name (ignoring white spaces) - name of the attribute (case sensitive) - attribute if found; otherwise null. - + - Parse node contents add return a fresh node. + Searching for start of header value (ignoring white spaces) - List containing all node types - Node that this is a subnode to. Can be null - Line to parse - Where to start the parsing. Should be set to where the next node should start parsing. - A node corresponding to the bla bla; null if parsing failed. - - + - determines if this node can handle the line (by checking the first word); + Searching for a complete header value (can span over multiple lines, as long as they are prefixed with one/more whitespaces) - Controller char (word) - true if text belongs to this node type - first node on line - + - Convert node to HTML (with ASP-tags) + Adding bytes to body - HTML string - + - Convert the node to c# code + Contains server side HTTP request information. - True if we are inside the internal stringbuilder - true if all subnodes fit on one line - smallEnough is a default value, recalc it - c# code - + - html attributes + Called during parsing of a . + Name of the header, should not be URL encoded + Value of the header, should not be URL encoded + If a header is incorrect. - + - A attribute + Add bytes to the body + buffer to read bytes from + where to start read + number of bytes to read + Number of bytes actually read (same as length unless we got all body bytes). + If body is not writable + bytes is null. + offset is out of range. - + - value is a simple word or quoted text + Clear everything in the request - + - Name of the attribute + Decode body into a form. + A list with form decoders. + If body contents is not valid for the chosen decoder. + If body is still being transferred. - + - Value, can be a statement, variable or quoted text. + Sets the cookies. + The cookies. - + - Arguments being used in a template. + Create a response object. - - + Context for the connected client. + A new . - + - Holds the arguments connected to their names for quick access. - (since the ArgumentContainer also holds the name for the argument the mapping with strings is somewhat redundant - but since the data do 'belong' to the ArgumentContainer this solution was chosen to speed up access) + Gets kind of types accepted by the client. - + - Initializes the class without any set arguments. + Gets or sets body stream. - + - Initializes the class with all the arguments of the parameter class. + Gets whether the body is complete. - Cannot be null - If arguments is null - + - Initializes the class with the objects in the parameterlist. - Note that each object that is null must be followed by a type. + Gets or sets kind of connection used for the session. - Should contain ordered pairs/truples of string, object and type where type is optional if the object isn´t null - new TemplateArguments("Dir", "\", "Users", null, typeof(User)); - If optional type differs from type of object (if object != null) or argument name is duplicate - If the order of objects is incorrect - If any argument name or type is null - + - A function that merges two argument holders updating and adding values + Gets or sets number of bytes in the body. - - If arguments is null - + - Clears added arguments + Gets cookies that was sent with the request. - + - Adds an argument. - (Will throw ArgumentException on duplicates since adding an argument twice points to incorrect code, for ways around - this + Gets form parameters. - Cannot be null - Cannot be null - If argumentName or argumentObject is null - If an argument named argumentName already exists - + - Adds an argument. Allows for argumentObject to be null - (Will throw ArgumentException + Gets headers sent by the client. - Cannot be null - - Cannot be null - If argumentName or argumentType is null - If an argument named argumentName already exists or argumentObject != null and typeof(argumentObject) differs from argumentType - + - Updates an already added argument + Gets or sets version of HTTP protocol that's used. - Cannot be null - Cannot be null - If no argument named argumentName exists - If argumentName or argumentObject is null + + Probably or . + + - + - Updates an already added argument, allows for argumentObject to be null + Gets whether the request was made by Ajax (Asynchronous JavaScript) - Cannot be null - - Cannot be null - If argumentName or argumentType is null - If an argument named argumentName doesn´t exists or argumentObject != null and typeof(argumentObject) differs from argumentType - + - Clears all added arguments + Gets or sets requested method. + + Will always be in upper case. + + - + - Retrieves the arguments - (Does so now by copying the values to a new array, could be optimized?) + Gets parameter from or . - An array containing arguments with name, object and type - + - Returns a individual hashcode built upon the specified types the class is holding + Gets variables sent in the query string - The hashcode is made by joining the typenames of all held arguments and making a string hashcode from them - - + - Retrieves a concated typename ie DictinaryInt32String + Gets or sets requested URI. - The type to retrieve the name for - + - Checks whether a specific argument is specified or not. + Gets URI absolute path divided into parts. - Argument name - true if argument is specified; otherwise false. + + // URI is: http://gauffin.com/code/tiny/ + Console.WriteLine(request.UriParts[0]); // result: code + Console.WriteLine(request.UriParts[1]); // result: tiny + + + If you're using controllers than the first part is controller name, + the second part is method name and the third part is Id property. + + - + - Function to make it possible to index out known arguments + Gets or sets path and query. - The name of an added argument - Null if no ArgumentContainer by name was found + + + Are only used during request parsing. Cannot be set after "Host" header have been + added. + - - - A container class grouping mapping name, argument type and the argument object - - - - - Contains the name mapped to the argument - - - - - Contains the type of the argument, this must be valid if _argumentObject is null - - - - - Holds the actual object - - - - - Constructor to initiate an ArgumentContainer, will set the ArgumentType to the value of the argumentObject's type - - Cannot be null - Cannot be null - If argumentName or argumentObject is null - - - - Alternative constructor allowing argumentObject parameter to be null - - Cannot be null - - Cannot be null - If argumentName or argumentType is null - If argumentObject != null and argumentType != typeof(argumentObject) - - - - Sets the object and type of the argument, equal to ArgumentContainer.Object = ... - - Cannot be null - If argumentObject is null - - - - Sets the argument object and type. Type of the object and argumentType must correspond. - - - Cannot be null - If argumentType is null - If typeof(argumentObject) differs from argumentType and object != null - - - - Attribute for retrieving the name. The name cannot be set however because an argument is defined by its name - changing the name would be changing the arguments meaning, thus an argument needing a name change should rather - be recreated - - - - - Returns the type of the argument object. The property cannot be set since the type depends on and must correspond to - the type of the object - - - - - Returns or changes the argument object. If the object is to be changed to null the type must be passed aswell, - in that case - - If set value is null - - - - A partial is a HAML template that is inserted into other HAML templates. - - - + - Contains the page/controller target for the partial. - The PartialNode should be written as follows: - ex. - - _"requestedpage"{parametername="parametervalue",parametername2=parameter2,parametername3=parameter3:typeof(parameter3type)} + Delegate used to let authentication modules authenticate the user name and password. + Realm that the user want to authenticate in + User name specified by client + Can either be user password or implementation specific token. + object that will be stored in a session variable called if authentication was successful. + throw forbidden exception if too many attempts have been made. + + + Use to specify that the token is a HA1 token. (MD5 generated + string from realm, user name and password); Md5String(userName + ":" + realm + ":" + password); + + - + - create a new partial node. + Let's you decide on a system level if authentication is required. - parent node + HTTP request from client + true if user should be authenticated. + throw if no more attempts are allowed. + If no more attempts are allowed - + - Determines if this node can handle the line (by checking the first word); + Serves files that are stored in embedded resources. - Controller char (word) - True if text belongs to this node type - First node on line. - + - Parse node contents add return a fresh node. + A HttpModule can be used to serve Uri's. The module itself + decides if it should serve a Uri or not. In this way, you can + get a very flexible http application since you can let multiple modules + serve almost similar urls. - Node that this is a subnode to. Can be null - A list with node types - Line to parse - Where to start the parsing. Will be set to where the next node should start parsing - A node corresponding to the bla bla; null if parsing failed. - + + Throw if you are using a and want to prompt for user name/password. + - + - Convert the node to c# code + Method that process the url - True if we are inside the internal stringbuilder - true if all subnodes fit on one line - smallEnough is a default value, recalc it - c# code + Information sent by the browser about the request + Information that is being sent back to the client. + Session used to + true if this module handled the request. - + - Convert node to HTML (with ASP-tags) + Set the log writer to use. - HTML string + logwriter to use. - + - Helper function to retrieve the code for the partial request + Log something. - A string representing the code for invocating a render of the partial + importance of log message + message - + - Throw an exception with predefined information + If true specifies that the module doesn't consume the processing of a request so that subsequent modules + can continue processing afterwards. Default is false. - why the exception was thrown - + - This is a plain text node + Initializes a new instance of the class. + Runs to make sure the basic mime types are available, they can be cleared later + through the use of if desired. - + - Returns the page/controller target for the node + Initializes a new instance of the class. + Runs to make sure the basic mime types are available, they can be cleared later + through the use of if desired. + The log writer to use when logging events - + - Loads templates from embedded resources. + Mimtypes that this class can handle per default - + - Loads templates from a namespace in the given assembly to an uri + Loads resources from a namespace in the given assembly to an uri The uri to map the resources to The assembly in which the resources reside @@ -1819,136 +1691,107 @@ resourceLoader.LoadResources("/user/", typeof(User).Assembly, "MyLib.Models.User.Views"); - will make ie the resource MyLib.Models.User.Views.list.Haml accessible via /user/list.haml or /user/list/ + will make ie the resource MyLib.Models.User.Views.stylesheet.css accessible via /user/stylesheet.css + The amount of loaded files, giving you the possibility of making sure the resources needed gets loaded - - - Load a template into a and return it. - - Relative path (and filename) to template. - - a if file was found; otherwise null. - - - - - Fetch all files from the resource that matches the specified arguments. - - Where the file should reside. - Files to check - - a list of files if found; or an empty array if no files are found. - - - - - Always returns true since a resource won't be updated during execution - - - - - - - Returns whether or not the loader has an instance of the file requested - - The name of the template/file - True if the loader can provide the file - - - - Priority for log entries - - - - + - Very detailed logs to be able to follow the flow of the program. + Returns true if the module can handle the request - + - Logs to help debug errors in the application + Method that process the url + Information sent by the browser about the request + Information that is being sent back to the client. + Session used to + true if this module handled the request. - + - Information to be able to keep track of state changes etc. + List with all mime-type that are allowed. + All other mime types will result in a Forbidden http status code. - + - Something did not go as we expected, but it's no problem. + The purpose of this module is to serve files. - + - Something that should not fail failed, but we can still keep - on going. + Initializes a new instance of the class. + Uri to serve, for instance "/files/" + Path on hard drive where we should start looking for files + If true a Last-Modifed header will be sent upon requests urging web browser to cache files - + - Something failed, and we cannot handle it properly. + Initializes a new instance of the class. + Uri to serve, for instance "/files/" + Path on hard drive where we should start looking for files - + - Interface used to write to log files. + Mimtypes that this class can handle per default - + - Write an entry to the log file. + Determines if the request should be handled by this module. + Invoked by the - object that is writing to the log - importance of the log message - the message + + true if this module should handle it. - - - This class writes to the console. It colors the output depending on the logprio and includes a 3-level stacktrace (in debug mode) - - + + Illegal path - + - The actual instance of this class. + check if source contains any of the chars. + + + - + - Logwriters the specified source. + Method that process the Uri. - object that wrote the logentry. - Importance of the log message - The message. + Information sent by the browser about the request + Information that is being sent back to the client. + Session used to + Failed to find file extension + File type is forbidden. - + - Get color for the specified logprio + return a file extension from an absolute Uri path (or plain filename) - prio for the log entry - A for the prio + + - + - Default log writer, writes everything to null (nowhere). + List with all mime-type that are allowed. - + All other mime types will result in a Forbidden http status code. - + - The logging instance. + characters that may not exist in a path. + + fileMod.ForbiddenChars = new string[]{ "\\", "..", ":" }; + - - - Writes everything to null - - object that wrote the logentry. - Importance of the log message - The message. + + Container for posted form data @@ -2010,22 +1853,24 @@ Add a new element. Form array elements are parsed - and added in a correct hierachy. + and added in a correct hierarchy. Name is converted to lower case. + name is null. + Cannot add stuff to . - Returns true if the class contains a HttpInput value with the corresponding name + Returns true if the class contains a with the corresponding name. - The field/querystring name + The field/query string name True if the value exists Parses an item and returns it. - This function is primarly used to parse array items as in user[name]. + This function is primarily used to parse array items as in user[name]. @@ -2087,3491 +1932,1858 @@ Get a form item. - Returns HttpInputItem.Empty if item was not found. - - - - Returns item either from a form or a query string (checks them in that order) - + Returns if item was not found. - - Representation of a non-initialized HttpParam + + Instance to help mark a non-initialized form - - Initialises the class to hold a value either from a post request or a querystring request + + Initializes a form container with the specified name - + - The add method is not availible for HttpParam - since HttpParam checks both Request.Form and Request.QueryString + Makes a deep copy of the input - name identifying the value - value to add - + The input to copy - + - Checks whether the form or querystring has the specified value + Adds a file to the collection of posted files - Name, case sensitive - true if found; otherwise false. + The file to add + If the file is already added + If file is null + If the instance is HttpForm.EmptyForm which cannot be modified - + - Returns an enumerator that iterates through the collection. + Checks if the form contains a specified file - - - A that can be used to iterate through the collection. - - 1 + Field name of the file parameter + True if the file exists + If the instance is HttpForm.EmptyForm which cannot be modified - + - Returns an enumerator that iterates through a collection. + Retrieves a file held by by the form - - - An object that can be used to iterate through the collection. - - 2 + The identifier of the file + The requested file or null if the file was not found + If name is null or empty + If the instance is HttpForm.EmptyForm which cannot be modified - + + Disposes all held HttpFile's and resets values + + - Fetch an item from the form or querystring (in that order). + Retrieves the number of files added to the - - Item if found; otherwise HttpInputItem.EmptyLanguageNode + 0 if no files are added - + - Container class for posted files + Small design by contract implementation. - + - Creates a container for a posted file + Check whether a parameter is empty. - The identifier of the post field - The file path - The content type of the file - The name of the file uploaded - If any parameter is null or empty + Parameter value + Parameter name, or error description. + value is empty. - + - Creates a container for a posted file + Checks whether a parameter is null. - If any parameter is null or empty - - - Destructor disposing the file + Parameter value + Parameter name, or error description. + value is null. - + - Deletes the temporary file + Checks whether a parameter is null. - True if manual dispose + + Parameter value + Parameter name, or error description. + value is null. - + - Disposing interface, cleans up managed resources (the temporary file) and suppresses finalization + The "basic" authentication scheme is based on the model that the + client must authenticate itself with a user-ID and a password for + each realm. The realm value should be considered an opaque string + which can only be compared for equality with other realms on that + server. The server will service the request only if it can validate + the user-ID and password for the protection space of the Request-URI. + There are no optional authentication parameters. - + - The name/id of the file + Initializes a new instance of the class. + Delegate used to provide information used during authentication. + Delegate used to determine if authentication is required (may be null). - + - The full file path + Initializes a new instance of the class. + Delegate used to provide information used during authentication. - + - The name of the uploaded file + Create a response that can be sent in the WWW-Authenticate header. + Realm that the user should authenticate in + Not used in basic auth + A correct auth request. - + - The type of file + An authentication response have been received from the web browser. + Check if it's correct + Contents from the Authorization header + Realm that should be authenticated + GET/POST/PUT/DELETE etc. + Not used in basic auth + Authentication object that is stored for the request. A user class or something like that. + if authenticationHeader is invalid + If any of the paramters is empty or null. - + - The object form class takes an object and creates form items for it. + name used in http request. - + - Initializes a new instance of the class. + Rules are used to perform operations before a request is being handled. + Rules can be used to create routing etc. - - form name *and* id. - action to do when form is posted. - - + - Initializes a new instance of the class. + Process the incoming request. - form name *and* id. - action to do when form is posted. - object to get values from + incoming HTTP request + outgoing HTTP response + true if response should be sent to the browser directly (no other rules or modules will be processed). + + returning true means that no modules will get the request. Returning true is typically being done + for redirects. + + If request or response is null. - + - Initializes a new instance of the class. + Delegate used by to populate select options. - form action. - object to get values from. + current object (for instance a User). + Text that should be displayed in the value part of a <optiongt;-tag. + Text shown in the select list. + + // Class that is going to be used in a SELECT-tag. + public class User + { + private readonly string _realName; + private readonly int _id; + public User(int id, string realName) + { + _id = id; + _realName = realName; + } + public string RealName + { + get { return _realName; } + } + + public int Id + { + get { return _id; } + } + } + + // Using an inline delegate to generate the select list + public void UserInlineDelegate() + { + List<User> items = new List<User>(); + items.Add(new User(1, "adam")); + items.Add(new User(2, "bertial")); + items.Add(new User(3, "david")); + string htmlSelect = Select("users", "users", items, delegate(object o, out object id, out object value) + { + User user = (User)o; + id = user.Id; + value = user.RealName; + }, 2, true); + } + + // Using an method as delegate to generate the select list. + public void UseExternalDelegate() + { + List<User> items = new List<User>(); + items.Add(new User(1, "adam")); + items.Add(new User(2, "bertial")); + items.Add(new User(3, "david")); + string htmlSelect = Select("users", "users", items, UserOptions, 1, true); + } + + // delegate returning id and title + public static void UserOptions(object o, out object id, out object title) + { + User user = (User)o; + id = user.Id; + value = user.RealName; + } /// - + - write out the FORM-tag. + This class is created as a wrapper, since there are two different cookie types in .Net (Cookie and HttpCookie). + The framework might switch class in the future and we dont want to have to replace all instances - generated html code - + - Writeout the form tag + Let's copy all the cookies. - form should be posted through ajax. - generated html code + value from cookie header. - + - Generates a text box. + Adds a cookie in the collection. - - - generated html code + cookie to add + cookie is null - + - password box + Gets a collection enumerator on the cookie list. - - - generated html code + collection enumerator - + - Hiddens the specified property name. + Remove all cookies. - Name of the property. - The options. - generated html code - + - Labels the specified property name. + Returns an enumerator that iterates through the collection. - property in object. - caption - generated html code + + + A that can be used to iterate through the collection. + + 1 - + - Generate a checkbox + Remove a cookie from the collection. - property in object - checkbox value - additional html attributes. - generated html code + Name of cookie. - + - Write a html select tag + Gets the count of cookies in the collection. - object property. - id column - The title column. - The options. - - + - Selects the specified property name. + Gets the cookie of a given identifier (null if not existing). - Name of the property. - The items. - The id column. - The title column. - The options. - - + - Write a submit tag. + The request could not be understood by the server due to malformed syntax. + The client SHOULD NOT repeat the request without modifications. + + Text taken from: http://www.submissionchamber.com/help-guides/error-codes.php - button caption - html submit tag - + - html end form tag + Create a new bad request exception. - html + reason to why the request was bad. - + - This provider is used to let us implement any type of form decoding we want without - having to rewrite anything else in the server. + Create a new bad request exception. + reason to why the request was bad. + inner exception - - - - - Should contain boundary and type, as in: multipart/form-data; boundary=---------------------------230051238959 - Stream containg form data. - Encoding used when decoding the stream - HttpInput.EmptyLanguageNode if no parser was found. Must always return something (HttpInput.Empty instead of null) - If stream is null or not readable. - If stream contents cannot be decoded properly. - - - - Add a decoder. - - - - - + - Number of added decoders. + A session store is used to store and load sessions on a media. + The default implementation () saves/retrieves sessions from memory. - + - Use with care. + Creates a new http session with a generated id. + A object - + - Decoder used for unknown content types. + Creates a new http session with a specific id + Id used to identify the new cookie.. + A object. + + Id should be generated by the store implementation if it's null or . + - + - Contains an (html) attribute list. + Load an existing session. + Session id (usually retrieved from a client side cookie). + A session if found; otherwise null. - + - Rules are used during preparse + Save an updated session to the store. + Session id (usually retrieved from a client side cookie). + If Id property have not been specified. - + - Determines if this node spans over multiple lines. + We use the flyweight pattern which reuses small objects + instead of creating new each time. - contains line information (and text) - true if rule have previously inited a multiline. - true if this line continues onto the next./// + Unused session that should be reused next time Create is called. - + - Determines if this node spans over multiple lines. + Remove expired sessions - contains line information (and text) - true if the previous line was continued. - true if this line continues onto the next. - + - A text only node. + Remove a session + id of the session. - + - + Load a session from the store - parent node - plain text + + null if session is not found. - + - Parse node contents add return a fresh node. + Number of minutes before a session expires. - List containing all node types - Node that this is a subnode to. Can be null - Line to parse - Where to start the parsing. Should be set to where the next node should start parsing. - A node corresponding to the bla bla; null if parsing failed. - + Default time is 20 minutes. - + - determines if this node can handle the line (by checking the first word); + Contains a connection to a browser/client. - Controller char (word) - true if text belongs to this node type - true if this is the first node on the line. - + - Generate HTML for this node. + Disconnect from client - + error to report in the event. - + - Convert the node to c# code + Send a response. - True if we are inside the internal stringbuilder - true if all subnodes fit on one line - todo: add description - c# code + Either or + HTTP status code + reason for the status code. + HTML body contents, can be null or empty. + A content type to return the body as, i.e. 'text/html' or 'text/plain', defaults to 'text/html' if null or empty + If is invalid. - + - The text. + Send a response. + Either or + HTTP status code + reason for the status code. - + - Is this a text node (containing plain text)? + Send a response. + - + - Serves files that are stored in embedded resources. + send a whole buffer + buffer to send + - + - Initializes a new instance of the class. - Runs to make sure the basic mime types are available, they can be cleared later - through the use of if desired. + Send data using the stream + Contains data to send + Start position in buffer + number of bytes to send + + - + - Mimtypes that this class can handle per default + Using SSL or other encryption method. - + - Loads resources from a namespace in the given assembly to an uri + Using SSL or other encryption method. - The uri to map the resources to - The assembly in which the resources reside - The namespace from which to load the resources - - resourceLoader.LoadResources("/user/", typeof(User).Assembly, "MyLib.Models.User.Views"); - - will make ie the resource MyLib.Models.User.Views.stylesheet.css accessible via /user/stylesheet.css - - + - Returns true if the module can handle the request + The context have been disconnected. + + Event can be used to clean up a context, or to reuse it. + - + - Method that process the url + A request have been received in the context. - Information sent by the browser about the request - Information that is being sent back to the client. - Session used to - true if this module handled the request. - + - List with all mime-type that are allowed. + A have been disconnected. - All other mime types will result in a Forbidden http status code. - + - This decoder converts XML documents to form items. - Each element becomes a subitem in the form, and each attribute becomes an item. + Initializes a new instance of the class. - - // xml: somethingdata - // result: - // form["hello"].Value = "something" - // form["hello"]["id"].Value = 1 - // form["hello"]["world]["id"].Value = 1 - // form["hello"]["world"].Value = "data" - - - The original xml document is stored in form["__xml__"].Value. - + Reason to disconnection. - + - Interface for form content decoders. + Gets reason to why client disconnected. - + - Stream containing the content - Content type (with any additional info like boundry). Content type is always supplied in lower case - Stream enconding - A http form, or null if content could not be parsed. - If contents in the stream is not valid input data. - + - Checks if the decoder can handle the mime type + Initializes a new instance of the class. - Content type (with any additional info like boundry). Content type is always supplied in lower case. - True if the decoder can parse the specified content type + The request. - + - + Gets received request. - Stream containing the content - Content type (with any additional info like boundry). Content type is always supplied in lower case - Stream encoding - Note: contentType and encoding are not used? - A http form, or null if content could not be parsed. - - + - Recursive function that will go through an xml element and store it's content - to the form item. + cookie being sent back to the browser. - (parent) Item in form that content should be added to. - Node that should be parsed. + - + - Checks if the decoder can handle the mime type + cookie sent by the client/browser - Content type (with any additional info like boundry). Content type is always supplied in lower case. - True if the decoder can parse the specified content type + - + - This attribute can be used to map a controller to a specific url without using - the class name. + Constructor. + cookie identifier + cookie content + id or content is null + id is empty - + - Maps a controller to a url without using the controller name. + Gets the cookie HTML representation. - - Per default the class name is used to determine which url to handle. - For instance, "class UserController" or "class User" tells the framework that - the urls that starts with "/user" should be handled by that controller. - This attribute can be used to circumvent that. - - The name. + cookie string - + - The name that the controller should use + Gets the cookie identifier. - + - A session store is used to store and load sessions on a media. - The default implementation () saves/retrieves sessions from memory. + Cookie value. Set to null to remove cookie. - + - Creates a new http session with a generated id. + Constructor. - A object + cookie identifier + cookie content + cookie expiration date. Use DateTime.MinValue for session cookie. + id or content is null + id is empty - + - Creates a new http session with a specific id + Create a new cookie - Id used to identify the new cookie.. - A object. - - Id should be generated by the store implementation if it's null or . - + name identifying the cookie + cookie value + when the cookie expires. Setting DateTime.MinValue will delete the cookie when the session is closed. + Path to where the cookie is valid + Domain that the cookie is valid for. - + - Load an existing session. + Create a new cookie - Session id (usually retrieved from a client side cookie). - A session if found; otherwise null. + Name and value will be used + when the cookie expires. - + - Save an updated session to the store. + Gets the cookie HTML representation. - Session id (usually retrieved from a client side cookie). - If Id property have not been specified. + cookie string - + - We use the flyweight pattern which reuses small objects - instead of creating new each time. + When the cookie expires. + DateTime.MinValue means that the cookie expires when the session do so. - Unused session that should be reused next time Create is called. - + - Remove expired sessions + Cookie is only valid under this path. - + - Remove a session + Contains all HTTP Methods (according to the HTTP 1.1 specification) + + See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html + - id of the session. - + - Load a session from the store + The DELETE method requests that the origin server delete the resource identified by the Request-URI. - - null if session is not found. - - - - Number of minutes before a session expires. - - Default time is 20 minutes. - - - - HTTP Listener waits for HTTP connections and provide us with s using the - delegate. - - - - - Listen for regular HTTP connections - - IP Address to accept connections on - TCP Port to listen on, default HTTP port is 80. - - - - Launch HttpListener in SSL mode - - IP Address to accept connections on - TCP Port to listen on, default HTTPS port is 443 - Certificate to use - - - - Launch HttpListener in SSL mode - - IP Address to accept connections on - TCP Port to listen on, default HTTPS port is 443 - Certificate to use - which HTTPS protocol to use, default is TLS. + + + This method MAY be overridden by human intervention (or other means) on the origin server. + The client cannot be guaranteed that the operation has been carried out, even if the status code + returned from the origin server indicates that the action has been completed successfully. + + + However, the server SHOULD NOT indicate success unless, at the time the response is given, + it intends to delete the resource or move it to an inaccessible location. + + + A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, + 202 (Accepted) if the action has not yet been enacted, + or 204 (No Content) if the action has been enacted but the response does not include an entity. + + + If the request passes through a cache and the Request-URI identifies one or more currently cached entities, + those entries SHOULD be treated as stale. Responses to this method are not cacheable. + + - + - Start listen for new connections + The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. - Number of connections that can stand in a queue to be accepted. + + + If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the + entity in the response and not the source text of the process, unless that text happens to be the output of the process. + + + The semantics of the GET method change to a "conditional GET" if the request message includes an + If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, or If-Range header field. + A conditional GET method requests that the entity be transferred only under the circumstances described + by the conditional header field(s). The conditional GET method is intended to reduce unnecessary network + usage by allowing cached entities to be refreshed without requiring multiple requests or transferring + data already held by the client. + + - + - Stop the listener + The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. - + + The meta information contained in the HTTP headers in response to a HEAD request SHOULD be identical to the + information sent in response to a GET request. This method can be used for obtaining meta information about + the entity implied by the request without transferring the entity-body itself. + + This method is often used for testing hypertext links for validity, accessibility, and recent modification. + - + - A client have been accepted, but not handled, by the listener. + The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. + + This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval. + - + - Invoked when a client disconnects + The POST method is used to request that the origin server accept the entity enclosed + in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. + + POST is designed to allow a uniform method to cover the following functions: + + + Annotation of existing resources; + + Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles; + + Providing a block of data, such as the result of submitting a form, to a data-handling process; + + Extending a database through an append operation. + + + + If a resource has been created on the origin server, the response SHOULD be 201 (Created) and + contain an entity which describes the status of the request and refers to the new resource, and a + Location header (see section 14.30). + + + The action performed by the POST method might not result in a resource that can be identified by a URI. + In this case, either 200 (OK) or 204 (No Content) is the appropriate response status, depending on + whether or not the response includes an entity that describes the result. + + Responses to this method are not cacheable, unless the response includes appropriate Cache-Control + or Expires header fields. However, the 303 (See Other) response can be used to direct the user agent + to retrieve a cacheable resource. + + - + - Gives you a change to receive log entries for all internals of the HTTP library. + The PUT method requests that the enclosed entity be stored under the supplied Request-URI. - You may not switch log writer after starting the listener. + + + If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a + modified version of the one residing on the origin server. + + If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new + resource by the requesting user agent, the origin server can create the resource with that URI. + + If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. + + If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to + indicate successful completion of the request. + + If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be + given that reflects the nature of the problem. + + + + The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not + understand or implement and MUST return a 501 (Not Implemented) response in such cases. + - + - This handler will be invoked each time a new connection is accepted. + The TRACE method is used to invoke a remote, application-layer loop- back of the request message. - + - True if we should turn on trace logs. + Contains all HTTP Methods (according to the HTTP 1.1 specification) + + See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html + - + - Let's to receive unhandled exceptions from the threads. + The DELETE method requests that the origin server delete the resource identified by the Request-URI. - Exceptions will be thrown during debug mode if this event is not used, - exceptions will be printed to console and suppressed during release mode. + + This method MAY be overridden by human intervention (or other means) on the origin server. + The client cannot be guaranteed that the operation has been carried out, even if the status code + returned from the origin server indicates that the action has been completed successfully. + + + However, the server SHOULD NOT indicate success unless, at the time the response is given, + it intends to delete the resource or move it to an inaccessible location. + + + A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, + 202 (Accepted) if the action has not yet been enacted, + or 204 (No Content) if the action has been enacted but the response does not include an entity. + + + If the request passes through a cache and the Request-URI identifies one or more currently cached entities, + those entries SHOULD be treated as stale. Responses to this method are not cacheable. + - + - PrototypeJS implementation of the javascript functions. + The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. + + + If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the + entity in the response and not the source text of the process, unless that text happens to be the output of the process. + + + The semantics of the GET method change to a "conditional GET" if the request message includes an + If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, or If-Range header field. + A conditional GET method requests that the entity be transferred only under the circumstances described + by the conditional header field(s). The conditional GET method is intended to reduce unnecessary network + usage by allowing cached entities to be refreshed without requiring multiple requests or transferring + data already held by the client. + + - + - Requests a url through ajax + The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. - url to fetch. Url is NOT enclosed in quotes by the implementation. You need to do that yourself. - optional options in format "key, value, key, value", used in JS request object. All keys should end with colon. - a link tag - onclick attribute is used by this method. - - - // plain text - JSHelper.AjaxRequest("'/user/show/1'"); + + The meta information contained in the HTTP headers in response to a HEAD request SHOULD be identical to the + information sent in response to a GET request. This method can be used for obtaining meta information about + the entity implied by the request without transferring the entity-body itself. - // ajax request using this.href - string link = "<a href=\"/user/call/1\" onclick=\"" + JSHelper.AjaxRequest("this.href") + "/<call user</a>"; - - - - - - Determins if a list of strings contains a specific value - - options to check in - value to find - true if value was found - case insensitive - - - - Ajax requests that updates an element with - the fetched content - - url to fetch. Url is NOT enclosed in quotes by the implementation. You need to do that yourself. - element to update - options in format "key, value, key, value". All keys should end with colon. - A link tag. - - - JSHelper.AjaxUpdater("'/user/show/1'", "user", "onsuccess:", "alert('hello');", "asynchronous:", "true"); - - + This method is often used for testing hypertext links for validity, accessibility, and recent modification. + - + - A link that pop ups a Dialog (overlay div) + The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. - url to contents of dialog - link title - name, value, name, value - - A "a"-tag that popups a dialog when clicked - - Requires Control.Modal found here: http://livepipe.net/projects/control_modal/ - And the following javascript (load it in application.js): - - Event.observe(window, 'load', - function() { - document.getElementsByClassName('modal').each(function(link){ new Control.Modal(link); }); - } - ); - + + This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval. - - WebHelper.DialogLink("/user/show/1", "show user", "onmouseover", "alert('booh!');"); - - + - create a modal dialog (usually using DIVs) + The POST method is used to request that the origin server accept the entity enclosed + in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. - url to fetch - dialog title - javascript/html attributes. javascript options ends with colon ':'. - - - - - Close a javascript dialog window/div. - - javascript for closing a dialog. - - - - - javascript action that should be added to the "onsubmit" event in the form tag. - - remember to encapsulate strings in '' - - All javascript option names should end with colon. - - - JSHelper.AjaxRequest("/user/show/1", "onsuccess:", "$('userInfo').update(result);"); - - - - - - The requested resource was not found in the web server. - - - - - All HTTP based exceptions will derive this class. - - - - - Create a new HttpException - - http status code (sent in the response) - error description - - - - Create a new HttpException - - http status code (sent in the response) - error description - inner exception - - - - status code to use in the response. - - - - - Create a new exception - - message describing the error - inner exception - - - - Create a new exception - - message describing the error - - - - A controller in the Model-View-Controller pattern. - Derive this class and add method with one of the following signatures: - "public string MethodName()" or "public void MyMethod()". - - The first should return a string with the response, the latter - should use SendHeader and SendBody methods to handle the response. - - - Last segment of the path is always broken into the properties Id and RequestedType - Alhtough note that the RequestedType can also be empty if no file extension have - been specified. A typical use of file extensions in controllers is to specify which type of - format to return. - - - public class MyController : RequestController - { - public string Hello() - { - if (RequestedType == "xml") - return "<hello>World<hello>"; - else - return "Hello " + Request.QueryString["user"].Value + ", welcome to my world"; - } - - public void File() - { - Response.Headers.ContentType = "text/xml"; - Response.SendHeader(); - } - } - - - - - - - - create a new request controller - - prototype to copy information from - - - - create a new controller - - - - - Method that determines if an url should be handled or not by the module - - Url requested by the client. - true if module should handle the url. - - - - Determines which method to use. - - Requested resource - - - - Call all before filters - - true if a before filter wants to abort the processing. - - - - Override this method to be able to process result - returned by controller method. - - - - - Override this method if you want to be able to - handle unhanded exceptions - - thrown exception - Don't "eat" exceptions derived from HttpException since - they are handled by the framework,unless your are sure of what you are - doing.. - - - - This method goes through all methods in the controller and - add's them to a dictionary. They are later used to invoke - the correct method depending on the url - - - - - Method that process the url - - Uses Uri and QueryString to determine method. - Relays response object to invoked method. - Relays session object to invoked method. - - - - Will assign all variables that are unique for each session - - - - - - - - Make a clone of this controller - - a new controller with the same base information as this one. - - - - object that was attached during http authentication process. - - - You can also assign this tag yourself if you are using regular - http page login. - - - - - - Name of this controller (class name without the "Controller" part) - - - - - Specifies the method to use if no action have been specified. - - If specified method do not exist. - - - - Id is the third part of the uri path. - - - Is extracted as in: /controllername/methodname/id/ - - string.Empty if not specified. - - - - - - Method currently being invoked. - Always in lower case. - - - - - Request information (like Url, form, querystring etc) - - - - - Extension if a filename was specified. - - - - - Response information (that is going to be sent back to the browser/client) - - - - - Session information, is stored between requests as long as the session cookie is valid. - - - - - Marks methods to let framework know that the method is protected - - - - - - - Initializes a new instance of the class. - - - - - - - - Level is a value defined by you. It should be used to determine the users - that can access the method tagged with the AuthRequired attribute. - - - = level; - } - } - ]]> - - - - - Level is a value defined by you. It should be used to determine the users - that can access the method tagged with the AuthRequired attribute. - - - - - A session stored in memory. - - - - - Interface for sessions - - - - - Remove everything from the session - - - - - Remove everything from the session - - True if the session is cleared due to expiration - - - - Session id - - - - - Should - - Name of the session variable - null if it's not set - If the object cant be serialized. - - - - When the session was last accessed. - This property is touched by the http server each time the - session is requested. - - - - - Number of session variables. - - - - - Event triggered upon clearing the session - - - - - - - A unique id used by the sessions store to identify the session - - - - Id - - - - - - Remove everything from the session - - - - - Clears the specified expire. - - True if the session is cleared due to expiration - - - - Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - - 2 - - - - Session id - - - - - Should - - Name of the session variable - null if it's not set - - - - when the session was last accessed. - - - Used to determine when the session should be removed. - - - - - Number of values in the session - - - - - Flag to indicate that the session have been changed - and should be saved into the session store. - - - - - Event triggered upon clearing the session - - - - - IRule that says that something :) - - - - - Determines if this node spans over multiple lines. - - contains line information (and text) - true if the previous line was continued. - true if this line continues onto the next. - - - - Represents a HTML tag. - - - - - Create a new HTML tag node. - - parent node - - - - determines if this node can handle the line (by checking the first word); - - Controller char (word) - true if text belongs to this node type - first node on line. - - - - Parse node contents add return a fresh node. - - Node that this is a subnode to. Can be null - A list with node types - Line to parse - Where to start the parsing. Will be set to where the next node should start parsing - A node corresponding to the bla bla; null if parsing failed. - - - - - Convert the node to c# code - - True if we are inside the internal stringbuilder - true if all subnodes fit on one line - smallEnough is a default value, recalc it - c# code - - - - Convert node to HTML (with ASP-tags) - - HTML string - - - - This is a plain text node - - - - - tag name - - - - - Thrown when a template cannot be compiled. - - - - - Initializes a new instance of the class. - - Template that failed compilation. - Exception thrown by the compiler. - - - - Creates and returns a string representation of the current exception. - - - A string representation of the current exception. - - - - - - - - Gets a message that describes the current exception. - - - - The error message that explains the reason for the exception, or an empty string(""). - - - - - Contains all HTTP Methods (according to the HTTP 1.1 specification) - - See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html - - - - - - The DELETE method requests that the origin server delete the resource identified by the Request-URI. - - - - This method MAY be overridden by human intervention (or other means) on the origin server. - The client cannot be guaranteed that the operation has been carried out, even if the status code - returned from the origin server indicates that the action has been completed successfully. - - - However, the server SHOULD NOT indicate success unless, at the time the response is given, - it intends to delete the resource or move it to an inaccessible location. - - - A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, - 202 (Accepted) if the action has not yet been enacted, - or 204 (No Content) if the action has been enacted but the response does not include an entity. - - - If the request passes through a cache and the Request-URI identifies one or more currently cached entities, - those entries SHOULD be treated as stale. Responses to this method are not cacheable. - - - - - - The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. - - - - If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the - entity in the response and not the source text of the process, unless that text happens to be the output of the process. - - - The semantics of the GET method change to a "conditional GET" if the request message includes an - If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, or If-Range header field. - A conditional GET method requests that the entity be transferred only under the circumstances described - by the conditional header field(s). The conditional GET method is intended to reduce unnecessary network - usage by allowing cached entities to be refreshed without requiring multiple requests or transferring - data already held by the client. - - - - - - The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. - - - The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the - information sent in response to a GET request. This method can be used for obtaining metainformation about - the entity implied by the request without transferring the entity-body itself. - - This method is often used for testing hypertext links for validity, accessibility, and recent modification. - - - - - The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. - - - This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval. - - - - - The POST method is used to request that the origin server accept the entity enclosed - in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. - - - POST is designed to allow a uniform method to cover the following functions: - - - Annotation of existing resources; - - Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles; - - Providing a block of data, such as the result of submitting a form, to a data-handling process; - - Extending a database through an append operation. - - - - If a resource has been created on the origin server, the response SHOULD be 201 (Created) and - contain an entity which describes the status of the request and refers to the new resource, and a - Location header (see section 14.30). - - - The action performed by the POST method might not result in a resource that can be identified by a URI. - In this case, either 200 (OK) or 204 (No Content) is the appropriate response status, depending on - whether or not the response includes an entity that describes the result. - - Responses to this method are not cacheable, unless the response includes appropriate Cache-Control - or Expires header fields. However, the 303 (See Other) response can be used to direct the user agent - to retrieve a cacheable resource. - - - - - - The PUT method requests that the enclosed entity be stored under the supplied Request-URI. - - - - - If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a - modified version of the one residing on the origin server. - - If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new - resource by the requesting user agent, the origin server can create the resource with that URI. - - If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. - - If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to - indicate successful completion of the request. - - If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be - given that reflects the nature of the problem. - - - - The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not - understand or implement and MUST return a 501 (Not Implemented) response in such cases. - - - - - - The TRACE method is used to invoke a remote, application-layer loop- back of the request message. - - - - - Contains all HTTP Methods (according to the HTTP 1.1 specification) - - See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html - - - - - - The DELETE method requests that the origin server delete the resource identified by the Request-URI. - - - - This method MAY be overridden by human intervention (or other means) on the origin server. - The client cannot be guaranteed that the operation has been carried out, even if the status code - returned from the origin server indicates that the action has been completed successfully. - - - However, the server SHOULD NOT indicate success unless, at the time the response is given, - it intends to delete the resource or move it to an inaccessible location. - - - A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, - 202 (Accepted) if the action has not yet been enacted, - or 204 (No Content) if the action has been enacted but the response does not include an entity. - - - If the request passes through a cache and the Request-URI identifies one or more currently cached entities, - those entries SHOULD be treated as stale. Responses to this method are not cacheable. - - - - - - The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. - - - - If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the - entity in the response and not the source text of the process, unless that text happens to be the output of the process. - - - The semantics of the GET method change to a "conditional GET" if the request message includes an - If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, or If-Range header field. - A conditional GET method requests that the entity be transferred only under the circumstances described - by the conditional header field(s). The conditional GET method is intended to reduce unnecessary network - usage by allowing cached entities to be refreshed without requiring multiple requests or transferring - data already held by the client. - - - - - - The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. - - - The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the - information sent in response to a GET request. This method can be used for obtaining metainformation about - the entity implied by the request without transferring the entity-body itself. - - This method is often used for testing hypertext links for validity, accessibility, and recent modification. - - - - - The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. - - - This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval. - - - - - The POST method is used to request that the origin server accept the entity enclosed - in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. - - - POST is designed to allow a uniform method to cover the following functions: - - - Annotation of existing resources; - - Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles; - - Providing a block of data, such as the result of submitting a form, to a data-handling process; - - Extending a database through an append operation. - - - - If a resource has been created on the origin server, the response SHOULD be 201 (Created) and - contain an entity which describes the status of the request and refers to the new resource, and a - Location header (see section 14.30). - - - The action performed by the POST method might not result in a resource that can be identified by a URI. - In this case, either 200 (OK) or 204 (No Content) is the appropriate response status, depending on - whether or not the response includes an entity that describes the result. - - Responses to this method are not cacheable, unless the response includes appropriate Cache-Control - or Expires header fields. However, the 303 (See Other) response can be used to direct the user agent - to retrieve a cacheable resource. - - - - - - The PUT method requests that the enclosed entity be stored under the supplied Request-URI. - - - - - If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a - modified version of the one residing on the origin server. - - If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new - resource by the requesting user agent, the origin server can create the resource with that URI. - - If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. - - If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to - indicate successful completion of the request. - - If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be - given that reflects the nature of the problem. - - - - The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not - understand or implement and MUST return a 501 (Not Implemented) response in such cases. - - - - - - The TRACE method is used to invoke a remote, application-layer loop- back of the request message. - - - - - Contains serverside http request information. - - - - - Decode body into a form. - - A list with form decoders. - If body contents is not valid for the chosen decoder. - If body is still being transferred. - - - - Sets the cookies. - - The cookies. - - - - Called during parsing of a IHttpRequest. - - Name of the header, should not be url encoded - Value of the header, should not be url encoded - If a header is incorrect. - - - - Add bytes to the body - - buffer to read bytes from - where to start read - number of bytes to read - Number of bytes actually read (same as length unless we got all body bytes). - - If body is not writable - - - - Clear everything in the request - - - - - Have all body content bytes been received? - - - - - Kind of types accepted by the client. - - - - - Submitted body contents - - - - - Kind of connection used for the session. - - - - - Number of bytes in the body - - - - - Headers sent by the client. All names are in lower case. - - - - - Version of http. - Probably HttpHelper.HTTP10 or HttpHelper.HTTP11 - - - - - - Requested method, always upper case. - - - - - - Variables sent in the query string - - - - - Requested URI (url) - - - - - Uri absolute path splitted into parts. - - - // uri is: http://gauffin.com/code/tiny/ - Console.WriteLine(request.UriParts[0]); // result: code - Console.WriteLine(request.UriParts[1]); // result: tiny - - - If you're using controllers than the first part is controller name, - the second part is method name and the third part is Id property. - - - - - - Check's both QueryString and Form after the parameter. - - - - - Form parameters. - - - - Returns true if the request was made by Ajax (Asyncronous Javascript) - - - Returns set cookies for the request - - - - Parses a HTTP request directly from a stream - - - - - Create a new request parser - - delegate called when a complete request have been generated - delegate receiving log entries. - - - - Add a number of bytes to the body - - - - - - - - - Remove all state information for the request. - - - - - Parse request line - - - If line is incorrect - Expects the following format: "Method SP Request-URI SP HTTP-Version CRLF" - - - - We've parsed a new header. - - Name in lower case - Value, unmodified. - If content length cannot be parsed. - - - - Parse a message - - - where in buffer that parsing should start - number of bytes to parse - Unparsed bytes left in buffer. - - - - Current state in parser. - - - - - Invoked when a request have been completed. - - - - - - Current state in the parsing. - - - - - Should parse the request line - - - - - Searching for a complete header name - - - - - Searching for colon after header name (ignoring white spaces) - - - - - Searching for start of header value (ignoring white spaces) - - - - - Searching for a complete header value (can span over multiple lines, as long as they are prefixed with one/more whitespaces) - - - - - Adding bytes to body - - - - - Contains serverside http request information. - - - - - Chars used to split an url path into multiple parts. - - - - - Assign a form. - - - - - - Creates a new object that is a copy of the current instance. - - - - A new object that is a copy of this instance. - - 2 - - - - Decode body into a form. - - A list with form decoders. - If body contents is not valid for the chosen decoder. - If body is still being transferred. - - - - Cookies - - the cookies - - - - Called during parsing of a IHttpRequest. - - Name of the header, should not be url encoded - Value of the header, should not be url encoded - If a header is incorrect. - - - - Add bytes to the body - - buffer to read bytes from - where to start read - number of bytes to read - Number of bytes actually read (same as length unless we got all body bytes). - - If body is not writable - - - - Clear everything in the request - - - - - Have all body content bytes been received? - - - - - Kind of types accepted by the client. - - - - - Submitted body contents - - - - - Kind of connection used for the session. - - - - - Number of bytes in the body - - - - - Headers sent by the client. All names are in lower case. - - - - - Version of http. - Probably HttpHelper.HTTP10 or HttpHelper.HTTP11 - - - - - - Requested method, always upper case. - - - - - - Variables sent in the query string - - - - - Requested URI (url) - - - - - - Uri absolute path splitted into parts. - - - // uri is: http://gauffin.com/code/tiny/ - Console.WriteLine(request.UriParts[0]); // result: code - Console.WriteLine(request.UriParts[1]); // result: tiny - - - If you're using controllers than the first part is controller name, - the second part is method name and the third part is Id property. - - - - - - Path and query (will be merged with the host header) and put in Uri - - - - - - Check's both QueryString and Form after the parameter. - - - - - Form parameters. - - - - Returns true if the request was made by Ajax (Asyncronous Javascript) - - - Returns set cookies for the request - - - - Current request is sent over secure protocol - - - - - The website module let's you handle multiple websites in the same server. - It uses the "Host" header to check which site you want. - - It's recommended that you do not - add any other modules to HttpServer if you are using the website module. Instead, - add all wanted modules to each website. - - - - - - domain name that should be handled. - - - - - Method that process the url - - Information sent by the browser about the request - Information that is being sent back to the client. - Session used to - - - - Name of site. - - - - - Helpers making it easier to work with forms. - - - - - - Used to let the website use different javascript libraries. - Default is - - - - - Create a <form> tag. - - name of form - action to invoke on submit - form should be posted as ajax - html code - - - // without options - WebHelper.FormStart("frmLogin", "/user/login", Request.IsAjax); - - // with options - WebHelper.FormStart("frmLogin", "/user/login", Request.IsAjax, "style", "display:inline", "class", "greenForm"); - - - html attributes or javscript options. - Method will ALWAYS be POST. - - - - Creates a select list with the values in a collection. - - Name of the SELECT-tag - collection used to generate options. - delegate used to return id and title from objects. - value that should be marked as selected. - First row should contain an empty value. - string containtain a SELECT-tag. - - - - - Creates a select list with the values in a collection. - - Name of the SELECT-tag - Id of the SELECT-tag - collection used to generate options. - delegate used to return id and title from objects. - value that should be marked as selected. - First row should contain an empty value. - string containtain a SELECT-tag. - - - - // Class that is going to be used in a SELECT-tag. - public class User - { - private readonly string _realName; - private readonly int _id; - public User(int id, string realName) - { - _id = id; - _realName = realName; - } - public string RealName - { - get { return _realName; } - } - - public int Id - { - get { return _id; } - } - } - - // Using an inline delegate to generate the select list - public void UserInlineDelegate() - { - List<User> items = new List<User>(); - items.Add(new User(1, "adam")); - items.Add(new User(2, "bertial")); - items.Add(new User(3, "david")); - string htmlSelect = Select("users", "users", items, delegate(object o, out object id, out object value) - { - User user = (User)o; - id = user.Id; - value = user.RealName; - }, 2, true); - } - - // Using an method as delegate to generate the select list. - public void UseExternalDelegate() - { - List<User> items = new List<User>(); - items.Add(new User(1, "adam")); - items.Add(new User(2, "bertial")); - items.Add(new User(3, "david")); - string htmlSelect = Select("users", "users", items, UserOptions, 1, true); - } - - // delegate returning id and title - public static void UserOptions(object o, out object id, out object title) - { - User user = (User)o; - id = user.Id; - value = user.RealName; - } - - - - - - Creates a select list with the values in a collection. - - Name of the SELECT-tag - Id of the SELECT-tag - collection used to generate options. - delegate used to return id and title from objects. - value that should be marked as selected. - First row should contain an empty value. - name, value collection of extra html attributes. - string containtain a SELECT-tag. - - - - - Generate a list of HTML options - - collection used to generate options. - delegate used to return id and title from objects. - value that should be marked as selected. - First row should contain an empty value. - - - - - Creates a checkbox. - - element name - element value - determines if the check box is selected or not. This is done diffrently depending on the - type of variable. A bool simply trigges checked or not, all other types are compared with "value" to determine if - the box is checked or not. - a list with additional attributes (name, value, name, value). - a generated radio button - - - - Creates a checkbox. - - element name - element id - element value - determines if the check box is selected or not. This is done diffrently depending on the - type of variable. A bool simply trigges checked or not, all other types are compared with "value" to determine if - the box is checked or not. - a list with additional attributes (name, value, name, value). - a generated radio button - - value in your business object. (check box will be selected if it matches the element value) - - - - - Creates a checkbox. - - element name - element id - determines if the check box is selected or not. This is done diffrently depending on the - type of variable. A bool simply trigges checked or not, all other types are compared with "value" to determine if - the box is checked or not. - a list with additional attributes (name, value, name, value). - a generated radio button - will set value to "1". - - - - Creates a RadioButton. - - element name - element value - determines if the radio button is selected or not. This is done diffrently depending on the - type of variable. A bool simply trigges checked or not, all other types are compared with "value" to determine if - the box is checked or not. - a list with additional attributes (name, value, name, value). - a generated radio button - - - - Creates a RadioButton. - - element name - element id - element value - determines if the radio button is selected or not. This is done diffrently depending on the - type of variable. A bool simply trigges checked or not, all other types are compared with "value" to determine if - the box is checked or not. - a list with additional attributes (name, value, name, value). - a generated radio button - - - - form close tag - - - - - - The request could not be understood by the server due to malformed syntax. - The client SHOULD NOT repeat the request without modifications. - - Text taken from: http://www.submissionchamber.com/help-guides/error-codes.php - - - - - Create a new bad request exception. - - reason to why the request was bad. - - - - Create a new bad request exception. - - reason to why the request was bad. - inner exception - - - - Implements HTTP Digest authentication. It's more secure than Basic auth since password is - encrypted with a "key" from the server. - - - Keep in mind that the password is encrypted with MD5. Use a combination of SSL and digest auth to be secure. - - - - - Initializes a new instance of the class. - - Delegate used to provide information used during authentication. - Delegate used to determine if authentication is required (may be null). - - - - Initializes a new instance of the class. - - Delegate used to provide information used during authentication. - - - - Used by test classes to be able to use hardcoded values - - - - - An authentication response have been received from the web browser. - Check if it's correct - - Contents from the Authorization header - Realm that should be authenticated - GET/POST/PUT/DELETE etc. - First option: true if username/password is correct but not cnonce - - Authentication object that is stored for the request. A user class or something like that. - - if authenticationHeader is invalid - If any of the paramters is empty or null. - - - - Encrypts parameters into a Digest string - - Realm that the user want's to log into. - User logging in - Users password. - HTTP metod. - Uri/domain that generated the login prompt. - The qop. - The nonce. - The nc. - The cnonce. - Digest enrypted string - - - - Create a response that can be sent in the WWW-Authenticate header. - - Realm that the user should authenticate in - First options specifies if true if username/password is correct but not cnonce. - A correct auth request. - If realm is empty or null. - - - - Decodes authorization header value - - header value - Encoding that the buffer is in - All headers and their values if successful; otherwise null - - NameValueCollection header = DigestAuthentication.Decode("response=\"6629fae49393a05397450978507c4ef1\",\r\nc=00001", Encoding.ASCII); - - Can handle lots of whitespaces and new lines without failing. - - - - Gets the current nonce. - - - - - - Gets the Md5 hash bin hex2. - - To be hashed. - - - - - determines if the nonce is valid or has expired. - - nonce value (check wikipedia for info) - true if the nonce has not expired. - - - - name used in http request. - - - - - Session store using memory for each session. - - - - - Initializes the class setting the expirationtimer to clean the session every minute - - - - - Delegate for the cleanup timer - - - - - Creates a new http session - - - - - - Creates a new http session with a specific id - - Id used to identify the new cookie.. - A object. - Id should be generated by the store implementation if it's null or . - - - - - Load an existing session. - - - - - - - Save an updated session to the store. - - - - - - We use the flyweight pattern which reuses small objects - instead of creating new each time. - - EmptyLanguageNode (unused) session that should be reused next time Create is called. - - - - Remove expired sessions - - - - - Remove a session - - id of the session. - - - - Load a session from the store - - - null if session is not found. - - - - Number of minutes before a session expires. - Default is 20 minutes. - - - - - Keeps information about templates, so we know when to regenerate it. - + POST is designed to allow a uniform method to cover the following functions: + + + Annotation of existing resources; + + Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles; + + Providing a block of data, such as the result of submitting a form, to a data-handling process; + + Extending a database through an append operation. + + + + If a resource has been created on the origin server, the response SHOULD be 201 (Created) and + contain an entity which describes the status of the request and refers to the new resource, and a + Location header (see section 14.30). + + + The action performed by the POST method might not result in a resource that can be identified by a URI. + In this case, either 200 (OK) or 204 (No Content) is the appropriate response status, depending on + whether or not the response includes an entity that describes the result. + + Responses to this method are not cacheable, unless the response includes appropriate Cache-Control + or Expires header fields. However, the 303 (See Other) response can be used to direct the user agent + to retrieve a cacheable resource. + + - + - When the template was compiled. + The PUT method requests that the enclosed entity be stored under the supplied Request-URI. - Use this date to determine if the template is old and needs to be recompiled. + + + + If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a + modified version of the one residing on the origin server. + + If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new + resource by the requesting user agent, the origin server can create the resource with that URI. + + If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. + + If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to + indicate successful completion of the request. + + If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be + given that reflects the nature of the problem. + + + + The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not + understand or implement and MUST return a 501 (Not Implemented) response in such cases. + + - + - Template file name. + The TRACE method is used to invoke a remote, application-layer loop- back of the request message. - + - The actual template. + Generic helper functions for HTTP - + - Validator is used to validate all input items in a form. + Version string for HTTP v1.0 - + - Initializes a new instance of the class. + Version string for HTTP v1.1 - collection to be filled with errors - + - Initializes a new instance of the class. + An empty URI - collection to be filled with errors - Translation used to translate the "name" parameters in all validation methods. - + - Initializes a new instance of the class. + Parses a query string. - Translation used to translate the "name" parameters in all validation methods. + Query string (URI encoded) + A object if successful; otherwise + queryString is null. + If string cannot be parsed. - + - + The object form class takes an object and creates form items for it. - form that validation should be made on. - + - + Initializes a new instance of the class. - collection that all validation errors are added to. - form that validation should be made on. + + form name *and* id. + action to do when form is posted. + - + - + Initializes a new instance of the class. - collection that all validation errors are added to. - form that validation should be made on. - Language category used to translate field names. + form name *and* id. + action to do when form is posted. + object to get values from - + - Switch to a new http input. + Initializes a new instance of the class. - form to use validation for now + form action. + object to get values from. - + - Switch to a new http input. + write out the FORM-tag. - form to use validation for now - language for the validation + generated html code - + - Check if a value is digits only + Writeout the form tag - Field name. - true if field is required (may not be empty) - string if validated, otherwise string.Empty + form should be posted through ajax. + generated html code - + - Check if a value is digits only + Generates a text box. - Field name. - extra characters that is allowed. - true if field is required (may not be empty) - string if validated, otherwise string.Empty + + + generated html code - + - Check whether the specified form item is an integer. + password box - Form parameter to validate - value if parameter is an int; 0 if not. + + + generated html code - + - Check whether the specified form item is an integer. + Hiddens the specified property name. - Form parameter to validate - Paramater is required (adds an error if it's not specified) - value if parameter is an int; 0 if not. + Name of the property. + The options. + generated html code - + - Check whether the specified value is a double. + Labels the specified property name. - Name of the parameter - Paramater is required (adds an error if it's not specified) - value if parameter is a double; 0 if not. + property in object. + caption + generated html code - + - Check whether the specified value is a currency amount. + Generate a checkbox - Name of the parameter - Paramater is required (adds an error if it's not specified) - value if parameter is a currency amount; 0 if not. + property in object + checkbox value + additional html attributes. + generated html code - + - Validates a string to hex + Write a html select tag - The name of the field to validate - If the field must be set - The value if validated otherwise string.Empty + object property. + id column + The title column. + The options. + - + - Validate that a string only contains letters or digits. + Selects the specified property name. - Name of form parameter to validate. - Value is required. - value if valid; otherwise string.EmptyLanguageNode. + Name of the property. + The items. + The id column. + The title column. + The options. + - + - Validate that a string only contains letters or digits. + Write a submit tag. - Form parameter name. - vaue if found; otherwise string.Empty + button caption + html submit tag - + - Validate that a string only contains letters, digits or the specified characters + html end form tag - Form parameter name. - may not be null or empty if true. - any other allowed characters. - value if valid; otherwise string.Empty + html - + - Validate that a string consists of only letters (including special letters) + Can handle application/x-www-form-urlencoded - - If a value must be passed - - + - Validate that a string consists of only letters (a-z and A-Z) - - If a value must be passed - A string of extra character to test against, dont forget language specific characters and spaces if wished for - + Stream containing the content + Content type (with any additional info like boundry). Content type is always supplied in lower case + Stream encoding + + A HTTP form, or null if content could not be parsed. + + If contents in the stream is not valid input data. - + - Check whether the specified value is an integer. + Checks if the decoder can handle the mime type - Name of the parameter - value if parameter contains valid characters; string.Empty if not. + Content type (with any additional info like boundry). Content type is always supplied in lower case. + True if the decoder can parse the specified content type - + - Check whether the specified value is an integer. + The requested resource was not found in the web server. - Name of the parameter - Paramater is required (adds an error if it's not specified) - value if parameter contains valid characters; string.Empty if not. - + - Validate that a string only contains letters or digits or any of the . + Create a new exception - Name of form parameter to validate. - Value is required. - value if valid; otherwise string.Empty. + message describing the error + inner exception - + - Validate that a string only contains letters or digits or any of the . + Create a new exception - Form parameter name. - vaue if found; otherwise string.Empty + message describing the error - + - Check's weather a parameter is null or not. + Invoked when a client have been accepted by the - Parameter in form - true if value is not null; otherwise false. + + Can be used to revoke incoming connections + - + - Validate a string value + Initializes a new instance of the class. - Name of form parameter to validate. - Value is required. - value if valid; otherwise string.Empty. + The socket. - + - Validate a string parameter in the form + Client may not be handled. - Form parameter name. - vaue if found; otherwise string.Empty - + - validates email address using a regexp. + Accepted socket. - field name - field is required (may not be null or empty). - value if validation is ok; otherwise string.Empty. - + - Check whether the specified value is an character. + Client should be revoked. - Name of the parameter - Paramater is required (adds an error if it's not specified) - value if parameter is an int; char.MinValue if not. - + - Check whether the specified value is an character. + Used to queue incoming requests. - Name of the parameter - value if parameter is an int; char.MinValue if not. - + - Checks whether a field is true (can also be in native language). + Initializes a new instance of the class. - field name - field is required (may not be null or empty). - true if value is true; false if value is false or if validation failed. - Check validation errors to see if error ocurred. + Called when a request should be processed. - + - Checks whether a field is true (can also be in native language). + Used to process queued requests. - field name - true if value is true; false if value is false or if validation failed. - Check validation errors to see if error ocurred. - + - Class to handle loading of resource files + Gets or sets maximum number of allowed simultaneous requests. - - - ]]> - - + - Parses a filename and sets it to the extensionless name in lowercase. The extension is cut out without the dot. + Gets or sets maximum number of requests queuing to be handled. - - - - string ext; - string filename = "/uSeR/teSt.haMl"; - ParseName(ref filename, out ext); - Console.WriteLine("File: " + filename); - Console.WriteLine("Ext: " + ext); - -> user/test - -> haml - - + - Add a resource to a specified uri without extension, ie user/test + Specifies how many requests the HTTP server is currently processing. - The uri to add the resource to - The instance describing the resource - + - Loads resources from a namespace in the given assembly to an uri + Used two queue incoming requests to avoid + thread starvation. - The uri to map the resources to - The assembly in which the resources reside - The namespace from which to load the resources - - resourceLoader.LoadResources("/user/", typeof(User).Assembly, "MyLib.Models.User.Views"); - - will make ie the resource MyLib.Models.User.Views.list.Haml accessible via /user/list.haml or /user/list/ - - + - Retrieves a stream for the specified resource path if loaded otherwise null + Method used to process a queued request - Path to the resource to retrieve a stream for - A stream or null if the resource couldn't be found + Context that the request was received from. + Request to process. - + - Fetch all files from the resource that matches the specified arguments. + Used when the request line have been successfully parsed. - The path to the resource to extract - - a list of files if found; or an empty array if no files are found. - - + - Fetch all files from the resource that matches the specified arguments. + Initializes a new instance of the class. - Where the file should reside. - Files to check - - a list of files if found; or an empty array if no files are found. - + The HTTP method. + The URI path. + The HTTP version. - + - Returns whether or not the loader has an instance of the file requested + Initializes a new instance of the class. - The name of the template/file - True if the loader can provide the file - + - We dont want to let the server to die due to exceptions thrown in worker threads. - therefore we use this delegate to give you a change to handle uncaught exceptions. + Gets or sets http method. - Class that the exception was thrown in. - Exception - Server will throw a InternalServerException in release version if you dont - handle this delegate. + Should be one of the methods declared in . - + - Method marked with this attribute determines if authentication is required. + Gets or sets the version of the HTTP protocol that the client want to use. - - - - - - The method should take one parameter (int level), return a bool and be protected/private. - You should throw UnauthorizedException if you are using HTTP authentication. - - - = level; - } - } - ]]> - - + - This class is created as a wrapper, since there are two different cookie types in .Net (Cookie and HttpCookie). - The framework might switch class in the future and we dont want to have to replace all instances + Gets or sets requested URI path. - + - Let's copy all the cookies. + Inversion of control interface. - value from cookie header. - + - Adds a cookie in the collection. + Add a component instance - cookie to add - cookie is null + Interface type + Instance to add - + - Gets a collection enumerator on the cookie list. + Get a component. - collection enumerator + Interface type + Component if registered, otherwise null. + + Component will get created if needed. + - + - Remove all cookies. + Checks if the specified component interface have been added. + + true if found; otherwise false. - + - Returns an enumerator that iterates through the collection. + Add a component. - - - A that can be used to iterate through the collection. - - 1 + Type being requested. + Type being created. - + - Gets the count of cookies in the collection. + Response that is sent back to the web browser / client. + + + A response can be sent if different ways. The easiest one is + to just fill the Body stream with content, everything else + will then be taken care of by the framework. The default content-type + is text/html, you should change it if you send anything else. + + The second and slightly more complex way is to send the response + as parts. Start with sending the header using the SendHeaders method and + then you can send the body using SendBody method, but do not forget + to set and before doing so. + + + + + // Example using response body. + class MyModule : HttpModule + { + public override bool Process(IHttpRequest request, IHttpResponse response, IHttpSession session) + { + StreamWriter writer = new StreamWriter(response.Body); + writer.WriteLine("Hello dear World!"); + writer.Flush(); + + // return true to tell webserver that we've handled the url + return true; + } + } + + + todo: add two examples, using SendHeaders/SendBody and just the Body stream. - + - Gets the cookie of a given identifier (null if not existing). + Response that is sent back to the web browser / client. + + A response can be sent if different ways. The easiest one is + to just fill the Body stream with content, everything else + will then be taken care of by the framework. The default content-type + is text/html, you should change it if you send anything else. + + The second and slighty more complex way is to send the response + as parts. Start with sending the header using the SendHeaders method and + then you can send the body using SendBody method, but do not forget + to set ContentType and ContentLength before doing so. + + public void MyHandler(IHttpRequest request, IHttpResponse response) + { + + } + - + - Delegate used to find a realm/domain. + Add another header to the document. - - - - Realms are used during HTTP Authentication - - - + Name of the header, case sensitive, use lower cases. + Header values can span over multiple lines as long as each line starts with a white space. New line chars should be \r\n + If headers already been sent. + If value conditions have not been met. + Adding any header will override the default ones and those specified by properties. - + - A complete HTTP server, you need to add a module to it to be able to handle incoming requests. + Send headers and body to the browser. - - - // this small example will add two web site modules, thus handling - // two different sites. In reality you should add Controller modules or something - // two the website modules to be able to handle different requests. - HttpServer server = new HttpServer(); - server.Add(new WebSiteModule("www.gauffin.com", "Gauffin Telecom AB")); - server.Add(new WebSiteModule("www.vapadi.se", "Remote PBX")); - - // start regular http - server.Start(IPAddress.Any, 80); - - // start https - server.Start(IPAddress.Any, 443, myCertificate); - - - - - - + If content have already been sent. - + - Initializes a new instance of the class. + Make sure that you have specified ContentLength and sent the headers first. + + If headers have not been sent. + + offest of first byte to send + number of bytes to send. + + + This method can be used if you want to send body contents without caching them first. This + is recommended for larger files to keep the memory usage low. - + - Initializes a new instance of the class. + Make sure that you have specified ContentLength and sent the headers first. - Form decoders are used to convert different types of posted data to the object types. - - + + If headers have not been sent. + + + + This method can be used if you want to send body contents without caching them first. This + is recommended for larger files to keep the memory usage low. - + - Initializes a new instance of the class. + Send headers to the client. - A session store is used to save and retrieve sessions - + If headers already been sent. + + + - + - Initializes a new instance of the class. + Redirect client to somewhere else using the 302 status code. - The log writer. - + Destination of the redirect + If headers already been sent. + You can not do anything more with the request when a redirect have been done. This should be your last + action. - + - Initializes a new instance of the class. + redirect to somewhere - Form decoders are used to convert different types of posted data to the object types. - The log writer. - - - + where the redirect should go + + No body are allowed when doing redirects. + - + - Initializes a new instance of the class. + The body stream is used to cache the body contents + before sending everything to the client. It's the simplest + way to serve documents. - Form decoders are used to convert different types of posted data to the object types. - A session store is used to save and retrieve sessions - The log writer. - - - - - + - Adds the specified rule. + Defines the version of the HTTP Response for applications where it's required + for this to be forced. - The rule. - + - Add a to the server. + The chunked encoding modifies the body of a message in order to + transfer it as a series of chunks, each with its own size indicator, + followed by an OPTIONAL trailer containing entity-header fields. This + allows dynamically produced content to be transferred along with the + information necessary for the recipient to verify that it has + received the full message. - mode to add - + - Decodes the request body. + Kind of connection - The request. - + - Generate a HTTP error page (that will be added to the response body). - response status code is also set. + Encoding to use when sending stuff to the client. - Response that the page will be generated in. - . - response body contents. + Default is UTF8 - + - Generate a HTTP error page (that will be added to the response body). - response status code is also set. + Number of seconds to keep connection alive - Response that the page will be generated in. - exception. + Only used if Connection property is set to ConnectionType.KeepAlive - + - Realms are used by the s. + Status code that is sent to the client. - HTTP request - domain/realm. + Default is HttpStatusCode.Ok - + - Process an incoming request. + Information about why a specific status code was used. - connection to client - request information - response that should be filled - session information - + - Can be overloaded to implement stuff when a client have been connected. + Size of the body. MUST be specified before sending the header, + unless property Chunked is set to true. - - Default implementation does nothing. - - client that disconnected - disconnect reason - + - Handle authentication + Kind of content in the body - - - - true if request can be handled; false if not. + Default is text/html - + - Will request authentication. + Headers have been sent to the client- - - Sends respond to client, nothing else can be done with the response after this. - - - - + You can not send any additional headers if they have already been sent. - + - Start the web server using regular HTTP. + The whole response have been sent. - IP Address to listen on, use IpAddress.Any to accept connections on all ip addresses/network cards. - Port to listen on. 80 can be a good idea =) - + - Accept secure connections. + Cookies that should be created/changed. - IP Address to listen on, use IpAddress.Any to accept connections on all ipaddresses/network cards. - Port to listen on. 80 can be a good idea =) - Certificate to use - + - shut down the server and listeners + Initializes a new instance of the class. + Client that send the . + Contains information of what the client want to receive. + cannot be empty. - + - write an entry to the log file + Initializes a new instance of the class. - importance of the message - log message + Client that send the . + Version of HTTP protocol that the client uses. + Type of HTTP connection used. - + - write an entry to the log file + Add another header to the document. - object that wrote the message - importance of the message - log message + Name of the header, case sensitive, use lower cases. + Header values can span over multiple lines as long as each line starts with a white space. New line chars should be \r\n + If headers already been sent. + If value conditions have not been met. + Adding any header will override the default ones and those specified by properties. - + - Modules used for authentication. The module that is is added first is used as - the default authentication module. + Send headers and body to the browser. - Use the corresponding property - in the WebSiteModule if you are using multiple websites. + If content have already been sent. - + - Form decoder providers are used to decode request body (which normally contains form data). + Make sure that you have specified and sent the headers first. + + If headers have not been sent. + + offset of first byte to send + number of bytes to send. + + + This method can be used if you want to send body contents without caching them first. This + is recommended for larger files to keep the memory usage low. - + - Server name sent in HTTP responses. + Make sure that you have specified and sent the headers first. - - Do NOT include version in name, since it makes it - easier for hackers. - + + If headers have not been sent. + + + + This method can be used if you want to send body contents without caching them first. This + is recommended for larger files to keep the memory usage low. - + - Name of cookie where session id is stored. + Send headers to the client. + If headers already been sent. + + + - + - Specified where logging should go. + Redirect client to somewhere else using the 302 status code. - - - + Destination of the redirect + If headers already been sent. + You can not do anything more with the request when a redirect have been done. This should be your last + action. - + - Number of connections that can wait to be accepted by the server. + redirect to somewhere - Default is 10. + where the redirect should go + + No body are allowed when doing redirects. + - + - Realms are used during HTTP authentication. - Default realm is same as server name. + The body stream is used to cache the body contents + before sending everything to the client. It's the simplest + way to serve documents. - + - Let's to receive unhandled exceptions from the threads. + The chunked encoding modifies the body of a message in order to + transfer it as a series of chunks, each with its own size indicator, + followed by an OPTIONAL trailer containing entity-header fields. This + allows dynamically produced content to be transferred along with the + information necessary for the recipient to verify that it has + received the full message. - - Exceptions will be thrown during debug mode if this event is not used, - exceptions will be printed to console and suppressed during release mode. - - + - The request requires user authentication. The response MUST include a - WWW-Authenticate header field (section 14.47) containing a challenge - applicable to the requested resource. - - The client MAY repeat the request with a suitable Authorization header - field (section 14.8). If the request already included Authorization - credentials, then the 401 response indicates that authorization has been - refused for those credentials. If the 401 response contains the same challenge - as the prior response, and the user agent has already attempted authentication - at least once, then the user SHOULD be presented the entity that was given in the response, - since that entity might include relevant diagnostic information. - - HTTP access authentication is explained in rfc2617: - http://www.ietf.org/rfc/rfc2617.txt - - (description is taken from - http://www.submissionchamber.com/help-guides/error-codes.php#sec10.4.2) + Defines the version of the HTTP Response for applications where it's required + for this to be forced. - + - Create a new unauhtorized exception. + Kind of connection - - + - Create a new unauhtorized exception. + Encoding to use when sending stuff to the client. - reason to why the request was unauthorized. - inner exception + Default is UTF8 - + - Create a new unauhtorized exception. + Number of seconds to keep connection alive - reason to why the request was unauthorized. + Only used if Connection property is set to . - + - Generates C# rendering object using ASP similiar tags in the HTML code. + Status code that is sent to the client. + Default is - + - Generate C# code from the template. + Information about why a specific status code was used. - A textwriter that the generated code will be written to. - If the template have not been parsed first. - If template is incorrect - + - Parse a file and convert into to our own template object code. + Size of the body. MUST be specified before sending the header, + unless property Chunked is set to true. - Path and filename to a template - If something is incorrect in the template. - - - - - - + - Parse a file and convert into to our own template object code. + Kind of content in the body - A textreader containing our template - If something is incorrect in the template. + Default type is "text/html" - + - Purpose if this class is to take template objects and keep them in - memory. It will also take a filename and the code generator to use - if when the template have been changed on disk. + Headers have been sent to the client- + You can not send any additional headers if they have already been sent. - + - Initializes a new instance of the class. + The whole response have been sent. - - Template loaders used to load templates from any source. - The loaders will be invoked in the order they are given, that is the first loader will always be asked to give a template - first. - - + - Initializes a new instance of the class. + Cookies that should be created/changed. - Uses the file template loader. - + - Add a template generator + Contains server side HTTP request information. - File extension without the dot. - Generator to handle the extension - If the generator already exists. - If file extension is incorrect - If generator is not specified. - - - cache.Add("haml", new HamlGenerator()); - - - + - This type should be included, so it may be called from the scripts (name space and assembly). + Chars used to split an URL path into multiple parts. - - + - Checks the template. + Assign a form. - Template information, filename must be set. - true if template exists and have been compiled. + - + - Compiles the specified code. + Creates a new object that is a copy of the current instance. - Name of template. - c# code generated from a template. - Arguments as in name, value, name, value, name, value - - An id to specify the exact instance of a template. Made from joining the 'TemplateClass' with the hashcode of the filename - and the hashcode of the supplied arguments - - Template - If compilation fails + + + A new object that is a copy of this instance. + + 2 - + - Will generate code from the template. - Next step is to compile the code. + Decode body into a form. - Path and filename to template. - - If no template generator exists for the specified extension. - If parsing/compiling fails - + A list with form decoders. + If body contents is not valid for the chosen decoder. + If body is still being transferred. - + - Find a template using wildcards in filename. + Cookies - Full path (including wildcards in filename) to where we should find a template. - First found generator if an extension was matched; otherwise null. - method is not thread safe + the cookies - + - Render a partial + Create a response object. - Path and filename - Variables used in the template. Should be specified as "name, value, name, value" where name is variable name and value is variable contents. - Arguments passed from parent template - - - - + A new . - + - Generate HTML from a template. + Called during parsing of a . - Path and filename - Variables used in the template. Should be specified as "name, value, name, value" where name is variable name and value is variable contents. - - - - - - string html = cache.Generate("views\\users\\view.haml", new TemplateArguments("user", dbUser, "isAdmin", dbUser.IsAdmin), null); - - + Name of the header, should not be URL encoded + Value of the header, should not be URL encoded + If a header is incorrect. - + - Keeps information about templates, so we know when to regenerate it. + Add bytes to the body + buffer to read bytes from + where to start read + number of bytes to read + Number of bytes actually read (same as length unless we got all body bytes). + If body is not writable + bytes is null. + offset is out of range. - + - Container to bind resource names to assemblies + Clear everything in the request - + - Instantiates an instance of + Gets or sets a value indicating whether this is secure. - The full name/path of the resource - The assembly the resource exists in - + - Retrieves a stream to the resouce + Path and query (will be merged with the host header) and put in Uri - Null if the resource couldn't be located somehow + - + - Retrieves the assembly the resource resides in + Gets whether the body is complete. - + - Retrieves the full name/path of the assembly + Gets kind of types accepted by the client. - + - Retrieves the extension of the resource + Gets or sets body stream. - + - This template loader loads all templates from a folder on the hard drive. + Gets or sets kind of connection used for the session. - + - Initializes a new instance of the class. + Gets or sets number of bytes in the body. - A prefix that is prepended to all requested files. - - + - Initializes a new instance of the class. + Gets headers sent by the client. - + - Load a template into a and return it. + Gets or sets version of HTTP protocol that's used. - Relative path (and filename) to template. - - a if file was found; otherwise null. - + + Probably or . + + - + - Fetch all files from the resource that matches the specified arguments. + Gets or sets requested method. - Where the file should reside. - Files to check - - a list of files if found; or an empty array if no files are found. - + + + Will always be in upper case. + + - + - Returns whether or not the loader has an instance of the file requested + Gets variables sent in the query string - The name of the template/file - True if the loader can provide the file - + - Check's whether a template should be reloaded or not. + Gets or sets requested URI. - template information - - true if template is OK; false if it do not exist or are old. - - + - A prefix that is prepended to all requested files. + Uri absolute path splitted into parts. - - \\templateName.*" - mgr.PathPrefix = "views\\"; - ]]> - + // uri is: http://gauffin.com/code/tiny/ + Console.WriteLine(request.UriParts[0]); // result: code + Console.WriteLine(request.UriParts[1]); // result: tiny - PathPrefix may not be null, only string.Empty + + If you're using controllers than the first part is controller name, + the second part is method name and the third part is Id property. + - + - Helpers to make XML handling easier + Gets parameter from or . - + - Serializes object to XML. + Gets form parameters. - object to serialize. - xml - - Removes namespaces and adds intendation - - + - Response that is sent back to the web browser / client. - - A response can be sent if different ways. The easiest one is - to just fill the Body stream with content, everything else - will then be taken care of by the framework. The default content-type - is text/html, you should change it if you send anything else. - - The second and slighty more complex way is to send the response - as parts. Start with sending the header using the SendHeaders method and - then you can send the body using SendBody method, but do not forget - to set ContentType and ContentLength before doing so. + Gets whether the request was made by Ajax (Asynchronous JavaScript) - - public void MyHandler(IHttpRequest request, IHttpResponse response) - { - - } - - + - Add another header to the document. + Gets cookies that was sent with the request. - Name of the header, case sensitive, use lower cases. - Header values can span over multiple lines as long as each line starts with a white space. New line chars should be \r\n - If headers already been sent. - If value conditions have not been met. - Adding any header will override the default ones and those specified by properties. - + + Class to handle loading of resource files + + - Send headers and body to the browser. + Initializes a new instance of the class. - If content have already been sent. - + - Make sure that you have specified ContentLength and sent the headers first. + Initializes a new instance of the class. - - If headers have not been sent. - - offest of first byte to send - number of bytes to send. - - - This method can be used if you want to send body contents without caching them first. This - is recommended for larger files to keep the memory usage low. + logger. - + - Make sure that you have specified ContentLength and sent the headers first. + Loads resources from a namespace in the given assembly to an URI - - If headers have not been sent. - - - - This method can be used if you want to send body contents without caching them first. This - is recommended for larger files to keep the memory usage low. + The URI to map the resources to + The assembly in which the resources reside + The namespace from which to load the resources + + + resourceLoader.LoadResources("/user/", typeof(User).Assembly, "MyLib.Models.User.Views"); + + Will make the resource MyLib.Models.User.Views.list.Haml accessible via /user/list.haml or /user/list/ + + The amount of loaded files, giving you the possibility of making sure the resources needed gets loaded + If a resource has already been mapped to an uri - + - Send headers to the client. + Retrieves a stream for the specified resource path if loaded otherwise null - If headers already been sent. - - - + Path to the resource to retrieve a stream for + A stream or null if the resource couldn't be found - + - Redirect client to somewhere else using the 302 status code. + Fetch all files from the resource that matches the specified arguments. - Destination of the redirect - If headers already been sent. - You can not do anything more with the request when a redirect have been done. This should be your last - action. + The path to the resource to extract + + a list of files if found; or an empty array if no files are found. + + Search path must end with an asterisk for finding arbitrary files - + - redirect to somewhere + Fetch all files from the resource that matches the specified arguments. - where the redirect should go - - No body are allowed when doing redirects. - + Where the file should reside. + Files to check + + a list of files if found; or an empty array if no files are found. + - + - The body stream is used to cache the body contents - before sending everything to the client. It's the simplest - way to serve documents. + Returns whether or not the loader has an instance of the file requested + The name of the template/file + True if the loader can provide the file - + - The chunked encoding modifies the body of a message in order to - transfer it as a series of chunks, each with its own size indicator, - followed by an OPTIONAL trailer containing entity-header fields. This - allows dynamically produced content to be transferred along with the - information necessary for the recipient to verify that it has - received the full message. + Will contain helper functions for javascript. - + - Kind of connection + Requests a url through ajax + url to fetch. Url is NOT enclosed in quotes by the implementation. You need to do that yourself. + optional options in format "key, value, key, value", used in JS request object. All keys should end with colon. + a link tag + onclick attribute is used by this method. + + + // plain text + JSHelper.AjaxRequest("'/user/show/1'"); + + // ajax request using this.href + string link = "<a href=\"/user/call/1\" onclick=\"" + JSHelper.AjaxRequest("this.href") + "/<call user</a>"; + + - + - Encoding to use when sending stuff to the client. + Ajax requests that updates an element with + the fetched content - Default is UTF8 + url to fetch. Url is NOT enclosed in quotes by the implementation. You need to do that yourself. + element to update + options in format "key, value, key, value". All keys should end with colon. + A link tag. + + + JSHelper.AjaxUpdater("'/user/show/1'", "user", "onsuccess:", "alert('hello');", "asynchronous:", "true"); + + - + - Number of seconds to keep connection alive + Opens contents in a dialog window. - Only used if Connection property is set to ConnectionType.KeepAlive + url to contents of dialog + link title + name, value, name, value, all parameter names should end with colon. - + - Status code that is sent to the client. + Close a javascript dialog window/div. - Default is HttpStatusCode.Ok + javascript for closing a dialog. + - + - Information about why a specific status code was used. + This provider is used to let us implement any type of form decoding we want without + having to rewrite anything else in the server. - + - Size of the body. MUST be specified before sending the header, - unless property Chunked is set to true. + + Should contain boundary and type, as in: multipart/form-data; boundary=---------------------------230051238959 + Stream containing form data. + Encoding used when decoding the stream + if no parser was found. + If stream is null or not readable. + If stream contents cannot be decoded properly. - + - Kind of content in the body + Add a decoder. - Default is text/html + + - + - Headers have been sent to the client- + Number of added decoders. - You can not send any additional headers if they have already been sent. - + - The whole response have been sent. + Use with care. - + - Cookies that should be created/changed. + Decoder used for unknown content types. @@ -5591,8 +3803,8 @@ - represents a http input item. Each item can have multiple sub items, a sub item - is made in a html form by using square brackets + represents a HTTP input item. Each item can have multiple sub items, a sub item + is made in a HTML form by using square brackets // becomes: @@ -5603,7 +3815,7 @@ - Representation of a non-initialized HttpInputItem + Representation of a non-initialized . @@ -5621,14 +3833,15 @@ Add another value to this item - + Value to add. + Cannot add stuff to . - checks if a subitem exists (and has a value). + checks if a sub-item exists (and has a value). name in lower case - true if the subitem exists and has a value; otherwise false. + true if the sub-item exists and has a value; otherwise false. Returns a formatted representation of the instance with the values of all contained parameters @@ -5642,10 +3855,12 @@ - Add a sub item + Add a sub item. Can contain array formatting, the item is then parsed and added in multiple levels - + Value to add. + Argument is null. + Cannot add stuff to . @@ -5684,1336 +3899,1553 @@ Get a sub item name in lower case. - HttpInputItem.Empty if no item was found. + if no item was found. + + + + Name of item (in lower case). + + + + + Returns the first value, or null if no value exist. + + + + + Returns the last value, or null if no value exist. + + + + + Returns the list with values. + + + + + + + name in lower case + + + + + Session store using memory for each session. + + + + + Initializes the class setting the expirationtimer to clean the session every minute + + + + + Delegate for the cleanup timer + + + + + Creates a new http session + + + + + + Creates a new http session with a specific id + + Id used to identify the new cookie.. + A object. + + Id should be generated by the store implementation if it's null or . + + + + + Load an existing session. + + + + + + + Save an updated session to the store. + + + + + + We use the flyweight pattern which reuses small objects + instead of creating new each time. + + EmptyLanguageNode (unused) session that should be reused next time Create is called. + + + + Remove expired sessions + + + + + Remove a session + + id of the session. + + + + Load a session from the store + + + null if session is not found. - + - Name of item (in lower case). + Number of minutes before a session expires. + Default is 20 minutes. - + - Returns the first value, or null if no value exist. + redirects from one URL to another. - + - Returns the last value, or null if no value exist. + Initializes a new instance of the class. + Absolute path (no server name) + Absolute path (no server name) + + server.Add(new RedirectRule("/", "/user/index")); + - + - Returns the list with values. - todo: Return a readonly collection + Initializes a new instance of the class. + Absolute path (no server name) + Absolute path (no server name) + true if request should be redirected, false if the request URI should be replaced. + + server.Add(new RedirectRule("/", "/user/index")); + - + - + Process the incoming request. - name in lower case - + incoming HTTP request + outgoing HTTP response + true if response should be sent to the browser directly (no other rules or modules will be processed). + + returning true means that no modules will get the request. Returning true is typically being done + for redirects. + - + - Can handle application/x-www-form-urlencoded + Gets string to match request URI with. + Is compared to request.Uri.AbsolutePath - + + Gets where to redirect. - Stream containing the content - Content type (with any additional info like boundry). Content type is always supplied in lower case - Stream enconding - - A http form, or null if content could not be parsed. - - If contents in the stream is not valid input data. - + - Checks if the decoder can handle the mime type + Gets whether server should redirect client. - Content type (with any additional info like boundry). Content type is always supplied in lower case. - True if the decoder can parse the specified content type + + false means that the rule will replace + the current request URI with the new one from this class. + true means that a redirect response is sent to the client. + - + - Used to simply testing of controls. + Arguments used when more body bytes have come. - + - Fake host name, default is "http://localhost" + Initializes a new instance of the class. + buffer that contains the received bytes. + offset in buffer where to start processing. + number of bytes from that should be parsed. - + - Session used if null have been specified as argument to one of the class methods. + Initializes a new instance of the class. - + - Send a GET request to a controller. + Gets or sets buffer that contains the received bytes. - Controller receiving the post request. - Uri visited. - Response from the controller. - Session used during the test. null = is used. - body posted by the response object - - - void MyTest() - { - ControllerTester tester = new ControllerTester(); - - MyController controller = new MyController(); - IHttpResponse response; - string text = Get(controller, "/my/hello/1?hello=world", out response, null); - Assert.Equal("world|1", text); - } - - - - - - Send a POST request to a controller. - - Controller receiving the post request. - Uri visited. - Form being processed by controller. - Response from the controller. - Session used during the test. null = is used. - body posted by the response object - - - void MyTest() - { - // Create a controller. - MyController controller = new MyController(); - - // build up a form that is used by the controller. - HttpForm form = new HttpForm(); - form.Add("user[firstName]", "Jonas"); - - // Invoke the request - ControllerTester tester = new ControllerTester(); - IHttpResponse response; - string text = tester.Get(controller, "/user/create/", form, out response, null); - - // validate response back from controller. - Assert.Equal("User 'Jonas' has been created.", text); - } - - - + - Invoked when a client have been accepted by the + Gets or sets number of bytes from that should be parsed. - - Can be used to revoke incoming connections - - + - Initializes a new instance of the class. + Gets or sets offset in buffer where to start processing. - The socket. - + - Client may not be handled. + The website module let's you handle multiple websites in the same server. + It uses the "Host" header to check which site you want. + It's recommended that you do not + add any other modules to HttpServer if you are using the website module. Instead, + add all wanted modules to each website. - + - Accepted socket. + + domain name that should be handled. + - + - Client should be revoked. + Method that process the url + Information sent by the browser about the request + Information that is being sent back to the client. + Session used to - + - cookie being sent back to the browser. + Name of site. - - + - cookie sent by the client/browser + Helpers making it easier to work with forms. - + - + - Constructor. + Used to let the website use different JavaScript libraries. + Default is - cookie identifier - cookie content - id or content is null - id is empty - + - Gets the cookie HTML representation. + Create a <form> tag. - cookie string + name of form + action to invoke on submit + form should be posted as Ajax + HTML code + + + // without options + WebHelper.FormStart("frmLogin", "/user/login", Request.IsAjax); + + // with options + WebHelper.FormStart("frmLogin", "/user/login", Request.IsAjax, "style", "display:inline", "class", "greenForm"); + + + HTML attributes or JavaScript options. + Method will ALWAYS be POST. + options must consist of name, value, name, value - + - Gets the cookie identifier. + Creates a select list with the values in a collection. + Name of the SELECT-tag + collection used to generate options. + delegate used to return id and title from objects. + value that should be marked as selected. + First row should contain an empty value. + string containing a SELECT-tag. + - + - Cookie value. Set to null to remove cookie. + Creates a select list with the values in a collection. + Name of the SELECT-tag + Id of the SELECT-tag + collection used to generate options. + delegate used to return id and title from objects. + value that should be marked as selected. + First row should contain an empty value. + string containing a SELECT-tag. + + + + // Class that is going to be used in a SELECT-tag. + public class User + { + private readonly string _realName; + private readonly int _id; + public User(int id, string realName) + { + _id = id; + _realName = realName; + } + public string RealName + { + get { return _realName; } + } + + public int Id + { + get { return _id; } + } + } + + // Using an inline delegate to generate the select list + public void UserInlineDelegate() + { + List<User> items = new List<User>(); + items.Add(new User(1, "adam")); + items.Add(new User(2, "bertial")); + items.Add(new User(3, "david")); + string htmlSelect = Select("users", "users", items, delegate(object o, out object id, out object value) + { + User user = (User)o; + id = user.Id; + value = user.RealName; + }, 2, true); + } + + // Using an method as delegate to generate the select list. + public void UseExternalDelegate() + { + List<User> items = new List<User>(); + items.Add(new User(1, "adam")); + items.Add(new User(2, "bertial")); + items.Add(new User(3, "david")); + string htmlSelect = Select("users", "users", items, UserOptions, 1, true); + } + + // delegate returning id and title + public static void UserOptions(object o, out object id, out object title) + { + User user = (User)o; + id = user.Id; + value = user.RealName; + } + + + name, id, collection or getIdTitle is null. - + - Constructor. + Creates a select list with the values in a collection. - cookie identifier - cookie content - cookie expiration date. Use DateTime.MinValue for session cookie. - id or content is null - id is empty + Name of the SELECT-tag + Id of the SELECT-tag + collection used to generate options. + delegate used to return id and title from objects. + value that should be marked as selected. + First row should contain an empty value. + name, value collection of extra HTML attributes. + string containing a SELECT-tag. + + name, id, collection or getIdTitle is null. + Invalid HTML attribute list. - + - Create a new cookie + Generate a list of HTML options - name identifying the cookie - cookie value - when the cookie expires. Setting DateTime.MinValue will delete the cookie when the session is closed. - Path to where the cookie is valid - Domain that the cookie is valid for. + collection used to generate options. + delegate used to return id and title from objects. + value that should be marked as selected. + First row should contain an empty value. + + collection or getIdTitle is null. - + + sb is null. + + - Create a new cookie + Creates a check box. - Name and value will be used - when the cookie expires. + element name + element value + determines if the check box is selected or not. This is done differently depending on the + type of variable. A boolean simply triggers checked or not, all other types are compared with "value" to determine if + the box is checked or not. + a list with additional attributes (name, value, name, value). + a generated radio button - + - Gets the cookie HTML representation. + Creates a check box. - cookie string + element name + element id + element value + determines if the check box is selected or not. This is done differently depending on the + type of variable. A boolean simply triggers checked or not, all other types are compared with "value" to determine if + the box is checked or not. + a list with additional attributes (name, value, name, value). + a generated radio button + + value in your business object. (check box will be selected if it matches the element value) + - + - When the cookie expires. - DateTime.MinValue means that the cookie expires when the session do so. + Creates a check box. + element name + element id + determines if the check box is selected or not. This is done differently depending on the + type of variable. A boolean simply triggers checked or not, all other types are compared with "value" to determine if + the box is checked or not. + a list with additional attributes (name, value, name, value). + a generated radio button + will set value to "1". - + - Cookie is only valid under this path. + Creates a RadioButton. + element name + element value + determines if the radio button is selected or not. This is done differently depending on the + type of variable. A boolean simply triggers checked or not, all other types are compared with "value" to determine if + the box is checked or not. + a list with additional attributes (name, value, name, value). + a generated radio button - + - Interface for dynamically generated templates. + Creates a RadioButton. - + element name + element id + element value + determines if the radio button is selected or not. This is done differently depending on the + type of variable. A boolean simply triggers checked or not, all other types are compared with "value" to determine if + the box is checked or not. + a list with additional attributes (name, value, name, value). + a generated radio button - + - Run the template to generate HTML code. + form close tag - arguments passed to the template - template manager (a manager is used to generate templates) - HTML code. + - + - Contains information on where in the template the error occurred, and what the error was. + The server understood the request, but is refusing to fulfill it. + Authorization will not help and the request SHOULD NOT be repeated. + If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, + it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information + available to the client, the status code 404 (Not Found) can be used instead. + + Text taken from: http://www.submissionchamber.com/help-guides/error-codes.php - + - Initializes a new instance of the class. + Initializes a new instance of the class. - Line that the error appeared on. - error description. + error message - + - Initializes a new instance of the class. + Lists content type mime types. - Line that the error appeared on. - error description. - line contents. - + - Returns the actual line where the error originated + text/plain - + - Line number in template + text/haml - - - The ’-’ character makes the text following it into “silent” code: C# code that is evaluated, but not output. - It is not recommended that you use this widely; almost all processing code and logic should be restricted to the Controller, Helpers, or partials. - - For example - - - string foo = "hello" - - foo += " there" - - foo += " you!" - %p= foo - - - Is compiled to - -

- hello there you! -

-
-
-
- + - determines if this node can handle the line (by checking the first word); + content type for javascript documents = application/javascript - Controller char (word) - true if text belongs to this node type - first node on line + + + RFC 4329 states that text/javascript have been superseeded by + application/javascript. You might still want to check browser versions + since older ones do not support application/javascript. + + Browser support: http://krijnhoetmer.nl/stuff/javascript/mime-types/ + - + - Parse node contents add return a fresh node. + text/xml - List containing all node types - Node that this is a subnode to. Can be null - Line to parse - Where to start the parsing. Should be set to where the next node should start parsing. - A node corresponding to the bla bla; null if parsing failed. - - + - Convert the node to c# code + A list of content types - True if we are inside the internal stringbuilder - true if all subnodes fit on one line - smallEnough is a default value, recalc it - c# code - + - Convert node to HTML (with ASP-tags) + - HTML string + Semicolon separated content types. - + - The compiler is responsible of creating a render object which can be - cached and used over and over again. + Returns an enumerator that iterates through a collection. - - + + An object that can be used to iterate through the collection. + - + - Base c# code for a template object. + Searches for the specified type + Can also be a part of a type (searching for "xml" would return true for "application/xml"). + true if type was found. - + - Create a new template compiler + Get this first content type. - + - Adds the specified type. + Fetch a content type - The type. + Part of type ("xml" would return "application/xml") + + All content types are in lower case. - + - Compiles the specified args. + A reverse proxy are used to act as a bridge between local (protected/hidden) websites + and public clients. + + A typical usage is to allow web servers on non standard ports to still be available + to the public clients, or allow web servers on private ips to be available. - Arguments, should contain "name, value, name, value" etc. - c# code that will be included in the generated template class - Id of the template class - Tiny template if successful; otherwise null. - If compilation fails - If args are incorrect - + - Response that is sent back to the web browser / client. - - A response can be sent if different ways. The easiest one is - to just fill the Body stream with content, everything else - will then be taken care of by the framework. The default content-type - is text/html, you should change it if you send anything else. - The second and slighty more complex way is to send the response - as parts. Start with sending the header using the SendHeaders method and - then you can send the body using SendBody method, but do not forget - to set ContentType and ContentLength before doing so. + Base url requested from browser + Base url on private web server - public void MyHandler(IHttpRequest request, IHttpResponse response) - { - - } + // this will return contents from http://192.168.1.128/view/jonas when client requests http://www.gauffin.com/user/view/jonas + _server.Add(new ReverseProxyModule("http://www.gauffin.com/user/", "http://192.168.1.128/"); - todo: add two examples, using SendHeaders/SendBody and just the Body stream. - - - - Initializes a new instance of the class. - - The context. - The request. - + - Add another header to the document. + Method that determines if an url should be handled or not by the module - Name of the header, case sensitive, use lower cases. - Header values can span over multiple lines as long as each line starts with a white space. New line chars should be \r\n - If headers already been sent. - If value conditions have not been met. - Adding any header will override the default ones and those specified by properties. + Url requested by the client. + true if module should handle the url. - + - Send headers and body to the browser. + Method that process the url - If content have already been sent. + Information sent by the browser about the request + Information that is being sent back to the client. + Session used to - + - Make sure that you have specified ContentLength and sent the headers first. + Contains a connection to a browser/client. - - If headers have not been sent. - - offest of first byte to send - number of bytes to send. - - - This method can be used if you want to send body contents without caching them first. This - is recommended for larger files to keep the memory usage low. + + Remember to after you have hooked the event. + + TODO: Maybe this class should be broken up into HttpClientChannel and HttpClientContext? - + - Make sure that you have specified ContentLength and sent the headers first. + Initializes a new instance of the class. - - If headers have not been sent. - - - - This method can be used if you want to send body contents without caching them first. This - is recommended for larger files to keep the memory usage low. + true if the connection is secured (SSL/TLS) + client that connected. + Stream used for communication + Used to create a . + Size of buffer to use when reading data. Must be at least 1024 bytes. + If fails + Stream must be writable and readable. - + - Send headers to the client. + Process incoming body bytes. - If headers already been sent. - - - + + Bytes - + - Redirect client to somewhere else using the 302 status code. + - Destination of the redirect - If headers already been sent. - You can not do anything more with the request when a redirect have been done. This should be your last - action. + + - + - redirect to somewhere + Start reading content. - where the redirect should go - No body are allowed when doing redirects. + Make sure to call base.Start() if you override this method. - - - The body stream is used to cache the body contents - before sending everything to the client. It's the simplest - way to serve documents. - - - + - The chunked encoding modifies the body of a message in order to - transfer it as a series of chunks, each with its own size indicator, - followed by an OPTIONAL trailer containing entity-header fields. This - allows dynamically produced content to be transferred along with the - information necessary for the recipient to verify that it has - received the full message. + Clean up context. + + Make sure to call base.Cleanup() if you override the method. + - + - Kind of connection + Disconnect from client + error to report in the event. - - - Encoding to use when sending stuff to the client. - - Default is UTF8 + + BadRequestException. - + - Number of seconds to keep connection alive + Send a response. - Only used if Connection property is set to ConnectionType.KeepAlive + Either or + HTTP status code + reason for the status code. + HTML body contents, can be null or empty. + A content type to return the body as, i.e. 'text/html' or 'text/plain', defaults to 'text/html' if null or empty + If is invalid. - + - Status code that is sent to the client. + Send a response. - Default is HttpStatusCode.Ok + Either or + HTTP status code + reason for the status code. - + - Information about why a specific status code was used. + Send a response. + - + - Size of the body. MUST be specified before sending the header, - unless property Chunked is set to true. + send a whole buffer + buffer to send + - + - Kind of content in the body + Send data using the stream - Default is text/html + Contains data to send + Start position in buffer + number of bytes to send + + - + - Headers have been sent to the client- + This context have been cleaned, which means that it can be reused. - You can not send any additional headers if they have already been sent. - + - The whole response have been sent. + Context have been started (a new client have connected) - + - Cookies that should be created/changed. + Overload to specify own type. + + Must be specified before the context is being used. + - + - A reverse proxy are used to act as a bridge between local (protected/hidden) websites - and public clients. - - A typical usage is to allow web servers on non standard ports to still be available - to the public clients, or allow web servers on private ips to be available. + Using SSL or other encryption method. - + - - - Base url requested from browser - Base url on private web server - - // this will return contents from http://192.168.1.128/view/jonas when client requests http://www.gauffin.com/user/view/jonas - _server.Add(new ReverseProxyModule("http://www.gauffin.com/user/", "http://192.168.1.128/"); - + Using SSL or other encryption method. +
- + - Method that determines if an url should be handled or not by the module + Specify which logger to use. - Url requested by the client. - true if module should handle the url. - + - Method that process the url + Gets or sets the network stream. - Information sent by the browser about the request - Information that is being sent back to the client. - Session used to - - Container for posted form data + + + Gets or sets IP address that the client connected from. + - - Instance to help mark a non-initialized form + + + Gets or sets port that the client connected from. + - - Initializes a form container with the specified name + + + The context have been disconnected. + + + Event can be used to clean up a context, or to reuse it. + - + - Makes a deep copy of the input + A request have been received in the context. - The input to copy - + - Adds a file to the collection of posted files + Helpers to make XML handling easier - The file to add - If the file is already added - If file is null - If the instance is HttpForm.EmptyForm which cannot be modified - + - Checks if the form contains a specified file + Serializes object to XML. - Field name of the file parameter - True if the file exists - If the instance is HttpForm.EmptyForm which cannot be modified + object to serialize. + XML + + Removes name spaces and adds indentation + - + - Retrieves a file held by by the form + Create an object from a XML string - The identifier of the file - The requested file or null if the file was not found - If name is null or empty - If the instance is HttpForm.EmptyForm which cannot be modified + Type of object + XML string + object - - Disposes all held HttpFile's and resets values + + + Class to make dynamic binding of redirects. Instead of having to specify a number of similar redirect rules + a regular expression can be used to identify redirect URLs and their targets. + + + [a-z0-9]+)", "/users/${target}?find=true", RegexOptions.IgnoreCase) + ]]> + - + - The server encountered an unexpected condition which prevented it from fulfilling the request. + Initializes a new instance of the class. + Expression to match URL + Expression to generate URL + + [a-zA-Z0-9]+)", "/user/${first}")); + Result of ie. /employee1 will then be /user/employee1 + ]]> + - + - Initializes a new instance of the class. + Initializes a new instance of the class. + Expression to match URL + Expression to generate URL + Regular expression options to use, can be null + + [a-zA-Z0-9]+)", "/user/{first}", RegexOptions.IgnoreCase)); + Result of ie. /employee1 will then be /user/employee1 + ]]> + - + - Initializes a new instance of the class. + Initializes a new instance of the class. - error message. + Expression to match URL + Expression to generate URL + Regular expression options to apply + true if request should be redirected, false if the request URI should be replaced. + + [a-zA-Z0-9]+)", "/user/${first}", RegexOptions.None)); + Result of ie. /employee1 will then be /user/employee1 + ]]> + + Argument is null. + - + - Initializes a new instance of the class. + Process the incoming request. - error message. - inner exception. + incoming HTTP request + outgoing HTTP response + true if response should be sent to the browser directly (no other rules or modules will be processed). + + returning true means that no modules will get the request. Returning true is typically being done + for redirects. + + If request or response is null - + - This attribute tells the controller that the method - uses SendHeader and/or SendBody to handle the request. + Parses a HTTP request directly from a stream - + - Contains line text and state information about a line in a HAML template. + Create a new request parser + delegate receiving log entries. - + - Initializes a new instance of the class. + Add a number of bytes to the body - The line number. - The unparsed data (line contents). + buffer containing more body bytes. + starting offset in buffer + number of bytes, from offset, to read. + offset to continue from. - + - Will check that all rule conditions have been met. - Will also remove the rules if they are done. + Remove all state information for the request. - - - + - Append another line + Parse request line - + + If line is incorrect + Expects the following format: "Method SP Request-URI SP HTTP-Version CRLF" - + - Parsed line contents (without whitespaces in the beginning) + We've parsed a new header. - text contents + Name in lower case + Value, unmodified. + If content length cannot be parsed. - + - Set intendation info to previously added line text. + Parse a message - - + bytes to parse. + where in buffer that parsing should start + number of bytes to parse, starting on . + offset (where to start parsing next). + BadRequestException. - + - Assign line text + Gets or sets the log writer. - - - - + - + Current state in parser. - - If extra lines have been added. - + - If the next line should be appended to us (multi line) + A request have been successfully parsed. - + - Do NOT add yourself using the Add methods of the linkedList. - Parent property will add node. + More body bytes have been received. - + - Untouched line text + Request line have been received. - + - Has one or more children (intented more that this one) + A header have been received. - + - Number of intends (two spaces = 1, one tab = 1) + Priority for log entries + - + - Line number + Very detailed logs to be able to follow the flow of the program. - + - Parent node (one level up in intendation) + Logs to help debug errors in the application - + - All line data generated on one line + Information to be able to keep track of state changes etc. - + - IRule have not got all needed information yet, - keep appending lines to this LineInfo until rule says that it's done. + Something did not go as we expected, but it's no problem. - + - Number of whitespaces before actual entry beings. + Something that should not fail failed, but we can still keep + on going. - + - True if node is selfclosed (i.e. <br />) + Something failed, and we cannot handle it properly. - + - Parse node contents add return a fresh node. + Interface used to write to log files. - List containing all node types - Node that this is a subnode to. Can be null - Line to parse - Where to start the parsing. Should be set to where the next node should start parsing. - A node corresponding to the bla bla; null if parsing failed. - - + - determines if this node can handle the line (by checking the first word); + Write an entry to the log file. - Controller char (word) - true if text belongs to this node type - First node on line, used since some nodes cannot exist on their own on a line. + object that is writing to the log + importance of the log message + the message - + - Convert node to HTML (with ASP-tags) + This class writes to the console. It colors the output depending on the logprio and includes a 3-level stacktrace (in debug mode) - HTML string - + - + - Convert the node to c# code + The actual instance of this class. - True if we are inside the internal stringbuilder - true if all subnodes fit on one line - smallEnough is a default value, recalc it - c# code - + - Text nodes should be added as child. + Logwriters the specified source. + object that wrote the logentry. + Importance of the log message + The message. - + - Used to inform http server that + Get color for the specified logprio + prio for the log entry + A for the prio - + - Eventarguments used when an exception is thrown by a module + Default log writer, writes everything to null (nowhere). - the exception + - + - Exception thrown in a module + The logging instance. - + - View controllers integrates the templates, by adding - Render methods. + Writes everything to null + object that wrote the log entry. + Importance of the log message + The message. - + - Create a new . + Returns item either from a form or a query string (checks them in that order) - + + Representation of a non-initialized HttpParam + + + Initialises the class to hold a value either from a post request or a querystring request + + - Create a new . + The add method is not availible for HttpParam + since HttpParam checks both Request.Form and Request.QueryString - prototype to copy information from. + name identifying the value + value to add + - + - Render template for the currently invoked method. + Checks whether the form or querystring has the specified value - arguments/parameters used in template - template generated content - calls RenderActionWithErrors + Name, case sensitive + true if found; otherwise false. - + - Render contents into a template. + Returns an enumerator that iterates through the collection. - method/template to generate - arguments/parameters used in template - template generated content - calls RenderActionWithErrors. + + + A that can be used to iterate through the collection. + + 1 - + - Merge arguments array and Arguments property. + Returns an enumerator that iterates through a collection. - Arguments array to merge - arguments/parameters that can be used in the template. - Will add Request/Response/Session arguments + + + An object that can be used to iterate through the collection. + + 2 - + - Renders errors from the property into the - current method template, or as a JavaScript alert if the request is Ajax. + Fetch an item from the form or querystring (in that order). - name of the currently invoked method. - arguments used in the method template. - generated string - Creates a JavaScript Alert box if request is Ajax. + + Item if found; otherwise HttpInputItem.EmptyLanguageNode - + - Renders errors from the property into the - current method template, or as a JavaScript alert if the request is Ajax. + Container class for posted files - A collection of errors. - name of the currently invoked method. - arguments used in the method template. - generated string - Creates a JavaScript Alert box if request is Ajax. - + - Switches content-type to "text/JavaScript" and returns content. + Creates a container for a posted file - JavaScript to send to the client. - JavaScript + The identifier of the post field + The file path + The content type of the file + The name of the file uploaded + If any parameter is null or empty - + - Creates a JavaScript "alert" filled with all errors. + Creates a container for a posted file - - a + If any parameter is null or empty - + + Destructor disposing the file + + - renders one of the layouts + Deletes the temporary file - layout to render (should be found in the "views\\layouts" folder). - contents will be put in the template variable called "text". - generated text/HTML. + True if manual dispose - + - Render a template. + Disposing interface, cleans up managed resources (the temporary file) and suppresses finalization - Merges the Arguments property with the args parameter and pass those to the template. - controller name are used as a folder name when looking for the template. - method are used as filename when looking for the template. - arguments that should be passed to the template. - - + - Invoked each time a new request is about to be invoked. + The name/id of the file - Can be used to clear old data. - - - - + - Arguments that are being used in the templates. + The full file path - + - A set of errors that occurred during request processing. - Key should be argument name (if argument error, otherwise ), value should be - the error message. + The name of the uploaded file - Errors can be rendered into templates using the method. - - + - True if we always should render contents inside page layouts when request is Ajax. + The type of file - default is false. - + - Which page layout to use (without file extension) + Used to create and reuse contexts. - - - Page layouts should be places in the Views\Layouts folder. - - - default is "Application" - - - + - Page title (are added as a parameter to the layout template, use it in <title> HTML tag. + Used to create es. - + - Arguments sent when a is cleared + Creates a that handles a connected client. + Client socket (accepted by the ). + A creates . - + - Instantiates the arguments for the event + Create a secure . - True if the session is cleared due to expiration + Client socket (accepted by the ). + HTTPS certificate to use. + Kind of HTTPS protocol. Usually TLS or SSL. + A created . - + - Returns true if the session is cleared due to expiration + A request have been received from one of the contexts. - + - Delegate for when a IHttpSession is cleared + Initializes a new instance of the class. - this is being cleared. - Arguments for the clearing + The writer. + Amount of bytes to read from the incoming socket stream. + Used to create a request parser. - + - Parse node contents add return a fresh node. + Create a new context. - List containing all node types - Node that this is a subnode to. Can be null - Line to parse - Where to start the parsing. Should be set to where the next node should start parsing. - A node corresponding to the bla bla; null if parsing failed. - + true if socket is running HTTPS. + Client that connected + Network/SSL stream. + A context. - + - determines if this node can handle the line (by checking the first word); + Create a new context. - Controller char (word) - true if text belongs to this node type - first node on line + true if HTTPS is used. + Remote client + Network stream, uses . + A new context (always). - + - Convert node to HTML (with ASP-tags) + Create a secure . - HTML string + Client socket (accepted by the ). + HTTPS certificate to use. + Kind of HTTPS protocol. Usually TLS or SSL. + + A created . + - + - Convert the node to c# code + Creates a that handles a connected client. - True if we are inside the internal stringbuilder - true if all subnodes fit on one line - smallEnough is a default value, recalc it - c# code + Client socket (accepted by the ). + + A creates . + - - - A list of prototype nodes. + + + True if detailed trace logs should be written. + + + + + A request have been received from one of the contexts. - + - Creates the node. + Custom network stream to mark sockets as reusable when disposing the stream. - node identifier. - parent node. - created node if identifier was found; otherwise null. - + - + Creates a new instance of the class for the specified . - - first node on line - + + The that the will use to send and receive data. + + + The parameter is null. + + + The parameter is not connected. + -or- + The property of the parameter is not . + -or- + The parameter is in a nonblocking state. + - + - Add a prototype + Initializes a new instance of the class for the specified with the specified ownership. - prototype node + + The that the will use to send and receive data. + + + Set to true to indicate that the will take ownership of the ; otherwise, false. + + + The parameter is null. + + + The parameter is not connected. + -or- + the value of the property of the parameter is not . + -or- + the parameter is in a nonblocking state. + - + - The purpose of this module is to serve files. + Creates a new instance of the class for the specified with the specified access rights. + + The that the will use to send and receive data. + + + A bitwise combination of the values that specify the type of access given to the over the provided . + + + The parameter is null. + + + The parameter is not connected. + -or- + the property of the parameter is not . + -or- + the parameter is in a nonblocking state. + - + - Initializes a new instance of the class. + Creates a new instance of the class for the specified with the specified access rights and the specified ownership. - Uri to serve, for instance "/files/" - Path on hard drive where we should start looking for files - If true a Last-Modifed header will be sent upon requests urging webbrowser to cache files + + The that the will use to send and receive data. + + + A bitwise combination of the values that specifies the type of access given to the over the provided . + + + Set to true to indicate that the will take ownership of the ; otherwise, false. + + + The parameter is null. + + + The parameter is not connected. + -or- + The property of the parameter is not . + -or- + The parameter is in a nonblocking state. + - + - Initializes a new instance of the class. - - Uri to serve, for instance "/files/" - Path on hard drive where we should start looking for files + Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream. + - + + + Releases the unmanaged resources used by the and optionally releases the managed resources. + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + - Mimtypes that this class can handle per default + + + http://www.faqs.org/rfcs/rfc1867.html + - + - Determines if the request should be handled by this module. - Invoked by the HttpServer + multipart/form-data - - true if this module should handle it. - + - check if source contains any of the chars. + form-data - - - - + - Method that process the url + - Information sent by the browser about the request - Information that is being sent back to the client. - Session used to + Stream containing the content + Content type (with any additional info like boundry). Content type is always supplied in lower case + Stream enconding + A http form, or null if content could not be parsed. + If contents in the stream is not valid input data. + If any parameter is null - + - return a file extension from an absolute uri path (or plain filename) + Checks if the decoder can handle the mime type - - + Content type (with any additional info like boundry). Content type is always supplied in lower case. + True if the decoder can parse the specified content type - + - List with all mime-type that are allowed. + A session stored in memory. - All other mime types will result in a Forbidden http status code. - + - characters that may not exist in a path. + - - fileMod.ForbiddenChars = new string[]{ "\\", "..", ":" }; - + A unique id used by the sessions store to identify the session - + - Generic helper functions for Http + Id + - + - Version string for HTTP v1.0 + Remove everything from the session - + - Version string for HTTP v1.1 + Clears the specified expire. + True if the session is cleared due to expiration - + - An empty url + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + 2 - + - Parses a querystring. + Session id - Querystring (url decoded) - A HttpInput object if successful; otherwise HttpInput.Empty - + - The server understood the request, but is refusing to fulfill it. - Authorization will not help and the request SHOULD NOT be repeated. - If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, - it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information - available to the client, the status code 404 (Not Found) can be used instead. - - Text taken from: http://www.submissionchamber.com/help-guides/error-codes.php + Should + Name of the session variable + null if it's not set - + - Initializes a new instance of the class. + when the session was last accessed. - error message + + Used to determine when the session should be removed. + - + - Delegate used to let authentication modules authenticate the username and password. + Number of values in the session - Realm that the user want to authenticate in - Username specified by client - Password supplied by the delagete - object that will be stored in a session variable called if authentication was successful. - throw forbidden exception if too many attempts have been made. - + - Let's you decide on a system level if authentication is requried. - You can also decide if authentication is required in each HttpModule. + Flag to indicate that the session have been changed + and should be saved into the session store. - Http request from client - true if user should be authenticated. - throw ForbiddenException if no more attempts are allowed. - If no more attempts are allowed - + - Represents a html class node. + Event triggered upon clearing the session - + - Parse node contents add return a fresh node. + Cookies that should be set. - List containing all node types - Node that this is a subnode to. Can be null - Line to parse - Where to start the parsing. Should be set to where the next node should start parsing. - A node corresponding to the bla bla; null if parsing failed. - - + - determines if this node can handle the line (by checking the first word); + Adds a cookie in the collection. - Controller char (word) - true if text belongs to this node type - first node on line + cookie to add + cookie is null - + - Convert node to HTML (with ASP-tags) + Copy a request cookie - HTML string + + When the cookie should expire - + - Convert the node to c# code + Gets a collection enumerator on the cookie list. - True if we are inside the internal stringbuilder - true if all subnodes fit on one line - smallEnough is a default value, recalc it - c# code + collection enumerator - + - + Remove all cookies - - http://www.faqs.org/rfcs/rfc1867.html - - + - multipart/form-data + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + 1 - + - form-data + Gets the count of cookies in the collection. - + - + Gets the cookie of a given identifier (null if not existing). - Stream containing the content - Content type (with any additional info like boundry). Content type is always supplied in lower case - Stream enconding - A http form, or null if content could not be parsed. - If contents in the stream is not valid input data. - If any parameter is null - + - Checks if the decoder can handle the mime type + Creates request parsers when needed. - Content type (with any additional info like boundry). Content type is always supplied in lower case. - True if the decoder can parse the specified content type - + - + Creates request parsers when needed. - - - - - - Represents a field in a multipart form - + - Lists content type mime types. + Create a new request parser. + Used when logging should be enabled. + A new request parser. - + - text/plain + Create a new request parser. + Used when logging should be enabled. + A new request parser. - + - text/haml + Add a component instance + Interface type + Instance to add - + - content type for javascript documents = application/javascript + Get a component. + Interface type + Component if registered, otherwise null. - - RFC 4329 states that text/javascript have been superseeded by - application/javascript. You might still want to check browser versions - since older ones do not support application/javascript. - - Browser support: http://krijnhoetmer.nl/stuff/javascript/mime-types/ + Component will get created if needed. - - - text/xml - + + If instance cannot be created. - + - A list of content types + Checks if the specified component interface have been added. + + true if found; otherwise false. - + - + Add a component. - Semicolon separated content types. + Type being requested. + Type being created. + Type have already been mapped. - + - Returns an enumerator that iterates through a collection. + The request requires user authentication. The response MUST include a + WWW-Authenticate header field (section 14.47) containing a challenge + applicable to the requested resource. + + The client MAY repeat the request with a suitable Authorization header + field (section 14.8). If the request already included Authorization + credentials, then the 401 response indicates that authorization has been + refused for those credentials. If the 401 response contains the same challenge + as the prior response, and the user agent has already attempted authentication + at least once, then the user SHOULD be presented the entity that was given in the response, + since that entity might include relevant diagnostic information. + + HTTP access authentication is explained in rfc2617: + http://www.ietf.org/rfc/rfc2617.txt + + (description is taken from + http://www.submissionchamber.com/help-guides/error-codes.php#sec10.4.2) - - An object that can be used to iterate through the collection. - - + - Searches for the specified type + Create a new unauhtorized exception. - Can also be a part of a type (searching for "xml" would return true for "application/xml"). - true if type was found. + - + - Get this first content type. + Create a new unauhtorized exception. + reason to why the request was unauthorized. + inner exception - + - Fetch a content type + Create a new unauhtorized exception. - Part of type ("xml" would return "application/xml") - - All content types are in lower case. + reason to why the request was unauthorized.
-- cgit v1.1