
910
DEVELOPING
COLDFUSION 9 APPLICATIONS
ColdFusion Portlets
Las
t
upda
te
d 8/5/2010
Processing an event (event consumer)
<portlet>
….
<supported-processing-event>
<qname xmlns:cf="http://adobe.com/coldfusion/portlet/example">cf:HelloEvent</qname>
</supported-processing-event>
…..
</portlet>
Portlet definition can have both publishing and processing tags.
portlet.xml
file has event definition, publishing
event, and processing event tags, as its portlets create and consume events.
Initiate events in portlet (CFC)
You publish events in the
processAction()
method of the portlet code by calling
setEvent()
on the
ActionResponse
object. This
setEvent()
method takes two parameters: the QName of the event object and the type
of object defined in portlet.xml.
Following is an example of processAction() method.
<cffunction name="processAction" returntype="void" access="public" output="false"
hint="Called by the portlet container to allow the portlet to process an action request.">
<cfargument name="actionRequest" type="any" required="true" hint="A
javax.portlet.ActionRequest java object">
<cfargument name="actionResponse" type="any" required="true" hint="A
javax.portlet.ActionResponse java object">
<cfset super.processAction(arguments.actionRequest, arguments.actionResponse)>
<!--- send event notification --->
<cftry>
<cfset arguments.actionResponse.setEvent("HelloEvent",
request.portlet.parameters.event_value)>
<cfcatch type="any">
<cflog file="simple-event-portlet" type="error" text="processAction() threw
exception: #cfcatch.message#">
</cfcatch>
</cftry>
</cffunction>
Capture events in
processEvent()
method:
Содержание COLDFUSION 9
Страница 1: ...Developing Applications ADOBE COLDFUSION 9...