Last change
on this file since 486 was 402, checked in by alloc, 22 months ago |
- Major refactoring
- Using Utf8Json for (de)serialization
- Moving APIs to REST
- Removing dependencies from WebServer and MapRenderer to ServerFixes
|
File size:
518 bytes
|
Line | |
---|
1 | namespace Webserver.UrlHandlers {
|
---|
2 | public class RewriteHandler : AbsHandler {
|
---|
3 | private readonly string target;
|
---|
4 | private readonly bool fixedTarget;
|
---|
5 |
|
---|
6 | public RewriteHandler (string _target, bool _fixedTarget = false) : base (null) {
|
---|
7 | target = _target;
|
---|
8 | fixedTarget = _fixedTarget;
|
---|
9 | }
|
---|
10 |
|
---|
11 | public override void HandleRequest (RequestContext _context) {
|
---|
12 | _context.RequestPath = fixedTarget ? target : $"{target}{_context.RequestPath.Remove (0, urlBasePath.Length)}";
|
---|
13 | parent.ApplyPathHandler (_context);
|
---|
14 | }
|
---|
15 | }
|
---|
16 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.