Last change
on this file since 368 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
|
Line | |
---|
1 | using System.Net;
|
---|
2 |
|
---|
3 | namespace AllocsFixes.NetConnections.Servers.Web.Handlers {
|
---|
4 | public abstract class PathHandler {
|
---|
5 | protected readonly string moduleName;
|
---|
6 | protected string urlBasePath;
|
---|
7 | protected Web parent;
|
---|
8 |
|
---|
9 | protected PathHandler (string _moduleName, int _defaultPermissionLevel = 0) {
|
---|
10 | moduleName = _moduleName;
|
---|
11 | WebPermissions.Instance.AddKnownModule (_moduleName, _defaultPermissionLevel);
|
---|
12 | }
|
---|
13 |
|
---|
14 | public string ModuleName {
|
---|
15 | get { return moduleName; }
|
---|
16 | }
|
---|
17 |
|
---|
18 | public abstract void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user,
|
---|
19 | int _permissionLevel);
|
---|
20 |
|
---|
21 | public bool IsAuthorizedForHandler (WebConnection _user, int _permissionLevel) {
|
---|
22 | if (moduleName != null) {
|
---|
23 | return WebPermissions.Instance.ModuleAllowedWithLevel (moduleName, _permissionLevel);
|
---|
24 | }
|
---|
25 |
|
---|
26 | return true;
|
---|
27 | }
|
---|
28 |
|
---|
29 | public virtual void Shutdown () {
|
---|
30 | }
|
---|
31 |
|
---|
32 | public virtual void SetBasePathAndParent (Web _parent, string _relativePath) {
|
---|
33 | parent = _parent;
|
---|
34 | urlBasePath = _relativePath;
|
---|
35 | }
|
---|
36 | }
|
---|
37 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.