org.melati.template
Class MultipartTemplateContext

Package class diagram package MultipartTemplateContext
java.lang.Object
  extended by org.melati.template.MultipartTemplateContext
All Implemented Interfaces:
ServletTemplateContext, TemplateContext

public class MultipartTemplateContext
extends Object
implements ServletTemplateContext

A ServletTemplateContext which allows access to the filename and body of any file which is uploaded from a HTML form field. (by setting its ENCTYPE to ``multipart/form-data'' and setting the field's type to * ``file'').

You can retrieve the value of any field variable as usual by using getForm(s).

Note that you need to pass in a ServletTemplateContext to the constructor.


Constructor Summary
MultipartTemplateContext(Melati melati, ServletTemplateContext context)
          Constructor.
MultipartTemplateContext(Melati melati, ServletTemplateContext context, int maxSize)
          Constructor.
 
Method Summary
 Object get(String s)
          Get an object from the Context by key.
 Object getContext()
          Return the Context itself, as an Object.
 Enumeration getFieldNames()
           
 String getFormField(String s)
          Get a field from an HTML Form.
 MultipartFormField getMultipartFormField(String s)
          Get a multi-part field from an HTML form.
 javax.servlet.http.HttpSession getSession()
          Get the HttpSession .
 void put(String s, Object o)
          Put an object into the Context with a key.
 void setPassbackExceptionHandling()
          Set the current exception handling style.
 void setPropagateExceptionHandling()
          Set the current exception handling style.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultipartTemplateContext

public MultipartTemplateContext(Melati melati,
                                ServletTemplateContext context)
                         throws IOException
Constructor.

Parameters:
melati - our Melati
context - the ServletTemplateContext
Throws:
IOException

MultipartTemplateContext

public MultipartTemplateContext(Melati melati,
                                ServletTemplateContext context,
                                int maxSize)
                         throws IOException
Constructor.

Parameters:
melati - our Melati
context - the ServletTemplateContext
maxSize - maximum allowed size
Throws:
IOException
Method Detail

put

public void put(String s,
                Object o)
Put an object into the Context with a key.

Specified by:
put in interface TemplateContext
Parameters:
s - the key
o - the object
See Also:
TemplateContext.put(java.lang.String, java.lang.Object)

getFormField

public String getFormField(String s)
Get a field from an HTML Form.

Specified by:
getFormField in interface ServletTemplateContext
Parameters:
s - the field's name
Returns:
the field value, null if not set
See Also:
ServletTemplateContext.getFormField(java.lang.String)

getMultipartFormField

public MultipartFormField getMultipartFormField(String s)
Get a multi-part field from an HTML form.

Specified by:
getMultipartFormField in interface ServletTemplateContext
Parameters:
s - the field's name
Returns:
the field's value
See Also:
ServletTemplateContext.getMultipartFormField(java.lang.String)

getFieldNames

public Enumeration getFieldNames()
Returns:
an Enumeration of Field names

get

public Object get(String s)
Get an object from the Context by key.

Specified by:
get in interface TemplateContext
Parameters:
s - key
Returns:
value
See Also:
TemplateContext.get(java.lang.String)

getSession

public javax.servlet.http.HttpSession getSession()
Get the HttpSession .

Specified by:
getSession in interface ServletTemplateContext
Returns:
the current HttpSession
See Also:
ServletTemplateContext.getSession()

getContext

public Object getContext()
Return the Context itself, as an Object.

Specified by:
getContext in interface TemplateContext
Returns:
the Context
See Also:
TemplateContext.getContext()

setPassbackExceptionHandling

public void setPassbackExceptionHandling()
Set the current exception handling style.

Specified by:
setPassbackExceptionHandling in interface TemplateContext
See Also:
TemplateContext.setPassbackExceptionHandling()

setPropagateExceptionHandling

public void setPropagateExceptionHandling()
Set the current exception handling style.

Specified by:
setPropagateExceptionHandling in interface TemplateContext
See Also:
TemplateContext.setPropagateExceptionHandling()


Copyright © 2000-2010 PanEris. All Rights Reserved.