Package sunlabs.brazil.template
Class MultipartSetTemplate
java.lang.Object
sunlabs.brazil.template.Template
sunlabs.brazil.template.SetTemplate
sunlabs.brazil.template.MultipartSetTemplate
- All Implemented Interfaces:
Serializable
,Handler
,TemplateInterface
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.
saveName
defaults to:${prefix}-${fieldName}-${fileName}
- Version:
- %W
- Author:
- Stephen Uhler
- See Also:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
init
(RewriteContext hr) Chain the session-id properties into the request chain, if there are any.void
Replace the tag "get" with the value of the variable specified by the "name" attribute.void
Import all the data from the named namespace.void
Convert the html tag "property" in to the request's property DEPRECATED - use "get"void
Set the value of a variable.void
Insert a literal ">"void
Insert a literal "<".Methods inherited from class sunlabs.brazil.template.SetTemplate
doImport, file2path, init, respond, tag_namespace, tag_slash_namespace, tag_unimport
-
Constructor Details
-
MultipartSetTemplate
public MultipartSetTemplate()
-
-
Method Details
-
init
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 interfaceTemplateInterface
- Overrides:
init
in classSetTemplate
-
tag_set
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 classSetTemplate
-
tag_property
Description copied from class:SetTemplate
Convert the html tag "property" in to the request's property DEPRECATED - use "get"- Overrides:
tag_property
in classSetTemplate
-
tag_get
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.
<get foo>
is equivalent to:<get name="foo">
.- Overrides:
tag_get
in classSetTemplate
-
tag_import
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 classSetTemplate
-
tag_tag
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 classSetTemplate
-
tag_slash_tag
Description copied from class:SetTemplate
Insert a literal ">"- Overrides:
tag_slash_tag
in classSetTemplate
-