Overview

Server Info

Example of Server Info

Source Code

<?pas
uses System.WebServer, Security;

CheckLocalhostAccess;
?>
<h3>WebServer Information</h3>
<ul>
  <li><b>Server Name:</b> <?pas= WebServer.Name.ToHtml ?></li>  
  <li><b>HTTP Port:</b> <?pas= if WebServer.HttpPort <> 0 then 'Active' else 'Inactive' ?></li>
  <li><b>HTTPS Port:</b> <?pas= if WebServer.HttpsPort <> 0 then 'Active' else 'Inactive' ?></li>
</ul>

<h3>Active Sessions / Queries</h3>

  <pre class="bg-body-tertiary p-3 border rounded"><?pas
  var queries := JSON.Parse(WebServer.LiveQueries);
  Print(JSON.PrettyStringify(queries).ToHtml);
  ?></pre>

<h3>Compiled Programs (Top 5)</h3>
<?pas
var programs := WebServer.CompiledPrograms;
if programs.Length > 0 then begin
  ?>
  <ul>
    <?pas
    for var i := 0 to Min(programs.Length, 5) - 1 do begin
      var progName := programs[i];
      if Pos('\', progName) > 0 then
        progName := progName.AfterLast('\');
      PrintLn(#9'<li>' + progName.ToHtml + '</li>');
    end;
    ?>
  </ul>
  <?pas
end else begin
  ?><p>No programs currently in cache.</p><?pas
end;
?>

Result

<h3>WebServer Information</h3>
<ul>
  <li><b>Server Name:</b> DWScript</li>  
  <li><b>HTTP Port:</b> Active</li>
  <li><b>HTTPS Port:</b> Inactive</li>
</ul>

<h3>Active Sessions / Queries</h3>

  <pre class="bg-body-tertiary p-3 border rounded">[
	{
		&quot;id&quot; : 3744066918,
		&quot;path&quot; : &quot;\/examples\/web_server_info_478914_tmp.dws&quot;,
		&quot;query&quot; : &quot;&quot;,
		&quot;ip&quot; : &quot;127.0.0.1&quot;,
		&quot;ms&quot; : 0,
		&quot;sleeping&quot; : false,
		&quot;options&quot; : [ ]
	},
	{
		&quot;id&quot; : 3744066861,
		&quot;path&quot; : &quot;\/test\/index.dws&quot;,
		&quot;query&quot; : &quot;action=update_examples&amp;api=1&quot;,
		&quot;ip&quot; : &quot;127.0.0.1&quot;,
		&quot;ms&quot; : 250,
		&quot;sleeping&quot; : false,
		&quot;options&quot; : [ ]
	}
]</pre>

<h3>Compiled Programs (Top 5)</h3>

  <ul>
    	<li>array_statistics.dws</li>
	<li>matrix_mult.dws</li>
	<li>stdlib_math3d_vector.pas</li>
	<li>session_demo.dws</li>
	<li>oop_metaclasses.pas</li>

  </ul>
  
On this page