sunlabs.brazil.template
Class MultipartSetTemplate

java.lang.Object
  extended by sunlabs.brazil.template.Template
      extended by sunlabs.brazil.template.SetTemplate
          extended by sunlabs.brazil.template.MultipartSetTemplate (view source)
All Implemented Interfaces:
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.]

See Also:
Serialized Form

Field Summary
 
Fields inherited from class sunlabs.brazil.template.Template
debug
 
Constructor Summary
MultipartSetTemplate()
           
 
Method Summary
 boolean init(RewriteContext hr)
          Chain the session-id properties into the request chain, if there are any.
 void tag_get(RewriteContext hr)
          Replace the tag "get" with the value of the variable specified by the "name" attribute.
 void tag_import(RewriteContext hr)
          Import all the data from the named namespace.
 void tag_property(RewriteContext hr)
          Convert the html tag "property" in to the request's property DEPRECATED - use "get"
 void tag_set(RewriteContext hr)
          Set the value of a variable.
 void tag_slash_tag(RewriteContext hr)
          Insert a literal ">"
 void tag_tag(RewriteContext hr)
          Insert a literal "<".
 
Methods inherited from class sunlabs.brazil.template.SetTemplate
doImport, file2path, init, load, respond, store, tag_namespace, tag_slash_namespace, tag_unimport
 
Methods inherited from class sunlabs.brazil.template.Template
done
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.
track
If true, all "set" operations are logged to stderr. This paramter may also be set in the configuration file to effect all "set" tags.

Overrides:
tag_set in class SetTemplate

tag_property

public void tag_property(RewriteContext hr)
Description copied from class: SetTemplate
Convert the html tag "property" in to the request's property DEPRECATED - use "get"

Overrides:
tag_property 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

tag_slash_tag

public void tag_slash_tag(RewriteContext hr)
Description copied from class: SetTemplate
Insert a literal ">"

Overrides:
tag_slash_tag in class SetTemplate

Version Kenai-svn-r24, Generated 08/18/09
Copyright (c) 2001-2009, Sun Microsystems.