• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
      • HTML in CSPro
      • Localhost URL
      • External Libraries
      • JSON Primer
      • HTML Dialog Boxes
      • JavaScript Interface (deprecated)
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Localhost URL

Overview
When a CSPro application runs, a local web server is launched that can serve content located on the local file system or stored in memory. In a variety of contexts, CSPro creates URLs, referred to as "localhost URLs," that are handled by the local web server. Typically these URLs are valid as long as the CSPro application is running, but some expire after a period of time. All localhost URLs are inaccessible once the CSPro application stops, as the local web server is disconnected at that point.
As an example, when a templated report is displayed, CSPro evaluates the report content and creates a localhost URL that serves the content that is stored in memory. That URL is displayed in a web view, and when that web view closes, the localhost URL is released and is no long valid.
Creating Localhost URLs
Most users will not need to create localhost URLs directly, but for advanced applications, particularly ones that make use of HTML or use the Action Invoker from a web view, you may need to map content so that is accessible from another domain. The Localhost namespace, part of the Action Invoker, provides actions to create localhost URLs from files, text, and binary symbol data.
Windows: Local Web Server
On Windows, the local web server uses localhost as the host and chooses a dynamic port, checking for one that is not in use. You can try to have CSPro use a specific port, but if that port is in use, a different one will be used. Other programs can access data using the localhost URL as the local web server is accessible to all Windows programs. A localhost URL created on Windows looks similar to:
http://localhost:58651/vf/1/vfsC:/Program%20Files%20(x86)/CSPro%208.0/readme.txt
Android: WebView Asset Loader
On Android, a true local web server is not available, so instead CSPro uses WebViewAssetLoader to simulate a web server. Other Android applications cannot access data using localhost URLs as they are only valid from web views from within the Android CSEntry application. A localhost URL created on Android looks similar to:
https://appassets.androidplatform.net/lfs/1/storage/emulated/csentry/sync.log
See also: HTML in CSPro, Localhost Action Invoker Namespace