content

toc
<mm:content>

The content tag is meant to put around your whole page, and set general properties, like language, taglib behaviour, content type.

The content-tag can also provide a default `escaping' behavior for surrounded `writer' tags.

It also tries to set reasonable cache-headers. Make sure to read the documentation of the `expires' attribute.

(since: MMBase-1.7)
see alsocloud | time | locale | expires attribute of content
attributes
  • language
    The language in which this page is supposed to be written. This information is available to sub-tags (like cloud-tag).
    see: language attribute of locale
  • country
    see: country attribute of locale
  • variant (since: MMBase-1.8)
    see: variant attribute of locale
  • timezone (since: MMBase-1.8.1)
    see: timezone attribute of locale
  • jspvar
  • type

    The Content-Type of this page.

    Setting the content-type can also trigger a default `escaper' and `postprocessor'.

    IdContent-TypeDefault escaperDefault postprocessorDefault encoding
    htmltext/htmltext/htmlreducespaceNOTSPECIFIED
    xhtmlapplication/xhtml+xmltext/xmlreducespace
    xmlapplication/xmltext/xmlreducespace
    text/htmltext/htmltext/htmlreducespaceNOTSPECIFIED
    text/xmltext/xmltext/xmlreducespaceNOTSPECIFIED
    application/xmlapplication/xmltext/xmlreducespace
    application/xhtml+xmlapplication/xhtml+xmltext/xmlreducespace
    audio/x-pn-realaudioaudio/x-pn-realaudiononereducespace
    application/smilapplication/smiltext/xmlreducespace
    text/vnd.rn-realtexttext/vnd.rn-realtexttext/xmlreducespace
    video/x-ms-wmpvideo/x-ms-wmptext/xmlreducespace
    text/javascripttext/javascriptnonereducespace
    text/csstext/cssnonereducespace

  • encoding
    The output text encoding. Don't attribute too much value too this. Normally it's better to arrange this with the page-directive of JSP. Certainly this attribute cannot arrange the pageEncoding (or the coding of the JSP source itself).
    UTF-8
  • expires

    Defines when this page expires (in seconds after now). If you set this, this has influence on some http header being set ('Cache-Control' and `Expires'). This default to one minute public-caching if there is no session used on the page, and to no caching otherwise.

    Setting this to 0 has the effect of disabling all proxy-caching.

    If expires is is set to a value greater than 0, and there is a Cloud-tag in the page which wrote a non-anonymous cloud object to the session, then the Cache-Control header is `private', rather than public, because such a situation implies that there is something on the page which is not public.


  • disposition (since: MMBase-1.8.5)
    Provides a proposal filename for the response. The content-disposition of the resonse will be set to 'attachment', and this filename.
  • postprocessor

    If this attribute is set the complete body-result is piped through this. If you specified `type', then a default postprocessor might be defined.

    The following postprocessors can be specified (besides the ones defined with mm:escaper tags).

    Postprocessor
    reducespace

    Replaces groups of one and more newlines by one new line, and one or more space by one space. This spares bandwidth and makes the result better readable.

    This is default for most XML-like content types.

    entitiesAny non-ASCII character will be replaced by an XML-entity.
    xmetodoReplaces ?, ?, ?, ?, ?, ? with cx, gx, hx, jx, sx, ux
    hmetodoReplaces ?, ?, ?, ?, ?, ? with ch, gh, hh, jh, sh, u
    perl Interpret the complete body as a perl program, and write the result.
    sitestat Rewrites the input to the characters which are alowed in Sitestat keys for page statistics, being: "A-Z, a-z, 0-9, - . _".

    see: escaper
  • escaper

    The default value of the escape attribute of all writer tags in the body. The values are defined in taglibcontent.xml. Reasonable defaults apply if you explicitly specify a type.

    The `escape' attribute of the surrounded writers can be used to override this. (E.g. if the writer itself produces HTML (e.g. mm:function name="gui"), then you should use escape="none").

    The following `escapers' can be specified (besides the ones defined with mm:escaper tags):

    Escaper
    text/plainThis equals no escaping
    noneNo escaping
    text/htmlEscapes for use in HTML.
    text/html/attributeEscapes for use in HTML atributes
    text/xmlEscapes for use in XML (or XHTML).
    inlineInterpret as 'enriched' ASCII for 'inline' HTML parts (so no blocks)
    pInterpret as 'enriched' ASCII for 'block' HTML parts. It normally generates one or more p-tags (everything is enclosed by a p tag, including lists).
    ppAs 'p', but only one sequences of one br-tags are produced
    p-ommit-surroundingas p, but surrounding p /p tags are omitted (you must place them by hand). This can be needed for 'read-more' links.
    pp-ommit-surrounding
    plInterpret as 'enriched' ASCII for 'block' HTML parts. It normally generates one or more p-tags. Lists (ul tags) are placed outside the paragraphs. As such a block may start or end with an ul tag.
    pplAs 'p2', but only one sequences of one br-tags are produced
    pl-ommit-surroundingas p2, but surrounding p /p tags are omitted (you must place them by hand).
    ppl-ommit-surroundingas pp2, but surrounding p /p tags are omitted (you must place them by hand).
    wikiGenerates piece of XHTML2 compatible XML
    sqlEscapes for use in SQL (escaping of quotes). You will _not_ have to use this if use mm:constraint.
    js-single-quotesEscapes single quotes for use in Javascript (with \').
    js-double-quotesEscapes double quotes for use in Javascript (with ").
    js-both-quotesEscapes both quote types (' and ") for use in Javascript (with \').
    urlEscapes for use in an URL (using escaping with %). When you use mm:url with mm:param tags you will not have to use this.
    urlparamSimilar to 'url' but also escapes '+'
    uppercaseConverts to all uppercase.
    lowercaseConverts to all lowercase.
    identifierReplaces anything which is not alphanumeric by underscores.
    censorFinds and replaces 'forbidden' words.
    swallowEverything disappears
    linksFinds and makes clickable URL's.
    plainlinksFinds and makes clickable URL's, assuming plain/text input.
    figletFilters through the command-line tool 'figlet', which can have amusing results.
    trimmerTrims leading and trailing whitespace
    cp1252 Escapes the CP1252 characters which are not in ISO-8859-1. You don't want to serve your pages as CP1252 (it is not a standard encoding). It is adviceable to do it using UTF-8, but if you really want to use ISO-8859-1, you can create reasonable surrogates by this (nicer then question marks).
    cp1252wrong Escapes the CP1252 characters, but suppose that the String was originally wrongly encoded (CP1252 bytes were incorrectly supposed ISO-8859-1)
    spaceremover Replace 1 or more white space characters by one space, unless, those are the first or last of the string, those are replaced with nothing.
    spaceswallower Removes all whitespace.
    roman This works on integers only, and converts them to a roman numbers (lowercase, so see also 'uppercase'). This works only for natural numbers smaller than 4000.
    rot13 Performs 'rot 13' encoding of the string, to scramble letters. Can be decoded by doing a rot13 again.
    rot5 Performs 'rot 5' encoding of the string. This scrambles the digits.
    md5
    adler32 Performs a 'adler32' checksum.
    crc32 Performs a 'crc32' checksum.
    java Escapes non-ASCII characters to java escape sequences.
    reducespace

    Replaces groups of one and more newlines by one new line, and one or more space by one space. This spares bandwidth and makes the result better readable.

    This is default for most XML-like content types.

    entitiesAny non-ASCII character will be replaced by an XML-entity.
    xmetodoReplaces ?, ?, ?, ?, ?, ? with cx, gx, hx, jx, sx, ux
    hmetodoReplaces ?, ?, ?, ?, ?, ? with ch, gh, hh, jh, sh, u
    perl Interpret the complete body as a perl program, and write the result.
    sitestat Rewrites the input to the characters which are alowed in Sitestat keys for page statistics, being: "A-Z, a-z, 0-9, - . _".

    see: escape attribute of writer | function | escaper
  • unacceptable (since: MMBase-1.8.5)

    What to do if the to-be-produced content-type seems to be unacceptable for the client.


    Like not using the attribute, i.e. send the content anyway.
    CRIPPLE<:message>Try to cripple the type (degrade application/xtml+xml to text/html), until it is acceptable. If not possible the message can be used for the NOT_ACCEPTABLE response
    <:message>Send a NOT_ACCEPTABLE with this message. If message = "_" it will be leaft empty.