Hey,
We have an extension for creating a user. I call into it from a java servlet with
sfs.getZone("SOTL").getExtension("sotl_db").handleRequest("signup", params, null, 0);
where params is a java string[] with the user details. The problem is I don't see how to get a success/fail message back. Our code currently tries to send a response back to the calling user:
_server.sendResponse(response, -1, null, [$user]);
but the problem here is I passed in a null for the user so I get a null pointer exception. We can take out that response but I don't know how I'm supposed to find out if the user creation failed.
I could create a special user for this purpose but I don't see how to call the constructor since I don't know what this socket parameter is supposed to take.
Are there docs that show sending a message and getting a response? The only examples I found were calling handleInternalRequest which seems to be something entirely different and it only takes one parameter with no example showing what that parameter would be.
thanks for any pointers!
Brad
How to call an extension and get a success/fail back
The recommended way is to use the handleInternalRequest() method as explained here: http://www.smartfoxserver.com/docs/docP ... bility.htm
The method allows a return value.
The method allows a return value.
Lapo wrote:The recommended way is to use the handleInternalRequest() method as explained here: http://www.smartfoxserver.com/docs/docP ... bility.htm
The method allows a return value.
I saw a null pointer exception but after checking into it I found that the very most fundamental call is returning null!
sfs = SmartFoxServer.getInstance()
this is always null. Is there a configuration file I'm supposed to set up before this method will work?
bmidgley wrote:Lapo wrote:The recommended way is to use the handleInternalRequest() method as explained here: http://www.smartfoxserver.com/docs/docP ... bility.htm
The method allows a return value.
I saw a null pointer exception but after checking into it I found that the very most fundamental call is returning null!
sfs = SmartFoxServer.getInstance()
this is always null. Is there a configuration file I'm supposed to set up before this method will work?
I should just review that I'm doing a pure java servlet deployed inside jetty. I copied jysfs.jar, json.jar, json-lib-2.1-jdk15.jar to WEB-INF/lib from the server and added these to the classpath so the build will work. I'm using SFS_PRO_1.6.6 for x86-64 and sun java 1.6.0_17-b04 under ubuntu 8.04.
Return to “Server Side Extension Development”
Who is online
Users browsing this forum: No registered users and 43 guests