XI: URL Responders
URL Responders are a new class tree that allow you to add dynamic content to the URL space for Integrated Page Mode (IPM).
XI will contain a few built in URL Handlers. For example, it already contains these:
- TIWURLResponderEvent - Developer uses an event to handle the request and provide the reply.
- TIWURLResponderRedirect - Supplies a redirect to another URL.
- TIWURLResponderDirLister - Provides a directory listing.
URL Responders are also now used to handle things like SessionTimeout, and so forth. To replicate the older behavior, simply add a TIWURLResponderRedirect to the server controller, set the URL, and set the associated property to point to it. URL Responders can also be mapped to URLs.
Are used to create "lazy" responders, without creating a new class. Very good for creating responders that will not be reused.
For example here is how to map /Users/Kudzu.html to another website.
Add a TIWURLResponderRedirect to your ServerController.
Now set the Path, Document, and URL properties.
This tells it to respond to /Users/Kudzu.html, and redirect to http://www.KudzuWorld.com/Bio.aspx. It is set to SelfRegister, so we are all done. Now run the application.
In the browser I have entered: http://127.0.0.1:8000/Users/Kudzu.html
After I hit enter, I am redirected to the specified URL.
Note that /Users/ is completely a virtual URL. No /Users/ folder exists on disk or in wwwroot.
TIWURLResponderDirLister is not complete and only just barely works currently, but it also serves as a very good demo of another use of a URL Responder, as well as how to write a custom URL Responder. Here is my project:
We want to add a directory listing that is dynamic and based on actual disk contents when /List/ is entered. To do this, add a TIWURLResponderDirLister to the ServerController.
Set its Path property.
Now run the application and enter the following URL:
And the browser will display a clickable directory listing. Clicking on any item will display the item as a content item from the wwwroot folder base.
Unlike the previous example, our mapped directory does exist on disk. This is because some content will come from the wwwroot folder, while other content is provided by the URL Responder.
Here is the code for TIWURLResponderDirLister. Please note that this code is not final, and at this point was made just for demo purposes, although the component will be expanded and an included feature of XI.
<< Previous Entry
Next Entry >>