-
-
Notifications
You must be signed in to change notification settings - Fork 38
Working with URL patterns
Michael Justin edited this page May 18, 2025
·
5 revisions
Examples: /index.html
, /report.csv
, /admin
, /download
Using /*
after a path, like /products/*
, means any request to the /products path and its sub-paths will be mapped to the web component.
Examples: /*
, /admin/*
Mapping with *.page
(or any other extension) allows the web component to handle requests for all resources ending with that extension.
For example, *.html
can be used to handle HTML pages.
From unit tests:
procedure TAPIConfigTests.TestRegisterTwoMappings;
var
Server: TdjServer;
Context: TdjWebAppContext;
begin
Server := TdjServer.Create;
try
Context := TdjWebAppContext.Create('example');
Context.Add(TExamplePage, '/index.html');
Context.Add(TExamplePage, '*.txt');
Server.Add(Context);
Server.Start;
CheckGETResponseEquals('example', '/example/index.html');
CheckGETResponseEquals('example', '/example/test.txt');
finally
Server.Free;
end;
end;