1 package de.webman.generator.eventhandler; 2 3 import java.io.*; 4 import java.net.*; 5 6 import com.teamkonzept.lib.*; 7 import com.teamkonzept.web.TKEvent; 8 import com.teamkonzept.web.TKHttpInterface; 9 import com.teamkonzept.webman.*; 10 import com.teamkonzept.webman.mainint.*; 11 import com.teamkonzept.webman.mainint.events.*; 12 13 18 public class GRValidateHandler extends DefaultEventHandler 19 { 20 private static GRValidateHandler instance = new GRValidateHandler(); 21 22 private GRValidateHandler() 23 { 24 } 25 26 public static GRValidateHandler getInstance() 27 { 28 return instance; 29 } 30 31 public void handleEvent(TKEvent evt) throws TKException 32 { 33 try 34 { 35 WebManEvent.checkEvent(evt.getRemoteUser(), evt.getName(), ContextConstants.GENERATOR); 36 37 TKHttpInterface httpInf = evt.getHttpInterface(); 38 PrintWriter out = new PrintWriter(httpInf.getOutputStream()); 39 PrintWriter log = new PrintWriter(httpInf.getLogStream()); 40 41 println(out, getHeaderString()); 42 43 ProcessStarter ps = new ProcessStarter(out, log); 44 boolean successful = false; 45 try { 46 String args = httpInf.getDocumentRoot() + " htmlOut"; 47 successful = ps.start("WebManValidator", args, 48 ProcessStarter.getWMClasspath(httpInf.getDocumentRoot())); 49 } 50 catch (Exception e) { 51 println(out, e.toString()); 52 log.println(e); 53 } 54 55 println(out, getReturnString(httpInf.getOwnName())); 58 println(out, getFooterString()); 59 60 out.close(); 61 log.close(); 62 } 63 catch (Throwable e) 64 { 65 throw WebmanExceptionHandler.getException(e); 67 } 68 } 69 70 public boolean isHandler(TKEvent evt) 71 { 72 return evt.getName().equalsIgnoreCase("GR_VALIDATE"); 73 } 74 75 private String getHeaderString() 76 { 77 return "<HTML><HEAD><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\"><META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\"></HEAD><BODY>"; 78 } 79 80 private String getFooterString() 81 { 82 return "</BODY></HTML>"; 83 } 84 85 private String getReturnString(String backpath) 86 { 87 return "<A HREF=\"" + backpath + "\">zurück zum WebMan-Menu</A><br>"; 88 } 89 90 private void println(PrintWriter out, String line) 91 { 92 out.println(line); 93 } 94 } 95 | Popular Tags |