Version: 1.1.1

ca.ucalgary.services.util
Class XHTMLForm

java.lang.Object
  extended by ca.ucalgary.services.util.MobySpecWrapper
      extended by ca.ucalgary.services.util.XHTMLForm

public class XHTMLForm
extends MobySpecWrapper

This class presents HTML forms as if they were ACD file descriptions of a command. This allows us to wrap Web pages as Moby services using a similar mechanism to that which wraps ACD-described command line tools such as EMBOSS programs.


Field Summary
static String HIDDEN_SENTINEL
           
static String IMAGE_ANONYMOUS_NAME
           
static String IMAGE_DATATYPE
           
static String METHOD_GET
           
static String METHOD_POST
           
static String MULTIPART
           
static String NULL_NAME
           
static String RADIO_DEFAULT_SENTINEL
           
static String RADIO_SENTINEL
           
static String SUBMIT_ANONYMOUS_NAME
           
static String SUBMIT_DATATYPE
           
static String SUBMIT_DEFAULT_VALUE
           
static String URLENCODED
           
 
Constructor Summary
XHTMLForm()
          C-tor to use when you want to set a bunch of parameters manually.
XHTMLForm(URL formUrl)
           
 
Method Summary
 void addFormFile(String paramName)
           
 String getFormAction()
           
 String getFormEncodingType()
           
 List<String> getFormFiles()
           
 String getFormMethod()
           
 Map<String,String> getImageOptions()
          Lists the named submit buttons, and may contain a special key IMAGE_ANONYMOUS_NAME that denotes that an unnamed submit button can be used.
 Map<String,String> getSubmitOptions()
          Lists the named submit buttons, and may contain a special key SUBMIT_ANONYMOUS_NAME that denotes that an unnamed submit button can be used.
static String join(String delim, String[] array)
           
static StringBuffer join(String delim, String[] array, StringBuffer sb)
           
 Map<String,Boolean> parseSelectField(Element selectElement, String selectName)
           
 void removeFormFile(String paramName)
           
 void setCurrentService(String serviceToReport)
          This method has extended functionality on this class, because the service can be set using the moby service name (as per XHTML markup), the index of the form (starting at 0) in the page, the form's HTML name, or the fully qualified action URL.
 void setFormAction(String action)
           
 void setFormEncodingType(String encType)
           
 void setFormMethod(String method)
           
 void setImageOptions(Map<String,String> options)
           
 void setSubmitOptions(Map<String,String> options)
           
 
Methods inherited from class ca.ucalgary.services.util.MobySpecWrapper
getCentralEndpoint, getContactEmail, getFixedParams, getMobyParams2ServiceParams, getPrimaryInputFormats, getPrimaryInputs, getPrimaryOutputFormats, getPrimaryOutputs, getProviderURI, getSecondaryInputFormats, getSecondaryInputs, getServiceDesc, getServiceName, getServiceNames, getServiceType, getSpecURL, getUnitTests, setCentralEndpoint, setContactEmail, setFixedParams, setMobyParams2ServiceParams, setPrimaryInputFormats, setPrimaryInputs, setPrimaryOutputFormats, setPrimaryOutputs, setProviderURI, setSecondaryInputFormats, setSecondaryInputs, setServiceDesc, setServiceType, setSpecURL, setUnitTests
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

METHOD_POST

public static final String METHOD_POST
See Also:
Constant Field Values

METHOD_GET

public static final String METHOD_GET
See Also:
Constant Field Values

SUBMIT_DATATYPE

public static final String SUBMIT_DATATYPE
See Also:
Constant Field Values

IMAGE_DATATYPE

public static final String IMAGE_DATATYPE
See Also:
Constant Field Values

NULL_NAME

public static final String NULL_NAME
See Also:
Constant Field Values

MULTIPART

public static final String MULTIPART
See Also:
Constant Field Values

URLENCODED

public static final String URLENCODED
See Also:
Constant Field Values

RADIO_SENTINEL

public static final String RADIO_SENTINEL
See Also:
Constant Field Values

RADIO_DEFAULT_SENTINEL

public static final String RADIO_DEFAULT_SENTINEL
See Also:
Constant Field Values

HIDDEN_SENTINEL

public static final String HIDDEN_SENTINEL
See Also:
Constant Field Values

IMAGE_ANONYMOUS_NAME

public static final String IMAGE_ANONYMOUS_NAME
See Also:
Constant Field Values

SUBMIT_ANONYMOUS_NAME

public static final String SUBMIT_ANONYMOUS_NAME
See Also:
Constant Field Values

SUBMIT_DEFAULT_VALUE

public static final String SUBMIT_DEFAULT_VALUE
See Also:
Constant Field Values
Constructor Detail

XHTMLForm

public XHTMLForm(URL formUrl)
          throws Exception
Parameters:
formUrl - the location of the remote Web form that will be wrapped into a Moby Service
Throws:
Exception

XHTMLForm

public XHTMLForm()
C-tor to use when you want to set a bunch of parameters manually. If parse() is called on the created object, the rules surrounding required annotation fields are dropped, but manually set values will be refined if they are more lax (e.g. wider int range) than the parsed annotation.

Method Detail

setCurrentService

public void setCurrentService(String serviceToReport)
                       throws IllegalArgumentException
This method has extended functionality on this class, because the service can be set using the moby service name (as per XHTML markup), the index of the form (starting at 0) in the page, the form's HTML name, or the fully qualified action URL. In case any of these are not unique, the order of precedence is as listed above, with the first instance of a form takling precedence over later duplicate names in the page.

Overrides:
setCurrentService in class MobySpecWrapper
Throws:
IllegalArgumentException

parseSelectField

public Map<String,Boolean> parseSelectField(Element selectElement,
                                            String selectName)
                                     throws Exception
Returns:
a map of
Throws:
Exception

setSubmitOptions

public void setSubmitOptions(Map<String,String> options)

getSubmitOptions

public Map<String,String> getSubmitOptions()
Lists the named submit buttons, and may contain a special key SUBMIT_ANONYMOUS_NAME that denotes that an unnamed submit button can be used. Note that the key sets for getSubmitOptions() and getImageOptions() are disjoint.


setImageOptions

public void setImageOptions(Map<String,String> options)

getImageOptions

public Map<String,String> getImageOptions()
Lists the named submit buttons, and may contain a special key IMAGE_ANONYMOUS_NAME that denotes that an unnamed submit button can be used. Note that the key sets for getSubmitOptions() and getImageOptions() are disjoint.


setFormEncodingType

public void setFormEncodingType(String encType)
Parameters:
encType - either constant MULTIPART or URLENCODED

getFormEncodingType

public String getFormEncodingType()
Returns:
either constant MULTIPART or URLENCODED

setFormAction

public void setFormAction(String action)
Parameters:
action - the value of the form's action attribute

getFormAction

public String getFormAction()

setFormMethod

public void setFormMethod(String method)
Parameters:
method - the value of the form's method attribute (i.e. GET or POST)

getFormMethod

public String getFormMethod()

addFormFile

public void addFormFile(String paramName)

removeFormFile

public void removeFormFile(String paramName)

getFormFiles

public List<String> getFormFiles()
Returns:
the list of input parameters (primary and/or secondary) that should be submitted in "file" style

join

public static String join(String delim,
                          String[] array)

join

public static StringBuffer join(String delim,
                                String[] array,
                                StringBuffer sb)

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010