1 16 17 18 19 20 21 package org.apache.tester; 22 23 24 25 import java.io.IOException ; 26 27 import java.io.PrintWriter ; 28 29 import java.net.MalformedURLException ; 30 31 import java.net.URL ; 32 33 import javax.servlet.*; 34 35 import javax.servlet.http.*; 36 37 38 39 40 41 58 59 60 61 public class Xerces01 extends HttpServlet { 62 63 64 65 66 67 69 70 71 72 73 92 93 public void service(HttpServletRequest request, 94 95 HttpServletResponse response) 96 97 throws ServletException, IOException 98 99 { 100 101 102 103 105 response.setContentType("text/plain"); 106 107 PrintWriter writer = response.getWriter(); 108 109 boolean ok = true; 110 111 112 113 115 URL url = null; 116 117 try { 118 119 url = getServletContext().getResource("/Xerces01.xml"); 120 121 } catch (MalformedURLException e) { 122 123 writer.println("Xerces01 FAILED - " + e); 124 125 e.printStackTrace(writer); 126 127 ok = false; 128 129 } 130 131 Xerces01Parser parser = new Xerces01Parser(); 132 133 try { 134 135 if (ok) 136 137 parser.parse(url); 138 139 } catch (Exception e) { 140 141 writer.println("Xerces01 FAILED - " + e); 142 143 e.printStackTrace(writer); 144 145 ok = false; 146 147 } 148 149 150 151 153 if (ok) 154 155 writer.println("Xerces01 PASSED"); 156 157 while (true) { 158 159 String message = StaticLogger.read(); 160 161 if (message == null) 162 163 break; 164 165 writer.println(message); 166 167 } 168 169 StaticLogger.reset(); 170 171 172 173 } 174 175 176 177 178 179 } 180 181 | Popular Tags |