/// <summary> /// Defines a default page to show for GET requests with a given error code /// </summary> /// <param name="code">status code</param> /// <param name="factory">handler that creates page</param> public void SetDefaultPage(HttpStatusCode code, Func <IPage> factory) { _map.Remove(code); var page = new PagePublished(factory); _map.Add(code, page); }
internal void PublishErrorPage() { const string address = ServerLauncher.ErrorAddress; var page = new PagePublished(DefaultServerError, HttpStatusCode.InternalServerError); _published.Publish(address, page); var combined = Published.CombinePathMethod(address, "POST"); _published.Publish(combined, page); }
internal bool TryGetPage(HttpStatusCode code, out PagePublished page) { return(_map.TryGetValue(code, out page) || _defaults.TryGetValue(code, out page)); }