Adobe COLDFUSION 9 Manual page 916

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
ColdFusion Portlets
<cffunction name="processEvent" returntype="void" access="public" output="false" hint="Called
by the portlet container requesting the portlet to process a specific event.">
<cfargument name="eventRequest" type="any" required="true" hint="A
javax.portlet.EventRequest java object">
<cfargument name="eventResponse" type="any" required="true" hint="A
javax.portlet.EventResponse java object">
<cfset var e = StructNew()>
<cftry>
<cfset e.name = arguments.eventRequest.getEvent().getName()>
<cfset e.value = arguments.eventRequest.getEvent().getValue()>
<cfif NOT IsDefined("application.EventReceivingPortletEvents")>
<cfset application.EventReceivingPortletEvents = ArrayNew(1)>
</cfif>
<cfset ArrayAppend(application.EventReceivingPortletEvents,e)>
<cfcatch type="any">
</cfcatch>
</cftry>
</cffunction>
Using filters
Filter definition and mapping in portlet.xml
<filter>
<filter-name>Example ColdFusion Filter</filter-name>
<filter-class>coldfusion.portlet.ColdFusionPortletFilter</filter-class>
<lifecycle>RENDER_PHASE</lifecycle>
<lifecycle>EVENT_PHASE</lifecycle>
<lifecycle>RESOURCE_PHASE</lifecycle>
<lifecycle>ACTION_PHASE</lifecycle>
<init-param>
<name>cfcName</name>
<value>portlets.filter.ExampleFilter</value>
</init-param>
</filter>
Add filter mapping, that filter applied to particular portlet.
<!-- Applies Example Filter to All Portlets -->
<filter-mapping>
<filter-name>Example ColdFusion Filter</filter-name>
<portlet-name>*</portlet-name>
</filter-mapping>
ExampleFilter.cfc:
The following is the ExampleFilter.cfc mentioned in the portlet.xml.
Last updated 8/5/2010
911

Advertisement

Table of Contents
loading

Table of Contents