Ejemplo n.º 1
0
 public bool ServeWebRequest(RawRequestData aRawRequest, IWebRequestResponder aResponder)
 {
     string browserClass = aRawRequest.Cookies["xappbrowser"].FirstOrDefault();
     if (String.IsNullOrEmpty(browserClass) &&
         aRawRequest.Path.PathSegments.Count == 0)
     {
         //Console.WriteLine("Serving browser discrimination page.");
         Console.WriteLine("Serve {0} with discriminator.", String.Join("/", aRawRequest.Path.PathSegments));
         aResponder.SendPage("200 OK", PageSource.MakeSourceFromString(StringType.Html, IndexPage));
         return true;
     }
     string userName = aRawRequest.Cookies["xappuser"].FirstOrDefault();
     User user = null;
     if (!String.IsNullOrEmpty(userName))
     {
         iUserList.TryGetUserById(userName, out user);
     }
     RequestData requestData = new RequestData(aRawRequest.Path, aRawRequest.Method, user, browserClass);
     if (user == null)
     {
         Console.WriteLine("Serve {0} from login app.", String.Join("/", aRawRequest.Path.PathSegments));
         return iLoginApp.ServeWebRequest(requestData, aResponder);
     }
     Console.WriteLine("Serve {0} from base app.", String.Join("/", aRawRequest.Path.PathSegments));
     return iBaseApp.ServeWebRequest(requestData, aResponder);
 }
Ejemplo n.º 2
0
 bool ServeAppHtml(RequestData aRequest, IWebRequestResponder aResponder)
 {
     //return GenerateHtml();
     aResponder.SendPage("200 OK", PageSource.MakeSourceFromString(StringType.Html, GenerateHtml()));
     return true;
     /*string browser = aRequest.BrowserClass;
     string filename = GetBrowserDiscriminationMappings()[browser];
     aResponder.SendFile(GetPath(filename));
     return true;*/
 }