Class MultipartSetTemplate

  • All Implemented Interfaces:
    java.io.Serializable, Handler, TemplateInterface

    public class MultipartSetTemplate
    extends SetTemplate
    Version of the SetTemplate that reflects form/multipart data in Request.props. For ordinary forms, the values placed into request.props are the same as for forms of type www-url-encoded, or method=get, as long as the query option is set.

    For file input fields (e.g. <input type=file...>), the file content is associated with the field name, and the properties name.filename, name.type, and name.encoding are set to to the name of the file uploaded, its type, and (unless noEncode is set), the encoding, which is either none (for text files), or Base64.

    The file contents are automatically Base64 encoded for binary files.

    Properties:

    query
    If present, The form data is translated from form/multipart and placed into the request properties, prefixed by the value of query.
    noEncode
    If present, no encoding is performed on file uploads.
    savePattern=[glob pattern]
    If set, then the form is scanned for field names that match glob pattern. If a match is found, then the next form element of type file is saved to a file in the document root instead of being loaded as a property. The name of the file is specified by the value of the saveName entry.
    saveName=name
    The name to use to save the file. May contain ${...} substitutions. The variables ${fileName}, ${fieldName) and ${prefix} may be used here as "special" variables to make creating a file name easier. saveNamedefaults to: ${prefix}-${fieldName}-${fileName}
    [This has only been tested with Netscape Navigator and Mozilla.]
    Version:
    %W
    Author:
    Stephen Uhler
    See Also:
    Serialized Form
    • Constructor Detail

      • MultipartSetTemplate

        public MultipartSetTemplate()
    • Method Detail

      • init

        public boolean init​(RewriteContext hr)
        Description copied from class: SetTemplate
        Chain the session-id properties into the request chain, if there are any. If "query" or "headers" are requested for "get", then add in those properties to request.props.
        Specified by:
        init in interface TemplateInterface
        Overrides:
        init in class SetTemplate
      • tag_set

        public void tag_set​(RewriteContext hr)
        Description copied from class: SetTemplate
        Set the value of a variable. Allow variable substitutions in the name and value. Don't create property tables needlessly.

        Attributes:

        name
        The name of the variable to set
        value
        The value to set if to.
        namespace
        The namespace to look in. By default, the variable is set in the namespace associated with the current "SessionId".
        local
        A (deprecated) alias for "namespace=local", or the current request.props.
        Overrides:
        tag_set in class SetTemplate
      • tag_get

        public void tag_get​(RewriteContext hr)
        Description copied from class: SetTemplate
        Replace the tag "get" with the value of the variable specified by the "name" attribute.

        Attributes:

        name
        The name of the variable to get
        namespace
        The namespace to look in. By default, the variable is searched for in "request.props". The namespace "server" is used to look in the server's namespace. The namespace "local" is a synonym for the default namespace.
        default
        The value to use if no value matches "name".
        convert
        The conversion to perform on the value of the data before substitution: "html", "url", or "none" (the default). For "html", any special html syntax is escaped. For "url", the data will be suitable for transmission as an http URL.
        max
        Truncate the String to at most max characters. Max must be at least one, and truncation occurs after any conversions.
        set
        The resultant value is placed into the request property named by the set attribute, and not inserted into the HTML stream. If none of "namespace", "convert", or "match" is used, then this simply copies the property from one name to another.
        If a single attribute is specified, with no "=", then is is taken to be the "name" parameter. Thus: <get foo> is equivalent to: <get name="foo">.
        Overrides:
        tag_get in class SetTemplate
      • tag_import

        public void tag_import​(RewriteContext hr)
        Description copied from class: SetTemplate
        Import all the data from the named namespace. The namespace associated with the session ID is imported automatically for backward compatibility. If the namespace doesn't exist, don't create it now, but remember it needs to be "Chained" if it is created on this page.
        Overrides:
        tag_import in class SetTemplate
      • tag_tag

        public void tag_tag​(RewriteContext hr)
        Description copied from class: SetTemplate
        Insert a literal "<". Using the current scheme, there is no easy way to substitute into a tag parameter. So we'll invent a "magic" tag (called tag) that will allow us to create entities dynamically. Thus values can be substituted into entities by escaping the entity as in:
         <tag>a href=<property href></tag>
         

        The [optional] attribute "name" may be used to specify the name of the tag, which will be emmitted just after the "<".

        Overrides:
        tag_tag in class SetTemplate