Strabon
changeset 130:3d4a04d579aa
merge
author | Kostis Kyzirakos <kkyzir@di.uoa.gr> |
---|---|
date | Tue May 08 11:16:57 2012 +0300 (2012-05-08) |
parents | c84657ac1966 fe3dcddc2aba |
children | 6b85aec0ed58 |
files | endpoint/WebContent/WEB-INF/beans.xml endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java |
line diff
1.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java Tue May 08 11:16:34 2012 +0300 1.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java Tue May 08 11:16:57 2012 +0300 1.3 @@ -2,6 +2,8 @@ 1.4 1.5 import java.io.BufferedWriter; 1.6 import java.io.File; 1.7 +import java.io.FileInputStream; 1.8 +import java.io.FileOutputStream; 1.9 import java.io.FileWriter; 1.10 import java.io.IOException; 1.11 import java.io.PrintWriter; 1.12 @@ -11,6 +13,8 @@ 1.13 import java.security.SecureRandom; 1.14 import java.util.Date; 1.15 import java.util.Iterator; 1.16 +import java.util.zip.ZipEntry; 1.17 +import java.util.zip.ZipOutputStream; 1.18 1.19 import javax.servlet.ServletConfig; 1.20 import javax.servlet.ServletContext; 1.21 @@ -26,35 +30,35 @@ 1.22 import org.openrdf.repository.RepositoryException; 1.23 import org.springframework.web.context.WebApplicationContext; 1.24 import org.springframework.web.context.support.WebApplicationContextUtils; 1.25 - 1.26 + 1.27 1.28 public class QueryBean extends HttpServlet { 1.29 - 1.30 + 1.31 private static final long serialVersionUID = -378175118289907707L; 1.32 - 1.33 + 1.34 private ServletContext context; 1.35 private StrabonBeanWrapper strabonWrapper; 1.36 - 1.37 + 1.38 public void doGet(HttpServletRequest request, HttpServletResponse response) 1.39 - throws ServletException, IOException 1.40 - { 1.41 + throws ServletException, IOException 1.42 + { 1.43 doPost(request, response); 1.44 - } 1.45 - 1.46 + } 1.47 + 1.48 public void doPost(HttpServletRequest request, HttpServletResponse response) 1.49 - throws ServletException, IOException 1.50 - { 1.51 + throws ServletException, IOException 1.52 + { 1.53 final class DataHive{ 1.54 private String format; 1.55 private String SPARQLQuery; 1.56 private String errorMessage; 1.57 - 1.58 + 1.59 DataHive(){ 1.60 this.format = null; 1.61 this.SPARQLQuery = null; 1.62 this.errorMessage = null; 1.63 } 1.64 - 1.65 + 1.66 public String getSPARQLQuery() { 1.67 return SPARQLQuery; 1.68 } 1.69 @@ -62,7 +66,7 @@ 1.70 public void setSPARQLQuery(String sPARQLQuery) { 1.71 SPARQLQuery = sPARQLQuery; 1.72 } 1.73 - 1.74 + 1.75 public String getFormat() { 1.76 return format; 1.77 } 1.78 @@ -79,29 +83,32 @@ 1.79 this.errorMessage = error; 1.80 } 1.81 } 1.82 - 1.83 + 1.84 DataHive hive = new DataHive(); 1.85 - 1.86 + 1.87 hive.setSPARQLQuery(request.getParameter("SPARQLQuery")); 1.88 - 1.89 + 1.90 String reqFormat = (request.getParameter("format") == null) ? "" : request.getParameter("format"); 1.91 String reqAccept = (request.getHeader("accept") == null) ? "" : request.getHeader("accept"); 1.92 String reqFuncionality = (request.getParameter("submit") == null) ? "" : request.getParameter("submit"); 1.93 - 1.94 + 1.95 // check whether Update submit button was fired 1.96 if (reqFuncionality.equals("Update")) { // only for executions from web browsers 1.97 response.setStatus(HttpServletResponse.SC_TEMPORARY_REDIRECT); 1.98 response.sendRedirect("Update?SPARQLQuery=" + hive.getSPARQLQuery()); 1.99 - 1.100 + 1.101 return; 1.102 } 1.103 - 1.104 + 1.105 if ((reqFormat == "") && (reqAccept == "")) { 1.106 hive.setFormat("HTML"); 1.107 response.setContentType("text/html; charset=UTF-8"); 1.108 } else if (reqAccept.contains("application/vnd.google-earth.kml+xml")) { 1.109 response.setContentType("application/vnd.google-earth.kml+xml; charset=UTF-8"); 1.110 hive.setFormat("KML"); 1.111 + } else if (reqAccept.contains("application/vnd.google-earth.kmz")) { 1.112 + response.setContentType("application/vnd.google-earth.kmz; charset=UTF-8"); 1.113 + hive.setFormat("KMZ"); 1.114 } else if (reqAccept.contains("application/sparql-results+xml")) { 1.115 response.setContentType("application/sparql-results+xml; charset=UTF-8"); 1.116 hive.setFormat("XML"); 1.117 @@ -111,141 +118,283 @@ 1.118 } else if (reqFormat.equalsIgnoreCase("KML")) { 1.119 response.setContentType("application/vnd.google-earth.kml+xml; charset=UTF-8"); 1.120 hive.setFormat("KML"); 1.121 + } else if (reqFormat.equalsIgnoreCase("KMZ")) { 1.122 + response.setContentType("application/vnd.google-earth.kmz; charset=UTF-8"); 1.123 + hive.setFormat("KMZ"); 1.124 } else if (reqFormat.equalsIgnoreCase("SPARQLRESULTS")) { 1.125 response.setContentType("application/sparql-results+xml; charset=UTF-8"); 1.126 hive.setFormat("XML"); 1.127 } else if (reqFormat.equalsIgnoreCase("XML")) { 1.128 response.setContentType("text/xml; charset=UTF-8"); 1.129 hive.setFormat("XML"); 1.130 + } else if (reqFormat.equalsIgnoreCase("KMLMAP")) { 1.131 + response.setContentType("text/html; charset=UTF-8"); 1.132 + hive.setFormat("KMLMAP"); 1.133 + } else if (reqFormat.equalsIgnoreCase("KMZMAP")) { 1.134 + response.setContentType("text/html; charset=UTF-8"); 1.135 + hive.setFormat("KMZMAP"); 1.136 } else { 1.137 response.setContentType("text/html; charset=UTF-8"); 1.138 hive.setFormat("HTML"); 1.139 } 1.140 - 1.141 + 1.142 PrintWriter out = response.getWriter(); 1.143 - 1.144 - if ((hive.getFormat().equalsIgnoreCase("KML"))) { 1.145 + 1.146 + if ((hive.getFormat().equalsIgnoreCase("KML")) || (hive.getFormat().equalsIgnoreCase("KMZ"))) { 1.147 StringBuilder errorMessage = new StringBuilder (); 1.148 String answer = evaluateQuery(strabonWrapper, hive.getFormat(), reqFuncionality, hive.getSPARQLQuery(), errorMessage); 1.149 hive.setErrorMessage(errorMessage.toString()); 1.150 - SecureRandom random = new SecureRandom(); 1.151 - String temp = new BigInteger(130, random).toString(32); 1.152 - 1.153 - try{ 1.154 - Date date = new Date(); 1.155 - 1.156 - FileUtils.forceMkdir(new File((String) context.getRealPath("/") + "/../ROOT/tmp/")); 1.157 - 1.158 - Iterator it = FileUtils.iterateFiles(new File((String) context.getRealPath("/") + "/../ROOT/tmp/"), null, false); 1.159 - while(it.hasNext()){ 1.160 - File tbd = new File(((File) it.next()).getAbsolutePath()); 1.161 - if (FileUtils.isFileOlder( new File(tbd.getAbsolutePath()), date.getTime())){ 1.162 - FileUtils.forceDelete(new File(tbd.getAbsolutePath())); 1.163 - } 1.164 - } 1.165 - 1.166 - File file =new File((String) context.getRealPath("/") + "/../ROOT/tmp/" + temp + ".kml"); 1.167 - 1.168 - //if file doesnt exists, then create it 1.169 - if(!file.exists()){ 1.170 - file.createNewFile(); 1.171 - } 1.172 - 1.173 - FileWriter fw = new FileWriter((String) context.getRealPath("/") + "/../ROOT/tmp/" + temp + ".kml"); 1.174 - BufferedWriter bw = new BufferedWriter(fw); 1.175 - bw.write(answer); 1.176 - bw.close(); 1.177 - //FileUtils.forceDeleteOnExit(new File((String) context.getRealPath("/") + "/../ROOT/tmp/" + temp + ".kml")); 1.178 - 1.179 - //System.out.println("Done"); 1.180 - 1.181 - } catch(IOException e) { 1.182 - e.printStackTrace(); 1.183 - } 1.184 - 1.185 - response.setContentType("application/vnd.google-earth.kml+xml; charset=UTF-8"); 1.186 - response.setDateHeader("Expires", 0); 1.187 - response.setHeader("Location", request.getScheme() + "://" + request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + ".kml"); 1.188 - response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); 1.189 - 1.190 - String pathToKML = ""; 1.191 - 1.192 - if (answer!="") 1.193 - pathToKML = request.getScheme() + "://" + request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + ".kml"; 1.194 + SecureRandom random = new SecureRandom(); 1.195 + String temp = new BigInteger(130, random).toString(32); 1.196 1.197 - appendHTML1a(out,pathToKML); 1.198 + String basePath = context.getRealPath("/") + "/../ROOT/tmp/"; 1.199 + 1.200 + try{ 1.201 + Date date = new Date(); 1.202 + 1.203 + FileUtils.forceMkdir(new File(basePath)); 1.204 + 1.205 + Iterator it = FileUtils.iterateFiles(new File(basePath), null, false); 1.206 + while(it.hasNext()){ 1.207 + File tbd = new File(((File) it.next()).getAbsolutePath()); 1.208 + if (FileUtils.isFileOlder( new File(tbd.getAbsolutePath()), date.getTime())){ 1.209 + FileUtils.forceDelete(new File(tbd.getAbsolutePath())); 1.210 + } 1.211 + } 1.212 + 1.213 + File file =new File(basePath + temp + ".kml"); 1.214 + 1.215 + //if file doesnt exists, then create it 1.216 + if(!file.exists()){ 1.217 + file.createNewFile(); 1.218 + } 1.219 + 1.220 + FileWriter fw = new FileWriter(basePath + temp + ".kml"); 1.221 + BufferedWriter bw = new BufferedWriter(fw); 1.222 + bw.write(answer); 1.223 + bw.close(); 1.224 + //FileUtils.forceDeleteOnExit(new File((String) context.getRealPath("/") + "/../ROOT/tmp/" + temp + ".kml")); 1.225 + 1.226 + //System.out.println("Done"); 1.227 + 1.228 + if (hive.getFormat().equalsIgnoreCase("KMZ")) { 1.229 + //compress 1.230 + byte[] buf = new byte[1024]; 1.231 + String outFilename = basePath + temp + ".kmz"; 1.232 + ZipOutputStream kmzout = new ZipOutputStream(new FileOutputStream(outFilename)); 1.233 + 1.234 + // Compress the files 1.235 + FileInputStream in = new FileInputStream(basePath + temp + ".kml"); 1.236 + 1.237 + // Add ZIP entry to output stream. 1.238 + kmzout.putNextEntry(new ZipEntry("doc.kml")); 1.239 + 1.240 + // Transfer bytes from the file to the ZIP file 1.241 + int len; 1.242 + while ((len = in.read(buf)) > 0) { 1.243 + kmzout.write(buf, 0, len); 1.244 + } 1.245 + 1.246 + // Complete the entry 1.247 + kmzout.closeEntry(); 1.248 + in.close(); 1.249 + 1.250 + // Complete the ZIP file 1.251 + kmzout.close(); 1.252 + } 1.253 + } catch(IOException e) { 1.254 + e.printStackTrace(); 1.255 + } 1.256 + 1.257 + response.setDateHeader("Expires", 0); 1.258 + response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); 1.259 + 1.260 + String pathToKML = ""; 1.261 + if (hive.getFormat().equalsIgnoreCase("KML")) { 1.262 + response.setContentType("application/vnd.google-earth.kml+xml; charset=UTF-8"); 1.263 + response.setHeader("Location", request.getScheme() + "://" + request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + ".kml"); 1.264 + if (answer!="") 1.265 + pathToKML = request.getScheme() + "://" + request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + ".kml"; 1.266 + } else { 1.267 + response.setContentType("application/vnd.google-earth.kmz; charset=UTF-8"); 1.268 + response.setHeader("Location", request.getScheme() + "://" + request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + ".kmz"); 1.269 + if (answer!="") 1.270 + pathToKML = request.getScheme() + "://" + request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + ".kmz"; 1.271 + } 1.272 1.273 + appendHTML1a(out,pathToKML); 1.274 + 1.275 appendHTMLQ(out, strabonWrapper); 1.276 - 1.277 + 1.278 appendHTML1b(out); 1.279 - 1.280 + 1.281 if (hive.getSPARQLQuery() != null) 1.282 out.write(hive.getSPARQLQuery()); 1.283 - 1.284 + 1.285 appendHTML2(out); 1.286 - 1.287 + 1.288 out.append("</table></td></tr></table>"); 1.289 - 1.290 + 1.291 appendHTML4(out); 1.292 if (answer!="") 1.293 - //out.append("<div id=\"map_canvas\"></div>"); 1.294 + //out.append("<div id=\"map_canvas\"></div>"); 1.295 out.append(""); 1.296 appendHTML5(out); 1.297 + 1.298 + } else if ((hive.getFormat().equalsIgnoreCase("KMLMAP")) || (hive.getFormat().equalsIgnoreCase("KMZMAP"))) { 1.299 + 1.300 + StringBuilder errorMessage = new StringBuilder (); 1.301 + String answer = evaluateQuery(strabonWrapper, "KML", reqFuncionality, hive.getSPARQLQuery(), errorMessage); 1.302 + hive.setErrorMessage(errorMessage.toString()); 1.303 + SecureRandom random = new SecureRandom(); 1.304 + String temp = new BigInteger(130, random).toString(32); 1.305 1.306 + String basePath = context.getRealPath("/") + "/../ROOT/tmp/"; 1.307 + 1.308 + try{ 1.309 + Date date = new Date(); 1.310 + 1.311 + FileUtils.forceMkdir(new File(basePath)); 1.312 + 1.313 + Iterator it = FileUtils.iterateFiles(new File(basePath), null, false); 1.314 + while(it.hasNext()){ 1.315 + File tbd = new File(((File) it.next()).getAbsolutePath()); 1.316 + if (FileUtils.isFileOlder( new File(tbd.getAbsolutePath()), date.getTime())){ 1.317 + FileUtils.forceDelete(new File(tbd.getAbsolutePath())); 1.318 + } 1.319 + } 1.320 + 1.321 + File file =new File(basePath + temp + ".kml"); 1.322 + 1.323 + //if file doesnt exists, then create it 1.324 + if(!file.exists()){ 1.325 + file.createNewFile(); 1.326 + } 1.327 + 1.328 + FileWriter fw = new FileWriter(basePath + temp + ".kml"); 1.329 + BufferedWriter bw = new BufferedWriter(fw); 1.330 + bw.write(answer); 1.331 + bw.close(); 1.332 + //FileUtils.forceDeleteOnExit(new File((String) context.getRealPath("/") + "/../ROOT/tmp/" + temp + ".kml")); 1.333 + 1.334 + //System.out.println("Done"); 1.335 + 1.336 + if (hive.getFormat().equalsIgnoreCase("KMZMAP")) { 1.337 + //compress 1.338 + byte[] buf = new byte[1024]; 1.339 + String outFilename = basePath + temp + ".kmz"; 1.340 + ZipOutputStream kmzout = new ZipOutputStream(new FileOutputStream(outFilename)); 1.341 + 1.342 + // Compress the files 1.343 + FileInputStream in = new FileInputStream(basePath + temp + ".kml"); 1.344 + 1.345 + // Add ZIP entry to output stream. 1.346 + kmzout.putNextEntry(new ZipEntry("doc.kml")); 1.347 + 1.348 + // Transfer bytes from the file to the ZIP file 1.349 + int len; 1.350 + while ((len = in.read(buf)) > 0) { 1.351 + kmzout.write(buf, 0, len); 1.352 + } 1.353 + 1.354 + // Complete the entry 1.355 + kmzout.closeEntry(); 1.356 + in.close(); 1.357 + 1.358 + // Complete the ZIP file 1.359 + kmzout.close(); 1.360 + } 1.361 + } catch(IOException e) { 1.362 + e.printStackTrace(); 1.363 + } 1.364 + 1.365 + response.setDateHeader("Expires", 0); 1.366 + response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); 1.367 + 1.368 + String pathToKML = ""; 1.369 + if (hive.getFormat().equalsIgnoreCase("KMLMAP")) { 1.370 + //response.setContentType("application/vnd.google-earth.kml+xml; charset=UTF-8"); 1.371 + response.setHeader("Location", request.getScheme() + "://" + request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + ".kml"); 1.372 + if (answer!="") 1.373 + pathToKML = request.getScheme() + "://" + request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + ".kml"; 1.374 + } else { 1.375 + //response.setContentType("application/vnd.google-earth.kmz; charset=UTF-8"); 1.376 + response.setHeader("Location", request.getScheme() + "://" + request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + ".kmz"); 1.377 + if (answer!="") 1.378 + pathToKML = request.getScheme() + "://" + request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + ".kmz"; 1.379 + } 1.380 + 1.381 + appendHTML1a(out,pathToKML); 1.382 + 1.383 + appendHTMLQ(out, strabonWrapper); 1.384 + 1.385 + appendHTML1b(out); 1.386 + 1.387 + if (hive.getSPARQLQuery() != null) 1.388 + out.write(hive.getSPARQLQuery()); 1.389 + 1.390 + appendHTML2(out); 1.391 + 1.392 + out.append("</table></td></tr></table>"); 1.393 + 1.394 + appendHTML4(out); 1.395 + if (answer!="") 1.396 + out.append("<div id=\"map_canvas\"></div>"); 1.397 + appendHTML5(out); 1.398 } else if ((hive.getFormat().equalsIgnoreCase("XML"))) { 1.399 int status_code = HttpServletResponse.SC_OK; 1.400 String answer = ""; 1.401 - 1.402 + 1.403 try { 1.404 // execute query 1.405 answer = (String) strabonWrapper.query(hive.getSPARQLQuery(), hive.getFormat()); 1.406 - 1.407 + 1.408 } catch (MalformedQueryException e) { 1.409 status_code = HttpServletResponse.SC_BAD_REQUEST; 1.410 answer = e.getMessage(); 1.411 - 1.412 + 1.413 } catch (RepositoryException e) { 1.414 status_code = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; 1.415 answer = e.getMessage(); 1.416 - 1.417 + 1.418 } catch (QueryEvaluationException e) { 1.419 status_code = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; 1.420 answer = e.getMessage(); 1.421 - 1.422 + 1.423 } catch (TupleQueryResultHandlerException e) { 1.424 status_code = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; 1.425 answer = e.getMessage(); 1.426 - 1.427 + 1.428 } catch (ClassNotFoundException e) { 1.429 status_code = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; 1.430 answer = e.getMessage(); 1.431 } 1.432 - 1.433 + 1.434 // write response to client 1.435 response.setContentType("text/xml; charset=UTF-8"); 1.436 response.setStatus(status_code); 1.437 if (status_code == HttpServletResponse.SC_OK) { 1.438 response.getWriter().append(answer); 1.439 - 1.440 + 1.441 } else { 1.442 response.getWriter().append(ResponseMessages.getXMLHeader()); 1.443 response.getWriter().append(ResponseMessages.getXMLException(answer)); 1.444 response.getWriter().append(ResponseMessages.getXMLFooter()); 1.445 } 1.446 - 1.447 + 1.448 } else { // HTML 1.449 - 1.450 + 1.451 appendHTML1a(out,""); 1.452 - 1.453 + 1.454 appendHTMLQ(out, strabonWrapper); 1.455 - 1.456 + 1.457 appendHTML1b(out); 1.458 - 1.459 + 1.460 if (hive.getSPARQLQuery() != null) 1.461 out.write(hive.getSPARQLQuery()); 1.462 - 1.463 + 1.464 appendHTML2(out); 1.465 - 1.466 + 1.467 String answer = ""; 1.468 if (hive.getSPARQLQuery() != null) { 1.469 StringBuilder errorMessage = new StringBuilder (); 1.470 @@ -255,7 +404,7 @@ 1.471 appendHTML3(out, hive.getErrorMessage()); 1.472 } 1.473 } 1.474 - 1.475 + 1.476 out.append("</table></td></tr></table>"); 1.477 if (!answer.equals("")) { 1.478 out.println("<style type=\"text/css\">"); 1.479 @@ -271,26 +420,26 @@ 1.480 appendHTML5(out); 1.481 } 1.482 out.flush(); 1.483 - } 1.484 + } 1.485 1.486 public void init(ServletConfig servletConfig) throws ServletException { 1.487 super.init(servletConfig); 1.488 - 1.489 + 1.490 // get StrabonWrapper 1.491 context = getServletContext(); 1.492 WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(context); 1.493 - 1.494 + 1.495 strabonWrapper = (StrabonBeanWrapper) applicationContext.getBean("strabonBean"); 1.496 } 1.497 1.498 public String evaluateQuery(StrabonBeanWrapper strabonWrapper, String resultFormat, String reqFunctionality, String SPARQLQuery, StringBuilder errorMessage) { 1.499 String answer = ""; 1.500 - 1.501 + 1.502 try { 1.503 if (SPARQLQuery == null) { 1.504 answer = ""; 1.505 } else { 1.506 - answer = (String) strabonWrapper.query(SPARQLQuery, resultFormat); 1.507 + answer = (String) strabonWrapper.query(SPARQLQuery, resultFormat); 1.508 } 1.509 } catch (MalformedQueryException e) { 1.510 e.printStackTrace(); 1.511 @@ -317,7 +466,7 @@ 1.512 1.513 return answer; 1.514 } 1.515 - 1.516 + 1.517 protected static void appendHTML1a(PrintWriter out, String pathToKML) { 1.518 out.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"); 1.519 out.println("<html>"); 1.520 @@ -389,24 +538,24 @@ 1.521 out.println("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"165\" id=\"navigation\"> "); 1.522 out.println("<tr><td width=\"90\" class=\"style4\"><a href=\"Query\" class=\"navText\">Query</a></td></tr> "); 1.523 } 1.524 - 1.525 + 1.526 protected static void appendHTML1b(PrintWriter out) { 1.527 out.println("<tr><td width=\"90\" class=\"style4\"><a href=\"store.jsp\" class=\"navText\">Store</a></td></tr> "); 1.528 out.println("<tr><td width=\"90\" class=\"style4\"><a href=\"javascript:history.go(0)\" class=\"navText\">Clear</a></td></tr> "); 1.529 out.println("</table>"); 1.530 out.println("</td>"); 1.531 out.println("<td width=\"*\" valign=\"top\" >"); 1.532 - 1.533 + 1.534 out.println("<table cellspacing=\"5\">"); 1.535 out.println("<tr>"); 1.536 out.println("<td style=\"border: 1px dashed #bbbbbb;\">stSPARQL Query:</td>"); 1.537 out.println("<td style=\"border: 1px dashed #bbbbbb;\"><textarea name=\"SPARQLQuery\" rows=\"15\" cols=\"100\">"); 1.538 } 1.539 - 1.540 + 1.541 protected static void appendHTML2(PrintWriter out) { 1.542 out.println("</textarea></td>"); 1.543 -// out.println("<td style=\"border: 1px dashed #bbbbbb;\"><input type=\"radio\" name=\"format\" value=\"KML\">KML<br/>"); 1.544 -// out.println("<input type=\"radio\" name=\"format\" value=\"HTML\">HTML</td>"); 1.545 + // out.println("<td style=\"border: 1px dashed #bbbbbb;\"><input type=\"radio\" name=\"format\" value=\"KML\">KML<br/>"); 1.546 + // out.println("<input type=\"radio\" name=\"format\" value=\"HTML\">HTML</td>"); 1.547 out.println("<td style=\"border: 1px dashed #bbbbbb;\"><center>Output Format:<br/><select name=\"format\">"); 1.548 out.println(" <option value=\"HTML\">HTML</option>"); 1.549 out.println(" <option value=\"KML\">KML</option>"); 1.550 @@ -417,7 +566,7 @@ 1.551 out.println("<td colspan=2 style=\"border: 1px dashed #bbbbbb;\"><br/><center><input type=\"submit\" value=\"Query\" name=\"submit\" style=\"width: 400px\"/><br/><input type=\"submit\" value=\"Update\" name=\"submit\" style=\"width: 400px\"/></center><br/></td>"); 1.552 out.println("</tr>"); 1.553 } 1.554 - 1.555 + 1.556 protected static void appendHTML3(PrintWriter out, String errorMessage) { 1.557 out.println("<tr>"); 1.558 out.println("<td style=\"border: 1px dashed #bbbbbb;\">Result: </td>"); 1.559 @@ -431,12 +580,12 @@ 1.560 out.println("<br/><br/>"); 1.561 out.println("</form>"); 1.562 } 1.563 - 1.564 + 1.565 protected static void appendHTML5(PrintWriter out) { 1.566 out.println("</body>"); 1.567 out.println("</html>"); 1.568 } 1.569 - 1.570 + 1.571 protected static void appendHTMLQ(PrintWriter out, StrabonBeanWrapper strabonWrapper) throws UnsupportedEncodingException { 1.572 out.println("<tr><td width=\"90\">"); 1.573 out.println("<a href=\"Query?SPARQLQuery="+URLEncoder.encode(strabonWrapper.getQuery1(), "UTF-8")+ "&" + strabonWrapper.getFormat() + "\"> · Query 1</a></br> ");