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 ConfigStatement extends Statement{ 45 private final String _errmsg; 46 private final String _sizefmt; 47 private final String _timefmt; 48 49 private ConfigStatement(String errmsg, String sizefmt, String timefmt) 50 { 51 _errmsg = errmsg; 52 _sizefmt = sizefmt; 53 _timefmt = timefmt; 54 } 55 56 static Statement create(HashMap <String ,String > attr, Path path) 57 { 58 return new ConfigStatement(attr.get("errmsg"), 59 attr.get("sizefmt"), 60 attr.get("timefmt")); 61 } 62 63 70 public void apply(WriteStream out, 71 HttpServletRequest request, 72 HttpServletResponse response) 73 throws IOException , ServletException 74 { 75 if (_sizefmt != null) 76 request.setAttribute("caucho.ssi.sizefmt", _sizefmt); 77 78 if (_timefmt != null) 79 request.setAttribute("caucho.ssi.timefmt", _timefmt); 80 } 81 } 82 | Popular Tags |