diff --git a/IISMainHandler/Extensions.cs b/IISMainHandler/Extensions.cs index bbee1f5..4fb2fe3 100644 --- a/IISMainHandler/Extensions.cs +++ b/IISMainHandler/Extensions.cs @@ -5,17 +5,17 @@ using System.Text; using System.Web; namespace FLocal.IISHandler { - static class Extensions { + static class Extensions { - public static void WriteLine(this HttpResponse response, string toWrite) { - response.Write(toWrite); - response.Write((char)0x0d); - response.Write((char)0x0a); - } + public static void WriteLine(this HttpResponse response, string toWrite) { + response.Write(toWrite); + response.Write((char)0x0d); + response.Write((char)0x0a); + } - public static string[] Split(this string str, string separator, StringSplitOptions options) { - return str.Split(new string[] { separator }, options); - } + public static string[] Split(this string str, string separator, StringSplitOptions options) { + return str.Split(new string[] { separator }, options); + } - } + } } diff --git a/IISMainHandler/HandlersFactory.cs b/IISMainHandler/HandlersFactory.cs index f96b229..0c6cb0b 100644 --- a/IISMainHandler/HandlersFactory.cs +++ b/IISMainHandler/HandlersFactory.cs @@ -5,14 +5,14 @@ using System.Text; using System.Web; namespace FLocal.IISHandler { - class HandlersFactory { + class HandlersFactory { - public static ISpecificHandler getHandler(WebContext context) { - string[] requestParts = context.httprequest.Path.Split("/", StringSplitOptions.RemoveEmptyEntries); - if(requestParts.Length < 1) return new handlers.RootHandler(); - return new handlers.DebugHandler(requestParts[0]); - //return new handlers.WrongUrlHandler(); - } + public static ISpecificHandler getHandler(WebContext context) { + string[] requestParts = context.httprequest.Path.Split("/", StringSplitOptions.RemoveEmptyEntries); + if(requestParts.Length < 1) return new handlers.RootHandler(); + return new handlers.DebugHandler(requestParts[0]); + //return new handlers.WrongUrlHandler(); + } - } + } } diff --git a/IISMainHandler/ISpecificHandler.cs b/IISMainHandler/ISpecificHandler.cs index 3621466..4937d39 100644 --- a/IISMainHandler/ISpecificHandler.cs +++ b/IISMainHandler/ISpecificHandler.cs @@ -5,9 +5,9 @@ using System.Text; using System.Web; namespace FLocal.IISHandler { - interface ISpecificHandler { + interface ISpecificHandler { - void Handle(WebContext context); + void Handle(WebContext context); - } + } } diff --git a/IISMainHandler/MainHandler.cs b/IISMainHandler/MainHandler.cs index 8b67d97..b54e77f 100644 --- a/IISMainHandler/MainHandler.cs +++ b/IISMainHandler/MainHandler.cs @@ -5,17 +5,17 @@ using System.Text; using System.Web; namespace FLocal.IISHandler { - public class MainHandler : IHttpHandler { + public class MainHandler : IHttpHandler { - public bool IsReusable { - get { return true; } - } + public bool IsReusable { + get { return true; } + } - public void ProcessRequest(HttpContext httpcontext) { - WebContext context = new WebContext(httpcontext); - ISpecificHandler handler = HandlersFactory.getHandler(context); - handler.Handle(context); - } + public void ProcessRequest(HttpContext httpcontext) { + WebContext context = new WebContext(httpcontext); + ISpecificHandler handler = HandlersFactory.getHandler(context); + handler.Handle(context); + } - } + } } diff --git a/IISMainHandler/TemplateEngine.cs b/IISMainHandler/TemplateEngine.cs index a3c9bae..341a531 100644 --- a/IISMainHandler/TemplateEngine.cs +++ b/IISMainHandler/TemplateEngine.cs @@ -5,11 +5,11 @@ using System.Text; using System.Xml.Linq; namespace FLocal.IISHandler { - class TemplateEngine { + class TemplateEngine { - public static string Compile(string pathToTemplate, XDocument data) { - throw new NotImplementedException(); - } + public static string Compile(string pathToTemplate, XDocument data) { + throw new NotImplementedException(); + } - } + } } diff --git a/IISMainHandler/WebContext.cs b/IISMainHandler/WebContext.cs index 1c6bf1b..d9497b1 100644 --- a/IISMainHandler/WebContext.cs +++ b/IISMainHandler/WebContext.cs @@ -5,36 +5,36 @@ using System.Text; using System.Web; namespace FLocal.IISHandler { - class WebContext { - - public readonly HttpContext httpcontext; - - public HttpRequest httprequest { - get { - return this.httpcontext.Request; - } - } - - public HttpResponse httpresponse { - get { - return this.httpcontext.Response; - } - } - - public designs.IDesign design { - get { - throw new NotImplementedException(); - } - } - - public WebContext(HttpContext httpcontext) { - this.httpcontext = httpcontext; - } - - public string Transform(string templateName, System.Xml.Linq.XDocument data) { - //TODO: this should work according to design! - return TemplateEngine.Compile(templateName, data); - } - - } + class WebContext { + + public readonly HttpContext httpcontext; + + public HttpRequest httprequest { + get { + return this.httpcontext.Request; + } + } + + public HttpResponse httpresponse { + get { + return this.httpcontext.Response; + } + } + + public designs.IDesign design { + get { + throw new NotImplementedException(); + } + } + + public WebContext(HttpContext httpcontext) { + this.httpcontext = httpcontext; + } + + public string Transform(string templateName, System.Xml.Linq.XDocument data) { + //TODO: this should work according to design! + return TemplateEngine.Compile(templateName, data); + } + + } } diff --git a/IISMainHandler/designs/Classic.cs b/IISMainHandler/designs/Classic.cs index de807d6..dd816e2 100644 --- a/IISMainHandler/designs/Classic.cs +++ b/IISMainHandler/designs/Classic.cs @@ -4,6 +4,6 @@ using System.Linq; using System.Text; namespace FLocal.IISHandler.designs { - class Classic : IDesign { - } + class Classic : IDesign { + } } diff --git a/IISMainHandler/designs/IDesign.cs b/IISMainHandler/designs/IDesign.cs index 642a512..6208892 100644 --- a/IISMainHandler/designs/IDesign.cs +++ b/IISMainHandler/designs/IDesign.cs @@ -4,6 +4,6 @@ using System.Linq; using System.Text; namespace FLocal.IISHandler.designs { - interface IDesign { - } + interface IDesign { + } } diff --git a/IISMainHandler/designs/Lite.cs b/IISMainHandler/designs/Lite.cs index 77232e3..0c80463 100644 --- a/IISMainHandler/designs/Lite.cs +++ b/IISMainHandler/designs/Lite.cs @@ -4,6 +4,6 @@ using System.Linq; using System.Text; namespace FLocal.IISHandler.designs { - class Lite : IDesign { - } + class Lite : IDesign { + } } diff --git a/IISMainHandler/handlers/AbstractGetHandler.cs b/IISMainHandler/handlers/AbstractGetHandler.cs index cac7e6d..e68bbf8 100644 --- a/IISMainHandler/handlers/AbstractGetHandler.cs +++ b/IISMainHandler/handlers/AbstractGetHandler.cs @@ -4,17 +4,17 @@ using System.Linq; using System.Text; namespace FLocal.IISHandler.handlers { - abstract class AbstractGetHandler : ISpecificHandler { - - abstract protected string templateName { - get; - } + abstract class AbstractGetHandler : ISpecificHandler { + + abstract protected string templateName { + get; + } - abstract protected System.Xml.Linq.XDocument getData(WebContext context); + abstract protected System.Xml.Linq.XDocument getData(WebContext context); - public void Handle(WebContext context) { - context.httpresponse.Write(context.Transform(this.templateName, this.getData(context))); - } + public void Handle(WebContext context) { + context.httpresponse.Write(context.Transform(this.templateName, this.getData(context))); + } - } + } } diff --git a/IISMainHandler/handlers/DebugHandler.cs b/IISMainHandler/handlers/DebugHandler.cs index 081aae5..03639c0 100644 --- a/IISMainHandler/handlers/DebugHandler.cs +++ b/IISMainHandler/handlers/DebugHandler.cs @@ -5,20 +5,20 @@ using System.Text; using System.Web; namespace FLocal.IISHandler.handlers { - class DebugHandler : ISpecificHandler { + class DebugHandler : ISpecificHandler { - private string type; + private string type; - public DebugHandler(string type) { - this.type = type; - } + public DebugHandler(string type) { + this.type = type; + } - public void Handle(WebContext context) { - context.httpresponse.ContentType = "text/plain"; - context.httpresponse.WriteLine("Page: " + this.type); - context.httpresponse.WriteLine("Path: " + context.httprequest.Path); - context.httpresponse.WriteLine("PathInfo: " + context.httprequest.PathInfo); - } + public void Handle(WebContext context) { + context.httpresponse.ContentType = "text/plain"; + context.httpresponse.WriteLine("Page: " + this.type); + context.httpresponse.WriteLine("Path: " + context.httprequest.Path); + context.httpresponse.WriteLine("PathInfo: " + context.httprequest.PathInfo); + } - } + } } diff --git a/IISMainHandler/handlers/RootHandler.cs b/IISMainHandler/handlers/RootHandler.cs index c451cc8..4bbf602 100644 --- a/IISMainHandler/handlers/RootHandler.cs +++ b/IISMainHandler/handlers/RootHandler.cs @@ -7,18 +7,18 @@ using System.Xml.Linq; namespace FLocal.IISHandler.handlers { - class RootHandler : AbstractGetHandler { + class RootHandler : AbstractGetHandler { - override protected string templateName { - get { - throw new NotImplementedException(); - } - } + override protected string templateName { + get { + throw new NotImplementedException(); + } + } - override protected XDocument getData(WebContext context) { - throw new NotImplementedException(); - } + override protected XDocument getData(WebContext context) { + throw new NotImplementedException(); + } - } + } } \ No newline at end of file diff --git a/IISMainHandler/handlers/WrongUrlHandler.cs b/IISMainHandler/handlers/WrongUrlHandler.cs index df5529d..df63cbf 100644 --- a/IISMainHandler/handlers/WrongUrlHandler.cs +++ b/IISMainHandler/handlers/WrongUrlHandler.cs @@ -5,11 +5,11 @@ using System.Text; using System.Web; namespace FLocal.IISHandler.handlers { - class WrongUrlHandler : ISpecificHandler { + class WrongUrlHandler : ISpecificHandler { - public void Handle(WebContext context) { - throw new HttpException(404, "page not found"); - } + public void Handle(WebContext context) { + throw new HttpException(404, "page not found"); + } - } + } }