SilverStream
Application Server 3.5

com.sssw.srv.busobj
Class AgoInvokedEvent

java.lang.Object
 |
 +--java.util.EventObject
       |
       +--com.sssw.srv.busobj.AgoBusinessObjectEvent
             |
             +--com.sssw.srv.busobj.AgoInvokedEvent
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AgoDataSourceEvent

public class AgoInvokedEvent
extends AgoBusinessObjectEvent

This is the event object passed into an invoked event of an InvokedListener business object.

See Also:
AgiInvokedListener, Serialized Form

Fields inherited from class java.util.EventObject
source
 
Constructor Summary
AgoInvokedEvent()
           
 
Method Summary
static Hashtable decodeURLEncodedForm(String s)
          Parses a string which is encoded using application/x-www-form-urlencoded into a Hashtable of query terms.
 Serializable getParameter()
          Return the parameter sent to the InvokedListener.
 void setResult(Serializable result)
          Sets the return value of this invoked event.
 void setResult(Serializable result, String mime)
          Sets the return value of this invoked event.
 void setResultMimeType(String mime)
          Assigns the MIME type of the return value of an InvokedAgent.
 
Methods inherited from class com.sssw.srv.busobj.AgoBusinessObjectEvent
getAgaData, getDatabase, getDatabaseURL, getServer, getSession, getUser, runAgData, updateTransactionally, userInGroup
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AgoInvokedEvent

public AgoInvokedEvent()
Method Detail

getParameter

public Serializable getParameter()
Return the parameter sent to the InvokedListener.
Example:

The invoker of the business object can pass in a parameter to the event. E.g. a form calling agGeneral.invokeBusinessObject() can pass in a string parameter. The business object can get access to that parameter via this method:

         String param = (String)evt.getParameter();
 

setResult

public void setResult(Serializable result,
                      String mime)
               throws AgoInvalidDataException
Sets the return value of this invoked event. If invoked via invokeAgent() or invokeBusinessObject() then this sets what those methods will return.
Parameters:
result - the value to return to the caller of the invoked business object. It must be Serializable since the caller could be on a client machine.
mime - the MIME-Type of the return value. When business object returns a String of HTML that the browser should display as HTML (if, for example,this object is run via an HTML form's submit button) then the mime would be set to ("text/hmtl"). This must be a syntactically valid MIME type (type/subtype) or AgoInvalidDataException is thrown.
See Also:
AgoInvalidDataException

setResult

public void setResult(Serializable result)
Sets the return value of this invoked event. If invoked via invokeAgent() or invokeBusinessObject() then this method sets what those methods will return.
Parameters:
result - the value to return to the caller of the invoked business object. It must be Serializable since the caller could be on a client machine.
Usage:

In version Silverstrem 1.X the result parameter was defined as Object but really needed to be some object that implemented Serializable. It has been changed to be explicitly Serializable. If 1.X code no longer compiles, it might need to cast the parameter to Serializable.


setResultMimeType

public void setResultMimeType(String mime)
                       throws AgoInvalidDataException
Assigns the MIME type of the return value of an InvokedAgent.

Parameters:
mime - specifies the MIME type. This can be any valid MIME Type. This must be a syntactically valid MIME type (type/subtype) or AgoInvalidDataException is thrown.
Usage:

If the object returns a serialized java object this method does not need to be used. However, if the invoked object returns anything else, the MIME Type should correctly describe it.

For example, if the agent returns a String of HTML, intending that the browser display it as HTML (for example, if this agent is run via an HTML form's submit button) then setResultMIMEType("text/hmtl") should be called.

See Also:
AgoInvalidDataException, AgoInvokedEvent.setResult( Serializable result )

decodeURLEncodedForm

public static Hashtable decodeURLEncodedForm(String s)
Parses a string which is encoded using application/x-www-form-urlencoded into a Hashtable of query terms. Returns a Hashtable of the query terms or null on error.
Parameters:
s - the parameter to decode.
Returns:
A Hashtable of the query terms or null on error
Usage:

This routine could be used if the invoker of this business object were an HTML form designed by hand and had the form POST directly to the business object. In that case, all the fields in the form are packaged up by the browser and URL encoded. Then getParameter() would be called to get arguments from the body of the POST request as a string and then call this routine to parse those arguments.

Example:

This example gets the value of the Country parameter passed in from an HTML form. The parameter could have been set by the user via an HTML choice box (i.e., <SELECT> and <OPTION> tags).

         String param = (String)evt.getParameter();
         Hashtable params = decodeURLEncodedForm(param);
         String country = params.get("Country");
 

SilverStream
Application Server 3.5