Exemplo n.º 1
0
 public void initEngine() {
   bsfUtil = BSFUtil.getInstance();
   engineInited = true;
   set("request", request);
   set("session", request.getSession());
   set("velcontext", ctx);
 }
Exemplo n.º 2
0
 public void set(String key, Object val) {
   if (!engineInited) {
     initEngine();
   }
   try {
     bsfUtil.declareBean(key, val);
   } catch (BSFException e) {
     Logger.error(this, e.getMessage(), e);
   }
 }
Exemplo n.º 3
0
 /**
  * Evaluates a file of code and returns the value of the last expression with the exception of PHP
  * which returns the wrapper object. You can do this instead of executing the file. Like the
  * execFile the file should now be cached with the key being the filePath.
  *
  * @param filePath - dotCMS file path
  * @return The last call of the
  */
 protected Object evalFile(String filePath) {
   if (!engineInited) {
     initEngine();
   }
   try {
     return bsfUtil.evalFile(filePath, host);
   } catch (BSFException e) {
     Logger.error(this, e.getMessage(), e);
   } catch (Exception e) {
     Logger.error(this, "Problem reading the file : " + e.getMessage(), e);
   }
   return null;
 }