The EntranceServlet

(Please be aware that EntranceServlet is changing soon! Watch for another blog post)

The same scripts you use to make charts in the Entrance Desktop application can be used in the Entrance web application to serve up charts. These charts can be embedded in web pages using HTML IMG tags, just as you would any other image.

The Entrance web application requires Java and a servlet container, like Tomcat or Jetty. To install it, decide on the settings for these parameters:

Name Required? Description
script-root Yes The path to the Entrance script directory. The servlet will only execute scripts from this directory and its subdirectoies.
jdbc-url Yes A JDBC URL. The servlet will only execute scripts from this connection URL. eg. jdbc:mysql://localhost/test
username No The username used to connect to the database, defaults to ‘root’
password No The Password used to connect to the database, defaults to ” (empty string)
allowparameter   No True to allow parameter substituion, using
param.(parameter name)=(value)
 syntax.
WARNING:
Set this ‘true’ only when you are not concerned about “SQL Injection” attacks. If you need parameters, use PreparedStatements and make calls to the Entrance API instead. Defaults to false.

Use the “Install Servlet” tool, in the Entrance Desktop X Menu to make an Entrance Web Application Archive (WAR) file with the settings you want. (If you don’t see it there, follow the instructions below for adding it):

If you don’t have write permissions for the webapps directory on your server, write the Entrance WAR file somewhere else, eg. your home directory, then copy it as a super user.

After deploying Entrance, start and stop the server, then navigate your web browser to:

    http://(the URL of your server)/entrance/

You should see the Entrance welcome screen, which includes a link to a rowser that will let you see the PLOT scripts you have installed.

Use the normal HTML IMG tag to embed Entrance dynamic charts in a web page as you would any online PNG image. Image URLs take the form:

    http://(your server)/entrance/plot/(path to script)

where the ‘path’ is the page from script-root to the script.

Here’s a tip: If you are running Entrance Desktop on the machine where you are running the Entrance web application, add the script-root directory to the Entrance tree using File | Add folder… It will be easy to find and edit Entrance scripts. We’ve used this with remote desktops, too!

Adding InstallServletX
If you have upgraded Entrance from an older version, the installer servlet will not appear in the X Menu unless you have added it. To add the installer: Select “Edit this menu…” from the X Menu, then fill in the dialog that appears to match this:

Editing web.xml
There can be cases when you want to edit the web.xml file youself, without relying on InstallServelX to write the file for you. For example, this is the way to specify mutliple Entrance servlet contexts using different url/user/password combinations. If you need help with this, contact us at “support at entrance.com” or send email to the Entrance Google Group.

Comments are closed.