XI: URL Resolution and Integrated Page Mode
This is a detailed post how to map objects, forms, and files as bookmarkable URLs in XI.
All comparisons are case insensitive. Thus all of these are treated as equal:
For both registered URLs, and disk content, the default document is index.html. index.html will be appended to the URL for URL resolution when any of the following occurs:
- A directory on disk is found matching the path in the URL. This includes the root directory.
- A registered URL path is found that matches the URL.
Order of Precedence
XI resolved URLs in the following sequence. The first match processes it, if no match then the next step is taken.
http://127.0.0.1 is the root URL (Change the IP to your domain name or IP). This URL will look for an index.html file in the content root. If one is not found, then it will be treated as a start URL.
Any URL starting with /$ is considered to be an internal command used by IntraWeb.
Forms and URL Responders can register themselves to respond to a URL. They pass a path, document name, and class type. For example:
TIWURLMapping.Add(‘/history/’, ‘about.html’, formHistory)
This causes formHistory to respond to /history/about.html. The arguments are:
- Path – Must always start and finish with a /. If not an exception will be raised.
- Document – Document can be one of the following. Matching is also performed in this order of precedence.
- index.html – To match /history/ or /history/index.html
- Name of a document to be matched exactly, but case insensitively.
- * – To match all documents in /history/, but will not include matching of subpaths such as /history/2008/document.html.
- ” – Empty string signifies that any document in this path or subpath is a match. /history/document.html and /history/2008/document.html would both match. If multiple matches are found, the most specific one takes precedence.
- IWForm Class Type – The IWForm class to handle the request. The form will be automatically created and added to the form stack. i.e. as a .Show would normally do in IntraWeb code.
Content from disk is can be served if no other previous matches have occurred. The default root is the application directory. This will be configurable in the future, and for deployments it is suggested that the application directory be different than the content directory. The content directory can contain any sort of static information such as .html, .jpg, .zip, etc. .html files are parsed by Intraweb for tag and variable replacement (more on this later).
If a match is found on disk, then the content is served.
If still no matches have been found, the UnhandledRequest property is used. Developers can assign a URL Responder to determine what happens. The URL Responder provides the session, request, and response objects to the developer for full control. Several prepackaged URLResponder classes are also provided that can be used.
If no UnhandledRequest is not assigned, or the assigned URL Responder returns that it has not handled the request, a 404 page not found is sent to the browser.