Package com.smartfoxserver.v2.extensions
Class BaseClientRequestHandler
- java.lang.Object
-
- com.smartfoxserver.v2.extensions.BaseClientRequestHandler
-
- All Implemented Interfaces:
IClientRequestHandler
- Direct Known Subclasses:
SignUpAssistantComponent
public abstract class BaseClientRequestHandler extends java.lang.Object implements IClientRequestHandler
Using the new SFSExtension base class allows extension developers to register separate request handlers for each possible client request. This allows better code organization and maintainability. By extending the BaseClientRequestHandler class the developer has direct access to the useful parent class' methods such as send(), trace() etc...
-
-
Constructor Summary
Constructors Constructor Description BaseClientRequestHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ISFSApigetApi()Get a reference to the main server side APIprotected org.slf4j.LoggergetLogger()Obtain a direct reference to the Extension's loggerSFSExtensiongetParentExtension()Obtain a reference to the parent extension.protected voidsend(java.lang.String cmdName, ISFSObject params, User recipient)Send a response back to a Userprotected voidsend(java.lang.String cmdName, ISFSObject params, User recipient, boolean useUDP)Send a response back to a Userprotected voidsend(java.lang.String cmdName, ISFSObject params, java.util.List<User> recipients)Broadcast a response back to multiple Usersprotected voidsend(java.lang.String cmdName, ISFSObject params, java.util.List<User> recipients, boolean useUDP)Broadcast a response back to multiple UsersvoidsetParentExtension(SFSExtension ext)protected voidtrace(ExtensionLogLevel level, java.lang.Object... args)Trace a message to the console and log files using the specified logging levelprotected voidtrace(java.lang.Object... args)Traces a message to the console and log files using the Logger INFO level-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.smartfoxserver.v2.extensions.IClientRequestHandler
handleClientRequest
-
-
-
-
Method Detail
-
getParentExtension
public SFSExtension getParentExtension()
Obtain a reference to the parent extension.- Specified by:
getParentExtensionin interfaceIClientRequestHandler- Returns:
- a reference to the parent extension
-
setParentExtension
public void setParentExtension(SFSExtension ext)
- Specified by:
setParentExtensionin interfaceIClientRequestHandler
-
getApi
protected ISFSApi getApi()
Get a reference to the main server side API- Returns:
- the server side API object
-
send
protected void send(java.lang.String cmdName, ISFSObject params, User recipient)Send a response back to a User- Parameters:
cmdName- name of the "command" (or action id)params- the parametersrecipient- the recipient User
-
send
protected void send(java.lang.String cmdName, ISFSObject params, java.util.List<User> recipients)Broadcast a response back to multiple Users- Parameters:
cmdName- name of the "command" (or action id)params- the parametersrecipients- a list of recipients
-
send
protected void send(java.lang.String cmdName, ISFSObject params, User recipient, boolean useUDP)Send a response back to a User- Parameters:
cmdName- name of the "command" (or action id)params- the parametersrecipient- the recipient UseruseUDP- if true the message will be sent as an UDP packet (default == TCP)
-
send
protected void send(java.lang.String cmdName, ISFSObject params, java.util.List<User> recipients, boolean useUDP)Broadcast a response back to multiple Users- Parameters:
cmdName- name of the "command" (or action id)params- the parametersrecipients- a list of recipientsuseUDP- if true the message will be sent as an UDP packet (default == TCP)
-
trace
protected void trace(java.lang.Object... args)
Traces a message to the console and log files using the Logger INFO level- Parameters:
args- any number of strings/object to trace
-
trace
protected void trace(ExtensionLogLevel level, java.lang.Object... args)
Trace a message to the console and log files using the specified logging level- Parameters:
level- the logging levelargs- any number of object to trace
-
getLogger
protected org.slf4j.Logger getLogger()
Obtain a direct reference to the Extension's logger- Returns:
- the logger object.
-
-