How to call standard Java classes from Ecmascript
How to import external libraries into scripts
To import Java classes from Ecmascript, use importPackage() statement on top of your script. For example, with Ecmascript:
Java classes can then be instatiated directly:
var url = new java.net.URL("http://www.google.com");
var connection = url.openConnection();
var reader = new java.io.BufferedReader(new java.io.InputStreamReader( connection.getInputStream()));
var response = new StringBuilder();
Can I use my preferred editor to developp scripts (vim, eclipse, ...) ?
To extend GreasySpoon with external jar libraries, simply copy your jar files into $gs/lib and import them in your scripts.
For example, saying you want to add html parser from http://htmlparser.sourceforge.net:
- download and copy htmlparser.jar and htmllexer.jar to $gs/lib. Libraries will be added in real time to GreasySpoon engine (no restart needed).
- Import and call your libraries in your scripts using
Note: Adding external packages does not require to restart GreasySpoon, except when upgrading an already loaded lib. In that case, stop greasyspoon, include the new library version then restart greasyspoon.
Yes. Scripts are located in $gs/serverscripts directory, and can be edited directly whatever the edition tool you want to use.
How to synchronize scripts between several GS servers ?
Just take care not to alter control header and to use UTF-8 encoding when saving your script.
Changes made by that way will also be detected in real time.
GreasySpoon scripts are located by default in $gs/serverscripts directory, and scripts modifications are monitored by GS.
Squid authenticated user is not displayed in GS
To synchronize multiple instances, easiest way is to use a shared directory using NFS for example.
Any alternative like rsync or similar solutions will also work.
Can I call services on https ?
In squid.conf, uncomment or add following line:
On GreasySpoon side, in services.properties file, configure following line:
Reload both to make changes effective.
Can I work on binary content ?
Yes, using an HTTP proxy supporting this feature and specific configurations.
This feature is supported since Squid 3.1.x, see Squid configuration
WARNING: SSL bump might be illegal or create security flaw for your users. It should not be done without end-user's knowledge and agreement, or for domains which you are not the authority owner.
No, GreasySpoon was designed to only handle textual content.
Help ! GreasySpoon is too slow
If you need to handle binary content, consider using L3WS WebflowAdapter ICAP Server instead.
While GreasySpoon engine was able to provide production compatible performances, the core engine has not evolved since several years now.
I'm getting an error with GreasySpoon / Squid / ...
If you are getting poor performances with GreasySpoon, consider using WebflowAdapter instead.
GreasySpoon project is no longer maintain/supported since several years now.
In case of issue, you can check its source code to to fix it by yourself, as L3WS will by no mean provide support or maintenance on Greasyspoon.
Otherwise, consider using L3WS WebflowAdapter ICAP Server instead.
I can't find any documentation for GreasySpoon
Please take time to browse and read this site.
If you don't know where to start, install GS and have a look on provided samples, which provides short still complete enough examples
to give you the basics to build up your first services.
If you don't have time to do that, please consider switching to L3WS WebflowAdapter ICAP Server solution.