Anvil | Smiths Smiths | Register Register | Login Login |
Search:
Show links Show tools Show tree | Previous document Next document | njet.org > Anvil > Documentation > Configuration > bind

bind

Binding controls the binding of filename suffixes to content types. Works closely with handlers, which control how the different content types are serviced.

Attributes
name default description
.suffix N/A Content type in the MIME type manner, such as: text/html. There may be as many mappings as are required.


Default bindings (in MimeTypes)
suffix mime type handler
.gifimage/gifDefaultContentHandler
.htmapplication/anvil.scriptScriptContentHandler
.htmlapplication/anvil.scriptScriptContentHandler
.javatext/plainDefaultContentHandler
.jpegimage/jpegDefaultContentHandler
.jpeimage/jpegDefaultContentHandler
.jpgimage/jpegDefaultContentHandler
.nvlapplication/anvil.scriptScriptContentHandler
.pngimage/pngDefaultContentHandler
.txttext/plainDefaultContentHandler
.wmlapplication/anvil.scriptScriptContentHandler
.xmlapplication/anvil.scriptScriptContentHandler
.zipapplication/zip DefaultContentHandler

Note that ScriptContentHandler is used both for scripts and templates. The first non-whitespace character in the file determines its type: if it is ``<'', the file is assumed to be a template; otherwise, it is a script.

Example:
  
  zone:
    path = api/
    # let's override the default behaviour to map .html to script/template
    bind:
      .html = text/html
    end
    handlers:
      text/html = anvil.server.DefaultContentHandler
    end
  end

See also  | Configuration  | server  | handlers
Contributes notes:
Add a note
What's new | Anvil