Ejemplo n.º 1
0
 PageInfo getPageInfo(ScriptContext context, String path) throws IOException {
   PageInfo info = null;
   if (pageInfoCache != null) info = this.pageInfoCache.get(path);
   if (info == null) {
     String file = prefix + path + suffix;
     String actualPath = FileHelper.findRecursive(file);
     String source = FileHelper.read(actualPath);
     Object object = context.evaluate(source, path);
     info = new PageInfo((BaseFunction) object, actualPath);
     if (pageInfoCache != null) pageInfoCache.put(path, info);
   }
   return info;
 }
Ejemplo n.º 2
0
 void serve(
     HttpServletRequest request,
     HttpServletResponse response,
     ScriptContext context,
     String path,
     Exception error)
     throws IOException {
   PageInfo info = getPageInfo(context, path);
   context.put("request", request);
   context.put("response", response);
   context.put("path", path);
   context.put("servlet", this);
   context.put("__filename", info.path);
   context.put("__pagepath", getPagePath(info.path));
   if (error != null) context.put("error", error);
   context.call(info.function);
 }