• 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

/home/swipl/lib/swipl/library/http/mimetype.pl
AllApplicationManualNameSummaryHelp

  • library
    • http
      • http_unix_daemon.pl -- Run SWI-Prolog HTTP server as a Unix system daemon
      • thread_httpd.pl -- Threaded HTTP server
      • http_wrapper.pl -- Server processing of an HTTP request
      • http_header.pl -- Handling HTTP headers
      • http_stream.pl -- HTTP Streams
      • http_exception.pl -- Map Prolog exceptions to HTTP errors
      • http_path.pl -- Abstract specification of HTTP server locations
      • http_dispatch.pl -- Dispatch requests in the HTTP server
      • http_host.pl -- Obtain public server location
      • http_ssl_plugin.pl -- SSL plugin for HTTP libraries
      • http_parameters.pl -- Extract parameters (GET and POST) from HTTP requests
      • http_client.pl -- HTTP client library
      • http_multipart_plugin.pl -- Multipart form-data plugin
      • http_hook.pl -- HTTP library hooks
      • html_write.pl -- Write HTML text
      • html_quasiquotations.pl -- HTML quasi quotations
      • mimetype.pl -- Determine mime-type for a file
        • file_mime_type/2
        • file_content_type/2
        • file_content_type/3
        • mime_extension/2
        • charset/3
      • html_head.pl -- Automatic inclusion of CSS and scripts links
      • term_html.pl -- Represent Prolog terms as HTML
      • json.pl -- Reading and writing JSON serialization
      • jquery.pl -- Provide JQuery
      • http_server_files.pl -- Serve files needed by modules from the server
      • http_open.pl -- HTTP client library
      • http_session.pl -- HTTP Session management
      • http_openid.pl -- OpenID consumer and server library
      • yadis.pl -- Yadis discovery
      • ax.pl -- Attribute Exchange library
      • http_authenticate.pl -- Authenticate HTTP connections using 401 headers
      • http_json.pl -- HTTP JSON Plugin module
      • http_dirindex.pl -- HTTP directory listings
      • js_write.pl -- Utilities for including JavaScript
      • js_grammar.pl -- JavaScript grammar
      • http_cors.pl -- Enable CORS: Cross-Origin Resource Sharing
      • json_convert.pl -- Convert between JSON terms and Prolog application terms
      • http_dyn_workers.pl -- Dynamically schedule HTTP workers.
      • hub.pl -- Manage a hub for websockets
      • websocket.pl -- WebSocket support
      • http_log.pl -- HTTP Logging module
      • mimepack.pl -- Create a MIME message
 file_content_type(+File:atom, -ContentType:atom) is det
 file_content_type(+File:atom, ?MediaType, -ContentType:atom) is det
True if File should be served using ContentType: ContentType. It takes the following steps:
  1. Determine the media type using file_mime_type/2, unless already specified using file_content_type/3.
  2. Determine it is a text file using text_mimetype/1
  3. Use the charset from the Prolog flag default_charset

The behavior is controlled by several hooks and a flag.

  • mime:mime_extension/2 defines the media type
  • text_mimetype/1 defines the media type is text
  • mime:charset/3 derives the charset for a file with a given media type, if the media type is text according to text_mimetype/1.
  • If text_mimetype/1 succeeds and mime:charset/3 fails, the flag default_charset defines the charset unless it is set to -. The flag set by default to UTF-8 if the Prolog flag encoding is set to utf8.
ClioPatria (version V3.1.1-42-gd6a756b-DIRTY)