/*
* BeanShellHandler.java
*
* Brazil project web application toolkit,
* export version: 2.3
* Copyright (c) 2002-2006 Sun Microsystems, Inc.
*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License Version
* 1.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is included as the file "license.terms",
* and also available at http://www.sun.com/
*
* The Original Code is from:
* Brazil project web application toolkit release 2.3.
* The Initial Developer of the Original Code is: suhler.
* Portions created by suhler are Copyright (C) Sun Microsystems, Inc.
* All Rights Reserved.
*
* Contributor(s): suhler.
*
* Version: 2.3
* Created by suhler on 02/02/14
* Last modified by suhler on 06/11/13 15:09:44
*
* Version Histories:
*
* 2.3 06/11/13-15:09:44 (suhler)
* move MatchString to package "util" from "handler"
*
* 2.2 04/11/30-15:19:37 (suhler)
* fixed sccs version string
*
* 2.1 02/10/01-16:39:55 (suhler)
* version change
*
* 1.2 02/02/14-15:01:59 (Codemgr)
* SunPro Code Manager data about conflicts, renames, etc...
* Name history : 1 0 beanshell/BeanShellHandler.java
*
* 1.1 02/02/14-15:01:58 (suhler)
* date and time created 02/02/14 15:01:58 by suhler
*
*/
package sunlabs.brazil.beanshell;
import java.io.IOException;
import sunlabs.brazil.util.MatchString;
import sunlabs.brazil.handler.ResourceHandler;
import sunlabs.brazil.server.Handler;
import sunlabs.brazil.server.Request;
import sunlabs.brazil.server.Server;
import bsh.EvalError;
import bsh.Interpreter;
/**
* The BeanShellHandler
* permits handlers to be written in "beanshell".
*
* The reason one would write a BeanShell handler, instead of * coding the handler directly in Java, is for ease of handler development * and maintanence; a BeanShell handler may be modified at will while the * server is running, permitting rapid development. Once functional, * the code is easily converted into a traditional handler. *
* The beanshell script is expected to contain both init
* and respond
methods, which are invoked by the server
* just like an ordinary handler.
*
* script
is re-read on each request, and a new interperter is
* created and initialized. The call to init
is
* deferred until request time, and called before each
* call to respond
.
* This allows beanshell scripts to be debugged interatively * from scratch. *