servlet question

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Democre
Posts: 77
Joined: 16 Sep 2010, 17:58

servlet question

Postby Democre » 08 Dec 2010, 17:34

Can you suggest a good place to start with making a servlet to interact with a zone or room extension in SFS2X?

I want to avoid editing my game's db directly, and force it to go through some game logic.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 09 Dec 2010, 03:51

Can you better explain what you need to do?
If you need to access the DB in 99.9% of the cases you should use a server Extension:
http://docs2x.smartfoxserver.com/Advanc ... extensions
Lapo
--
gotoAndPlay()
...addicted to flash games
Democre
Posts: 77
Joined: 16 Sep 2010, 17:58

Postby Democre » 09 Dec 2010, 04:27

Certainly, I would like to accept payment through a 3rd party postback url. I would like to get the DBManager from the appropriate zone extension.

In 1.6, this would have been done using smartfoxserver.getInstance() and finding the zone extension from there, and then calling handleInternalEvent.

Is there a similar mechanism exposed to servlets running in the embedded SFS2X webserver?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 09 Dec 2010, 04:38

Yes, same exact system.
The SmartFoxServer.getInstance() is always there. :)

I would suggest something like:

Code: Select all

Zone myZone = SmartFoxServer.getInstance().getZoneManager().getZoneByName("MyZone");
SFSExtension ext = myZone.getExtension();
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 62 guests