Embedded HTTP server

From WandoraWiki
(Difference between revisions)
Jump to: navigation, search
(Using the server)
Line 58: Line 58:
 
To see the currently open topic in Wandora application request file "/topic". For example, using the default 8898 port and loopback address you would use http://localhost:8898/topic . Note that for this to work you actually must have opened some topic in Wandora application.
 
To see the currently open topic in Wandora application request file "/topic". For example, using the default 8898 port and loopback address you would use http://localhost:8898/topic . Note that for this to work you actually must have opened some topic in Wandora application.
  
To see other than currently open topic, use get parameter ''topic'' with the subject identifier of the topic you would like to see. For example http://localhost:8898/topic?topic=http%3A%2F%2Fwww.wandora.org%2Fcore%2Fschema-type . The default templates will produce links to all other related topics using this link format allowing very easy browsing of the topic map.
+
To see other than currently open topic, use get parameter ''topic'' with the subject identifier of the topic you would like to see. For example http://localhost:8898/topic?topic=http%3A%2F%2Fwww.wandora.org%2Fcore%2Fschema-type . The default templates will produce links to all other related topics using this link format allowing very easy browsing of the topic map. Image below views Firefox with '''Schema type''' topic served by Wandora's embedded HTTP server.
 +
 
 +
 
 +
[[Image:Embedded_http_server_example.gif|center]]

Revision as of 19:58, 3 June 2008

Wandora has a built-in simple http server that can be used to browse a topic map with any web browser or share a topic map.

Note that this server is not designed for large scale web applications, you should use Wandora Piccolo framework and a real servlet container such as Apache Tomcat for that. See Setting up Wandora Piccolo server for more information.

Built-in server uses Velocity templates very much like the Wandora Piccolo framework. This means that in many cases you can use same templates with both.

Configuring the HTTP server

To configure the server, select the Server menu and choose Server settings. The server should work in port 8898 with default settings and allow anonymous but local only connections.

Option Description
Auto start Check this option to have the HTTP server start automatically whenever you start Wandora.
Port The port used by the server.
Local only Check this to only allow local connections. If this is checked, you will most likely need to use the loopback address (127.0.0.1 or localhost) to be able to connect. It is recommended that you either keep this checked or otherwise limit access to the server for example with a firewall.
Use SSL If this is checked, the server will use SSL encryption. This option does not work out of the box. You will need to setup the certificate and encryption keys first. This is done using the keytool utility that should be in bin directory of your Java Development Kit.

For example: keytool -genkey -keystore storefile -keyalg RSA

After you have generated the certificate you need to run java with the following parameters: -Djavax.net.ssl.keyStore=storefile -Djavax.net.ssl.keyStorePassword=password

User name You may optionally set a user name and password. If these are set, server will only accept authorized connections. Note that these are stored in plain text in Wandora settings file. Also they are not encrypted when transmitted over the net unless SSL options is checked. Leave this blank allows anyone to use the server.
Password Password for the user if previous field is not blank.
Static content path Path where static content is stored. This could be style sheets or images needed by the pages.
Template path Path where Velocity templates are stored.
Template The template to use to create topic pages. This should be relative to the path set in previous field.

Starting the server

After you have configured the server you can start it by selecting Server menu and choosing Start server. You can also click the icon in lower right corner. This icon will also indicate server status. Red circle means that server is disabled, green means that the server is running, bright green means that the server handled a request less than one second ago.

If you checked the Auto start option, the server will start automatically whenever you start Wandora.

Using the server

To use the server open a web browser and enter the IP address or name of your machine and the port number specified in server settings. Usually you will have the web browser and Wandora application open in the same machine so you can use the loopback address 127.0.0.1 or localhost.

To see the currently open topic in Wandora application request file "/topic". For example, using the default 8898 port and loopback address you would use http://localhost:8898/topic . Note that for this to work you actually must have opened some topic in Wandora application.

To see other than currently open topic, use get parameter topic with the subject identifier of the topic you would like to see. For example http://localhost:8898/topic?topic=http%3A%2F%2Fwww.wandora.org%2Fcore%2Fschema-type . The default templates will produce links to all other related topics using this link format allowing very easy browsing of the topic map. Image below views Firefox with Schema type topic served by Wandora's embedded HTTP server.


Embedded http server example.gif
Personal tools