• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

SWI-Prolog HTTP support
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog HTTP support
        • Introduction
        • The HTTP client libraries
        • The HTTP server libraries
        • HTTP and IPv6
        • Transfer encodings
        • library(http/websocket): WebSocket support
        • library(http/hub): Manage a hub for websockets
        • Supporting JSON
        • MIME support
        • Security
        • Tips and tricks
        • Status

11 Tips and tricks

  • URL Locations
    With an application in mind, it is tempting to make all URL locations short and directly connected to the root (/). This is not a good idea. It is advised to have all locations in a server below a directory with an informative name. Consider to make the root location something that can be changed using a global setting.

    • Page generating code can easily be reused. Using locations directly below the root however increases the likelihood of conflicts.
    • Multiple servers can be placed behind the same public server as explained in section 3.14.7. Using a common and fairly unique root, redirection is much easier and less likely to lead to conflicts.

  • Debugging
    Debugging multi-threaded applications is possible using the graphical debugger. This implies requires that the xpce extension package must be installed. Spy-points may be placed using tspy/1.

  • URL/URI manipulation
    Sometimes an http_handler/3 needs to inspect or normalize the URL. There are various utility predicates in library(uri), such as uri_components/2, uri_data/4, uri_edit/3, uri_nomalized/2, etc.

ClioPatria (version V3.1.1-51-ga0b30a5)