ColdFusion 9.0 Resources |
setCFCMethodSee alsogetCFCMethod, setCFCPath, setCFCTimeout, CFML CFEvent structure, CFEvent class in the Developing ColdFusion Applications Parameters
UsageGateways that use a single CFC listener method do not need to use this method if the listener CFC method is named onIncomingMessage. For the sake of consistency, Adobe recommends that any event gateway with a single listener not override this default. A gateway, such as the ColdFusion XMPP gateway, that uses different listener methods for different message types uses this method to identify the destination method. ExampleThe following example code comes from the ColdFusion XMPP gateway incoming message handler. It creates a CFEvent object and sets the method that handles tests based on the message type. CFEvent cfmsg = new CFEvent(gatewayID); cfmsg.setOriginatorID(sender); cfmsg.setGatewayType(gatewayType); if(messageType == IMessage.IM) { // default for normal messages cfmsg.setCfcMethod(onIncomingMessageFunction); } //if the message is an authorization request else if(messageType == IMessage.AUTH_REQUEST) { cfmsg.setCfcMethod(onAddBuddyRequestFunction); message = "Requesting authorization to add '" + recipient + "' to '" + sender + "' buddy list and view '" + recipient + "' presence."; } // Code snipped here for brevity. |