-
Notifications
You must be signed in to change notification settings - Fork 0
ServletDocumentation
Documentation of the DatabaseWiki servlet interface
The servlet interface for the Database Wiki was written mainly to get rid of the dependence on the non-standard com.sun.net.httpserver framework the project has been using. This brings the possibility to run the whole system on a more standard servlet engine such as Apache Tomcat, while also making it potentially easier to run on a cloud-based service, such as Google App Engine.
The main difference between the old and current approach is that the system is now using only one handler (in WikiServerServlet) which propagates requests to specific DatabaseWiki instances, instead of using a pre-set context handler for every DatabaseWiki class instance. This way the system is able to run as a single servlet application.
The main introduced classes are following:
-
org.dbwiki.main.ServletInterface- the servlet entry-point; containsHttpServletmethods that handle initialization, as well as all GET/POST requests. -
org.dbwiki.web.server.WikiServerServlet- subclass of the coreWikiServerclass with a servlet request handler. This is where the requests get either processed immediately or are propagated to a certainDatabaseWikiServletinstance if it is aDatabaseWikirequest. -
org.dbwiki.web.server.DatabaseWikiServlet- instance of a coreDatabaseWikiclass with a servlet-tuned request handler. -
org.dbwiki.web.server.ServletExchangeWrapper- a wrapper around the coreorg.dbwiki.web.request.Exchangeclass that provides methods needed for proper http exchange (used inRequestURL). -
org.dbwiki.web.server.HtmlServletSender- a basic html page sender throughHttpServletResponse. -
org.dbwiki.web.security.WikiServletAuthenticator- an authenticator class that checks whether a specific servlet request requires the user to be authenticated in order to provide a response. EveryDatabaseWikiServletinstance uses its own authenticator.
See DatabaseWikiInternals for explanation of the internal Database Wiki classes.
- subversion installation
- javac/JDK (Java 1.6)
- ant
- postgreSQL (>= 8.4)
- Apache Tomcat
- a standards-compliant web browser
Instructions differ only in the system deployment and Tomcat configuration:
-
Check out sources:
svn checkout https://database-wiki.googlecode.com/svn/trunk/database-wiki dbwiki cd dbwiki -
Install and configure PostgreSQL; create a PostgreSQL user and a database owned by that user. Give the user a password. Make sure the server is running and the password is correct before proceeding. If you want to use a remote database then you may need to ask its administrator to do this for you, if not, consult the PostgreSQL documentation.
-
Create config and initial user list files:
cd resources/configuration/server cp config.sample config cp users.sample users -
Edit config so that JDBC_USER is the username and JDBC_PASSWORD is that user's password. If the PostgreSQL server you want to use is remote, then change JDBC_URL to point to the appropriate host instead of localhost.
-
Change back to the root of the source tree and initialize the database. This should succeed with no output if everything is configured correctly. You can confirm this by checking that the three
'_*'tables have been added to the dbwiki database.cd ../../.. ./create-server.sh -
Build and deploy the package:
ant build-war cp dist/DatabaseWiki.war <tomcat>/webapps -
Configure Tomcat to make Database Wiki the root application. Add the following line under
<Host>to conf/server.xml in the Tomcat installation folder:<Context path="" docBase="DatabaseWiki" reloadable="true"></Context> -
Restart Tomcat:
/etc/init.d/tomcat7 restart -
Test that the server is running correctly by visiting:
http://localhost:8080 -
Once you've confirmed that the server is running correctly you can load some data. See LoadingData or QueryVisualizationTutorial.