servlet guide
From autoplot.org
The most up-to-date demo version is available at: http://autoplot.org/AutoplotServlet/simple.jsp. (Note that this server returns a cached image if this form of the URL is used: http://autoplot.org/cache/AutoplotServlet/simple.jsp.)
The servlet only supports a subset of DataSources (see [1] for explanation):
- BinaryDataSource (flat binary files)
- ImageDataSource
- WavDataSource
- TsdsDataSource
- AsciiDataSource
- Das2StreamDataSource
- SPASEDataSource
Contents |
1 Installation
1.1 Basic
- Build the war file as described here: http://autoplot.org/Autoplot_from_source#Building_Servlet
It's possible this will be slightly different now. Also Apache ant 1.7.1 is required.
- The war file will work with an Apache Tomcat webserver, version 5.5.20 and up.
- Put the war file in the webapps folder. It should be accessible now.
1.2 Caching Images
Apache configuration notes for caching images.
If the servlet is at
http://server/AutoplotServlet/SimpleServlet?url=...
use the URL
http://server/cache/AutoplotServlet/SimpleServlet?url=...
to use a cached image if it exists.
Add the following to the Apache configuration file:
# Clear cache with KEYWORD in the URL string use this:
# su root ; cd /var/cache/apache2/mod_disk_cache; find . -name "*.header" | xargs -i grep -H "KEYWORD" {} | cut -c 13-33 | xargs -i rm -rf {}
CacheRoot /var/cache/apache2/mod_disk_cache
CacheEnable disk /cache
CacheDirLevels 5
CacheDirLength 3
CacheIgnoreNoLastMod On
CacheIgnoreCacheControl On
ExpiresActive on
ExpiresDefault "access plus 1 year"
CacheMaxFileSize 1000000
CacheMinFileSize 0
# Better alternative is used by using a second ProxyPass
# NE means no escape (prevents double escaping of URL).
# RewriteRule ^/cache/AutoplotServlet(.*)$ /AutoplotServlet$1 [R,NE]
Options Indexes FollowSymLinks MultiViews
<Proxy *>
Order Allow,Deny
Allow from all
</Proxy>
ProxyPass /AutoplotServlet ajp://localhost:8009/AutoplotServlet
ProxyPassReverse /AutoplotServlet ajp://localhost:8009/AutoplotServlet
# This second proxy pass causes the following warning:
# (Otherwise caching works as expected.)
# [warn] worker ajp://localhost:8009/AutoplotServlet already used by another worker
# I think this is ok given what I am
# using this for (caching). An explanation of the reason is
# here:
# https://issues.apache.org/bugzilla/show_bug.cgi?id=44350#c6
# If we make it down here, then no image was cached
ProxyPass /cache/AutoplotServlet ajp://localhost:8009/AutoplotServlet
ProxyPassReverse /cache/AutoplotServlet ajp://localhost:8009/AutoplotServlet
2 Parameters
These parameters are specific to the servlet. Other parameters are at api.
- format specifies the return format type
- image/png
- application/pdf
- image/svg+xml
- script does nothing. The idea was an arbitrary script can be run giving complete control of the application, but because the ScriptContext is static (one per java instance), it cannot be supported. This will probably be corrected at some point. Also sandbox security needs to be ensured.
- canvas.aspect. Aspect ratio for the canvas. Aspect is width/height, and simple expressions like '10/3' are handled.
- process specifies a process to apply to the loaded data.
- histogram performs a 100-bin histogram on the data. The data is autoranged to establish min, max and scale type.
- magnitude(fft) displays the frequency content of the data
