| Line | |
|---|
| 1 | using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
|
|---|
| 2 | using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
|
|---|
| 3 |
|
|---|
| 4 | namespace AllocsFixes.NetConnections.Servers.Web.Handlers {
|
|---|
| 5 | public abstract class AbsHandler {
|
|---|
| 6 | protected readonly string moduleName;
|
|---|
| 7 | protected string urlBasePath;
|
|---|
| 8 | protected Web parent;
|
|---|
| 9 |
|
|---|
| 10 | public string ModuleName => moduleName;
|
|---|
| 11 | public string UrlBasePath => urlBasePath;
|
|---|
| 12 |
|
|---|
| 13 | protected AbsHandler (string _moduleName, int _defaultPermissionLevel = 0) {
|
|---|
| 14 | moduleName = _moduleName;
|
|---|
| 15 | WebPermissions.Instance.AddKnownModule (_moduleName, _defaultPermissionLevel);
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | public abstract void HandleRequest (string _requestPath, HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _con,
|
|---|
| 19 | int _permissionLevel);
|
|---|
| 20 |
|
|---|
| 21 | public virtual bool IsAuthorizedForHandler (WebConnection _user, int _permissionLevel) {
|
|---|
| 22 | return moduleName == null || WebPermissions.Instance.ModuleAllowedWithLevel (moduleName, _permissionLevel);
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | public virtual void Shutdown () {
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | public virtual void SetBasePathAndParent (Web _parent, string _relativePath) {
|
|---|
| 29 | parent = _parent;
|
|---|
| 30 | urlBasePath = _relativePath;
|
|---|
| 31 | }
|
|---|
| 32 | }
|
|---|
| 33 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.