XI: Integrated Page Mode (IPM) Static Content

Posted on

XI: Integrated Page Mode (IPM) Static Content

IPM contains several features. In this entry I will discuss the static content feature.

Static content allows you to add static items such as html, jpg, etc to your application. This can be useful for downloads, templates, or even pages. While we use the word static content, html page actually have quite a bit of dynamic abilities as well (IntraWeb Studio type functionality). More on this in the future. Here is a quick demo of who the static portion works.

Here is a test project. You can see that it contains some html files. The files do not need to be part of the project, we have included them for convenience. This is an important fact, because older Delphi IDEs have no support for HTML files. The only requirement is to put the files you wish to include in your content directory. The content directory defaults to a wwwroot subdirectory of the application directory. It can be configured by setting the ContentDir property in the ServerController.

The main.pas file is a normal IWForm and still accessed as in previous IntraWeb versions. Forms are accessed by the start URL and managed the developer. Of course in XI you can also map them to URLs, but this is a completely optional feature. To access the content on disk, it must be deployed with the application, and then you simply enter them as a URL. For demo purposes I am using 127.0.0.1, but for deployment this would be replaced with your domain name.

To access wwwroot/index.html, you can use any of the following URLs:

  • http://127.0.0.1
  • http://127.0.0.1/
  • http://127.0.0.1/index.html

This is because index.html is the default document name for IPM content. For wwwroot/test.html the URL is:

  • http://127.0.0.1/index.html

For wwwroot/About/index.html, any of the following URLs are valid:

  • http://127.0.0.1/About
  • http://127.0.0.1/About/
  • http://127.0.0.1/About/index.html

For wwwroot/About/test.html:

  • http://127.0.0.1/About/test.html

You can add directories as you wish. No change to code or recompiling of code is necessary. In this example I have only used .html files, however any type of content can be served including pictures, videos (non streaming), zip, etc.