1 11 package org.apache.catalina.ssi; 12 13 14 import java.io.IOException ; 15 import java.io.PrintWriter ; 16 25 public final class SSIInclude implements SSICommand { 26 29 public long process(SSIMediator ssiMediator, String commandName, 30 String [] paramNames, String [] paramValues, PrintWriter writer) { 31 long lastModified = 0; 32 String configErrMsg = ssiMediator.getConfigErrMsg(); 33 for (int i = 0; i < paramNames.length; i++) { 34 String paramName = paramNames[i]; 35 String paramValue = paramValues[i]; 36 String substitutedValue = ssiMediator 37 .substituteVariables(paramValue); 38 try { 39 if (paramName.equalsIgnoreCase("file") 40 || paramName.equalsIgnoreCase("virtual")) { 41 boolean virtual = paramName.equalsIgnoreCase("virtual"); 42 lastModified = ssiMediator.getFileLastModified( 43 substitutedValue, virtual); 44 String text = ssiMediator.getFileText(substitutedValue, 45 virtual); 46 writer.write(text); 47 } else { 48 ssiMediator.log("#include--Invalid attribute: " 49 + paramName); 50 writer.write(configErrMsg); 51 } 52 } catch (IOException e) { 53 ssiMediator.log("#include--Couldn't include file: " 54 + substitutedValue, e); 55 writer.write(configErrMsg); 56 } 57 } 58 return lastModified; 59 } 60 } | Popular Tags |