|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.genesyslab.platform.commons.protocol.AbstractChannel
com.genesyslab.platform.commons.protocol.ServerChannel
com.genesyslab.platform.webmedia.protocol.ChatProtocolsListener
public class ChatProtocolsListener
Customized ServerChannel component for handling of Genesys Chat Server protocols - Flex Chat and Basic Chat.
It accepts connections of the both client types at a same time.
Here is a simple example of synchronous server side procedure:
Note that it's also possible to do asynchronous server requests handling.
int LISTEN_PORT = 7100;
ChatProtocolsListener chatSrvChannel = new ChatProtocolsListener(
new WildcardEndpoint("ChatServer", LISTEN_PORT));
chatSrvChannel.setClientRequestHandler(new ClientRequestHandler() {
public void processRequest(final RequestContext context) {
final Message request = context.getRequestMessage();
Integer refId = null;
if (request instanceof Referenceable) {
refId = (Integer) ((Referenceable) request).retreiveReference();
}
Message response = null;
// Do handle the 'request' and create 'response' for it...
if (response != null) {
if ((refId != null) && (response instanceof Referenceable)) {
((Referenceable) response).updateReference(refId);
}
try {
context.respond(response);
} catch (final ProtocolException ex) {
// handle the exception
}
}
}});
chatSrvChannel.open();
The RequestContext may be passed to some asynchronous task,
and than handled and responded in a user defined executor service.
BasicChatProtocol
,
FlexChatProtocol
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.genesyslab.platform.commons.protocol.AbstractChannel |
---|
AbstractChannel.AsyncErrorNotifier |
Field Summary |
---|
Fields inherited from interface com.genesyslab.platform.commons.protocol.Channel |
---|
DEFAULT_TIMEOUT, INFINITE_TIMEOUT |
Fields inherited from interface com.genesyslab.platform.commons.protocol.Receiver |
---|
DEF_INPUT_SIZE |
Constructor Summary | |
---|---|
ChatProtocolsListener(Endpoint endpoint)
|
Method Summary |
---|
Methods inherited from class com.genesyslab.platform.commons.protocol.ServerChannel |
---|
addListener, applyConfiguration, beginClose, beginOpen, clearInput, close, close, closeClientChannels, closeListener, getChannels, getInputSize, getLocalEndPoint, getProtocolDescription, getProtocolFactory, modifyNewChannel, open, open, receive, receive, receiveRequest, receiveRequest, releaseReceivers, removeListener, resetReceiver, send, sendToChannelsExcept, sendToChannelsExcept, setClientRequestHandler, setInputSize, setReceiver |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.genesyslab.platform.commons.protocol.Channel |
---|
getTimeout, setTimeout |
Methods inherited from interface com.genesyslab.platform.commons.protocol.AsyncChannel |
---|
getState |
Methods inherited from interface com.genesyslab.platform.commons.protocol.ChannelListenerSupport |
---|
addChannelListener, removeChannelListener |
Methods inherited from interface com.genesyslab.platform.commons.protocol.EndpointSupport |
---|
getEndpoint, setEndpoint |
Methods inherited from interface com.genesyslab.platform.commons.protocol.ConfigurationSupport |
---|
configure, getConfiguration |
Constructor Detail |
---|
public ChatProtocolsListener(Endpoint endpoint)
|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |