source: binary-improvements2/WebServer/src/UrlHandlers/RewriteHandler.cs@ 402

Last change on this file since 402 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
RevLine 
[391]1namespace 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) {
[402]12 _context.RequestPath = fixedTarget ? target : $"{target}{_context.RequestPath.Remove (0, urlBasePath.Length)}";
[391]13 parent.ApplyPathHandler (_context);
14 }
15 }
16}
Note: See TracBrowser for help on using the repository browser.