2.3 Configuration: the http server
From version 1.5.0 SmartFoxServer embeds a powerful and efficient web server (based on Jetty) that can be used for serving static and dynamic web pages. The http server is also tightly integrated with SmartFoxServer so that you can easily handle file uploads in server side extensions and even create web pages that talk to the server and a lot more...
Additionally the webserver is also integrated with a Python engine (based on Jython) that allows to quickly develop dynamic web pages using the popular scripting language (of course you can user regular Java servlets if you prefer)
» Web server setup
The web server can be easily configured from the main config.xml file:
<WebServer active="true"> <CfgFile>webserver/cfg/jetty.xml</CfgFile> </WebServer>
The active attribute turns on/off the webserver.
The
<CfgFile> tag specifies where the http server config file is located. We don't recommend to change this unless you really know what you're doing.
» Web server configuration
By default the web server will run on the same IP address used by SmartFoxServer on port 8080.
You can change the port number and many other settings by editing its configuration file called jetty.xml inside the the Server/webserver/cfg/ folder.
To test if the server is running just open a web browser and try loading the following url: http://127.0.0.1:8080, you should see a simple welcome page.
Due to the large amount of configuration parameters that are available in Jetty, we recommend to visit its official website and check their online documentation for a better insight of all the available settings. (In particular this section)
» Web applications folder layout
Inside the webserver/ folder you will find a webapps/ directory which contains different sub-folders.
You can also add your own servlets by adding a new folder and its WEB-INF/ subfolder that describes the servlet mapping configuration.
Here are a few resources that can help you getting started:
Introduction to Java Servlets -> http://www.informit.com/articles/article.asp?p=29817&rl=1
Python / Jython servlets -> http://www.samspublishing.com/articles/article.asp?p=26865&rl=1
Python quick tutorial -> http://hetland.org/python/instant-python.php
More Python tutorials -> http://heather.cs.ucdavis.edu/~matloff/python.html
The official Python tutorials -> http://www.python.org/doc/tut/
doc index |