DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
WebAppServer.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include "Common.h"
7#include "System/Object.h"
8#include "System/String.h"
11
12namespace DotNetDupe {
13 namespace WebAppCore {
14 namespace Server {
15
25 public:
31
33 DOTNETDUPE_API ~WebAppServer() override = default;
34
35 WebAppServer(const WebAppServer&) = delete;
37
41
46
49 DOTNETDUPE_API void SetWebRoot(const DotNetDupe::System::String& webRoot) { m_sWebRoot = webRoot; }
50
54
57 DOTNETDUPE_API void EnableStaticFiles(const DotNetDupe::System::String& defaultDocument = "index.html");
58
62 DOTNETDUPE_API void Run(const DotNetDupe::System::String& url = "http://localhost:8080/index.html", int threadCount = 10);
63
65 DOTNETDUPE_API void Stop();
66
71
72 private:
75 DotNetDupe::System::String m_sDefaultDocument;
76 bool m_bStaticFilesEnabled;
77 };
78
79 }
80 }
81}
Defines common cross-platform macros, export decorators, and fundamental types.
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition Common.h:20
Base object class for DotNetDupe mirroring .NET System.Object.
Provides reference-counted and weak pointer memory management primitives ensuring zero raw ownership.
High-performance UTF-8 / UTF-16 string manipulation class mirroring .NET System.String.
Represents the web application used to configure the HTTP pipeline and routes mirroring ASP....
Supports all classes in the DotNetDupe class hierarchy.
Definition Object.h:18
A unified smart pointer that supports both unique and shared ownership semantics.
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Definition String.h:74
~WebAppServer() override=default
Virtual destructor.
void SetWebRoot(const DotNetDupe::System::String &webRoot)
Sets the local filesystem directory path from which static files are served.
WebAppServer(const DotNetDupe::System::SmartPointer< Builder::WebApplication > &app, const DotNetDupe::System::String &webRoot="wwwroot")
Constructs a WebAppServer wrapping the specified WebApplication host and web root path.
static DotNetDupe::System::String GetMimeType(const DotNetDupe::System::String &filePath)
Resolves the standard MIME content type string based on a file path extension.
WebAppServer & operator=(const WebAppServer &)=delete
void EnableStaticFiles(const DotNetDupe::System::String &defaultDocument="index.html")
Enables static file serving with the specified default document fallback.
void Stop()
Stops the running web server and active TCP listener.
WebAppServer(const WebAppServer &)=delete
DotNetDupe::System::String GetWebRoot() const
Gets the configured web root directory path.
void Run(const DotNetDupe::System::String &url="http://localhost:8080/index.html", int threadCount=10)
Starts the underlying WebApplication server listener on the specified URL and thread pool size.