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