Quick Start

Example

For those that wish to kick the tyres (so to speak) of routemaster, the easiest way to see what the routemaster is capable of, is to download the example jar and run it up. The example jar can be found in the: github releases directory (look for the routemaster-<version>-example.jar) file and download it.

Now simply run:

java -jar routemaster-<version>-example.jar

And browse to http://localhost:5474/ to see the site up and running.

This example jar also includes the templar templating language to do server side includes. This makes it easier to cut up your HTML pages into snippets and import them before rendering the code.

Code and Configuration

Routemaster is broken into two parts:

  1. The command line options, and
  2. The configuration

Command line options

This will run the web server with the following defaults:

Port
The default port is set to 5474, this can be over-ridden by passing a command line parameter of --port or -p
Host
The default host is 127.0.0.1 (i.e. localhost), this can be over-ridden by passing a command line parameter of --host or -h
Root Directory
The default directory from where the static content (if applicable) is served from is . (i.e. the current working directory from where the java command is run), this can be over-ridden by passing a command line parameter of --dir or --d.

To configure the routemaster web server, you will need to include a routemaster.properties file either in the root directory, or in root of the classpath.

If you do not provide a routemaster.properties file, then the example file will be used from the jar. routemaster will also write this file to the file system if it cannot find it with the classpath. This provides a starting point in configuring the web server to get you up and running quickly.

IMPORTANT NOTE: The classpath routemaster.properties ALWAYS takes precedence over the file-system resource.

mimetypes.properties

Default mimetype mappings are also included in the distribution, and if the mimetypes.properties file does not exist in the classpath, or the filesystem, one will be written out, and the default included resource will be used.

Now you should have a look at the Configuration section.

Or if you want to skip ahead - then read the Putting it all Together section.