Last change
on this file since 370 was 367, checked in by alloc, 3 years ago |
Web:
- Added SSE (ServerSentEvents) subsystem
- Added log endpoint to SSE. Less heavy weight and more responsive way of watching the server log
- Bunch of refactoring
|
File size:
1.0 KB
|
Rev | Line | |
---|
[230] | 1 | using System.Net;
|
---|
| 2 |
|
---|
[325] | 3 | namespace AllocsFixes.NetConnections.Servers.Web.Handlers {
|
---|
| 4 | public abstract class PathHandler {
|
---|
[367] | 5 | protected readonly string moduleName;
|
---|
| 6 | protected string urlBasePath;
|
---|
| 7 | protected Web parent;
|
---|
[244] | 8 |
|
---|
[279] | 9 | protected PathHandler (string _moduleName, int _defaultPermissionLevel = 0) {
|
---|
[325] | 10 | moduleName = _moduleName;
|
---|
[279] | 11 | WebPermissions.Instance.AddKnownModule (_moduleName, _defaultPermissionLevel);
|
---|
[244] | 12 | }
|
---|
| 13 |
|
---|
[325] | 14 | public string ModuleName {
|
---|
| 15 | get { return moduleName; }
|
---|
| 16 | }
|
---|
[244] | 17 |
|
---|
[351] | 18 | public abstract void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user,
|
---|
| 19 | int _permissionLevel);
|
---|
[325] | 20 |
|
---|
[351] | 21 | public bool IsAuthorizedForHandler (WebConnection _user, int _permissionLevel) {
|
---|
[244] | 22 | if (moduleName != null) {
|
---|
[351] | 23 | return WebPermissions.Instance.ModuleAllowedWithLevel (moduleName, _permissionLevel);
|
---|
[244] | 24 | }
|
---|
[325] | 25 |
|
---|
| 26 | return true;
|
---|
[244] | 27 | }
|
---|
[367] | 28 |
|
---|
| 29 | public virtual void Shutdown () {
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | public virtual void SetBasePathAndParent (Web _parent, string _relativePath) {
|
---|
| 33 | parent = _parent;
|
---|
| 34 | urlBasePath = _relativePath;
|
---|
| 35 | }
|
---|
[230] | 36 | }
|
---|
[325] | 37 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.