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