Embedded HTTP server

From WandoraWiki
(Difference between revisions)
Jump to: navigation, search
(Services)
(See also)
Line 125: Line 125:
 
== See also ==
 
== See also ==
  
* [[Setting up Wandora Piccolo server|Wandora Piccolo]] is a framework for integrating Wandora with Apache Tomcat.
+
* [[Wandora modules framework]] is a framework for integrating Wandora with Apache Tomcat, or some other servlet container.
 +
* [[Setting up Wandora Piccolo server|Wandora Piccolo]] is a similar older framework but has been deprecated in favour of the modules framework.
  
 
__NOTOC__
 
__NOTOC__

Revision as of 17:12, 25 March 2014

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.

You can configure several different services on the built-in server. These provide different methods of access to the open topic map. These include browsing the topic map through HTML pages, a SOAP based web service access, an RSS feed, a special service for Wandora Drupal extras and a service for the Wandora Firefox plugin. These are explained in more detail below.

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. Screen capture below demonstrates actual server settings dialog window in Wandora application.


Server settings.gif


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. The service specific settings have a similar option. If the global local only option is set then all services are only available through local connection regardless of their settings. If the global option is not set, then the service specific settings are used.
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

Server path The path that contains the service configuration files. By default the path is resources/server/. You will need to completely restart Wandora after changing this.

In addition to the global server settings, each service has their own settings. Some of these options are common to all services.

Option Description
Enabled Use this to enable or disable this service.
Local only Check this to only allow local connections. See the server wide similar option for more details.
User You can provide a user name and password required to login to the service. Note that these are stored in plain text in the options file. Also, unless you use the SSL option, they are also sent in plain text through the net.
Password See User above.
Handler The Java class that handles this service. Leave blank for the default handler. Service classes should implement the WebAppHandler interface.

Depending on the chosen handler, there may be other service specific options too. These are explained below.

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.

Services

By default Wandora's embedded HTTP server supports service modules:

You can configure services in Wandora application using menu option Server > Server settings.... You can also edit services directly in directory resources/server where each service has it's own folder. To apply manual changes you need to restart Wandora application. If service is enabled, you can access the service with it's URL. The URL has a form http://host:port/service-name. For example, the HTML service module (named as topic) at localhost and the default port can be accessd with URL http://localhost:8898/topic. Depending on the service, you generally can add service specific paths or parameters to the service URL.

Setting up new service modules

Wandora reads all services from folder resources/server. This folder contains one folder for each service module. Each service folder contains at least config.xml specifying options for the output module. For example default service topic contains config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<options>
  <enabled>true</enabled>
  <template>viewtopic.vhtml</template>
  <user></user>
  <password></password>
  <localonly>true</localonly>
</options>

Configuring embedded HTTP server in Wandora application allows you to change all options in config.xml. If you decide to edit configuration file manually, you need to restart Wandora application in order to apply changes. However, you can't create nor delete services with Wandora application. Service creation and deletion requires manual actions. To set up yet another parallel service for Wandora's embedded HTTP server follow next steps

  • Create a folder in resources/server. Folder name will be service's name. You'll be accessing the service using it's name. For example, if you create a folder my-service in resources/server, your service is called my-service and you have to access the service with URL
http://127.0.0.1:8898/my-service
  • Create a configuration file config.xml in the service directory. The configuration file is important as Wandora application recognizes services only if they have a valid configuration file. Enter appropriate XML elements and content to the configuration file. You can always take a look at the existing services if you are unsure about required options.
  • Create all other files such as templates, graphics etc. required by your service. Generally, if you create a template based output service such as topic, you need to create at least one Velocity template file.
  • Restart Wandora application.
  • Start Wandora's embedded HTTP server and try to access your brand new service. Remember that the service must be enabled.

Known Issues

It seems that Windows Vista maps localhost to an IPv6 address "::1". To solve the problem change all references from localhost to 127.0.0.1 or to actual IP address. You can change this behavior by editing C:\Windows\System32\drivers\etc\hosts file and making localhost resolve to 127.0.0.1. Note that you will need to do this as an administrator user. Or you might just access address 127.0.0.1 instead of locahost with your WWW browser.

See also

  • Wandora modules framework is a framework for integrating Wandora with Apache Tomcat, or some other servlet container.
  • Wandora Piccolo is a similar older framework but has been deprecated in favour of the modules framework.


Personal tools