fix some stuff
This commit is contained in:
parent
35ea6c3cd7
commit
3569914d3f
@ -13,6 +13,7 @@ public abstract class Control : IWebHandler
|
||||
}
|
||||
|
||||
public Dictionary<string, string> PathVariables { get; } = new Dictionary<string, string>();
|
||||
public bool Visible { get; set; } = true;
|
||||
|
||||
public Control(Dictionary<string, string>? pathVariables = null)
|
||||
{
|
||||
@ -41,18 +42,26 @@ public abstract class Control : IWebHandler
|
||||
private bool _initted = false;
|
||||
protected void EnsureInitialized()
|
||||
{
|
||||
if (_initted) return;
|
||||
InitializeInternal();
|
||||
_initted = true;
|
||||
if (!_initted)
|
||||
{
|
||||
InitializeInternal();
|
||||
_initted = true;
|
||||
}
|
||||
PersistentInitializeInternal();
|
||||
}
|
||||
|
||||
protected virtual void InitializeInternal()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void PersistentInitializeInternal()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void RenderBeginTag(XmlWriter writer)
|
||||
{
|
||||
EnsureInitialized();
|
||||
|
||||
writer.WriteStartElement(TagName);
|
||||
|
||||
bool classListWritten = false;
|
||||
@ -83,6 +92,8 @@ public abstract class Control : IWebHandler
|
||||
|
||||
public void Render(XmlWriter writer)
|
||||
{
|
||||
if (!Visible) return;
|
||||
|
||||
RenderBeginTag(writer);
|
||||
RenderContents(writer);
|
||||
RenderEndTag(writer);
|
||||
@ -92,6 +103,7 @@ public abstract class Control : IWebHandler
|
||||
{
|
||||
context.Response.ContentType = "application/xhtml+xml";
|
||||
|
||||
EnsureInitialized();
|
||||
OnInit(new RenderEventArgs(context));
|
||||
|
||||
XmlWriter writer = XmlWriter.Create(context.Response.Stream);
|
||||
|
||||
@ -31,7 +31,7 @@ public class Literal : Control
|
||||
public bool UseMarkup { get; set; } = true;
|
||||
public string Content { get; set; } = String.Empty;
|
||||
|
||||
public Literal()
|
||||
public Literal()
|
||||
{
|
||||
}
|
||||
public Literal(string content)
|
||||
|
||||
@ -19,15 +19,10 @@ public class WebPage : Control
|
||||
{
|
||||
}
|
||||
|
||||
protected override string TagName => "html";
|
||||
protected override void RenderBeginTag(XmlWriter writer)
|
||||
protected override void PersistentInitializeInternal()
|
||||
{
|
||||
EnsureInitialized();
|
||||
writer.WriteStartElement(TagName, "http://www.w3.org/1999/xhtml");
|
||||
}
|
||||
|
||||
protected override void RenderContents(XmlWriter writer)
|
||||
{
|
||||
base.PersistentInitializeInternal();
|
||||
|
||||
Controls.Clear();
|
||||
CreateChildControls();
|
||||
|
||||
@ -38,7 +33,17 @@ public class WebPage : Control
|
||||
ChildControlsCreated = true;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
protected override string TagName => "html";
|
||||
protected override void RenderBeginTag(XmlWriter writer)
|
||||
{
|
||||
EnsureInitialized();
|
||||
writer.WriteStartElement(TagName, "http://www.w3.org/1999/xhtml");
|
||||
}
|
||||
|
||||
protected override void RenderContents(XmlWriter writer)
|
||||
{
|
||||
writer.WriteStartElement("head");
|
||||
writer.WriteElementString("title", "Mocha Application");
|
||||
|
||||
|
||||
@ -168,6 +168,14 @@ public class WebServer
|
||||
|
||||
string requestMethod = lineParts[0];
|
||||
string path = lineParts[1];
|
||||
if (path.Length > 1)
|
||||
{
|
||||
if (path.EndsWith("/"))
|
||||
{
|
||||
path = path.Substring(0, path.Length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
string version = lineParts[2];
|
||||
|
||||
WebHeaderCollection headers = new WebHeaderCollection();
|
||||
@ -235,7 +243,8 @@ public class WebServer
|
||||
|
||||
if (cookieValue == "")
|
||||
{
|
||||
cookieValue = "0068F5AD24A89AB4AFCC4057F619EADF.authgwy-prod-mzzygbiy.prod-ui-auth.pr502.cust.pdx.wd";
|
||||
// 0068F5AD24A89AB4AFCC4057F619EADF
|
||||
cookieValue = (Guid.NewGuid()).ToString("N").ToUpper() + ".authgwy-prod-mzzygbiy.prod-ui-auth.pr502.cust.pdx.wd";
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user