1 29 30 package com.caucho.servlets.ssi; 31 32 import com.caucho.vfs.Path; 33 import com.caucho.vfs.WriteStream; 34 35 import javax.servlet.ServletException ; 36 import javax.servlet.http.HttpServletRequest ; 37 import javax.servlet.http.HttpServletResponse ; 38 import java.io.IOException ; 39 import java.util.HashMap ; 40 41 44 public class EchoStatement extends Statement{ 45 private final VarExpr _var; 46 47 private EchoStatement(VarExpr var) 48 { 49 _var = var; 50 } 51 52 static Statement create(HashMap <String ,String > attr, Path path) 53 { 54 String var = attr.get("var"); 55 56 if (var == null) 57 return new ErrorStatement("['var' is a required attribute of #echo]"); 58 59 return new EchoStatement(new VarExpr(var, path)); 60 } 61 62 69 public void apply(WriteStream out, 70 HttpServletRequest request, 71 HttpServletResponse response) 72 throws IOException , ServletException 73 { 74 out.print(_var.evalString(request, response)); 75 } 76 } 77 | Popular Tags |