Public Member Functions | |
String | getServletInfo () |
Returns a short description of the servlet. | |
void | doGet (HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException |
Responds to an HTTP GET request. |
Definition at line 25 of file ShapeXml.java.
String getServletInfo | ( | ) |
void doGet | ( | HttpServletRequest | request, | |
HttpServletResponse | response | |||
) | throws IOException, ServletException |
Responds to an HTTP GET request.
Definition at line 34 of file ShapeXml.java.
00034 { 00035 response.setContentType("text/html"); 00036 PrintWriter out = response.getWriter(); 00037 00038 out.println("<h1>Shape demo (XML)</h1>"); 00039 out.println("<p>Reading in data from XML file !!!</p>"); 00040 00041 out.println(request.getParameter("irn")); 00042 String irn = request.getParameter("irn"); 00043 int spiresid = Integer.parseInt(irn); 00044 00045 String dataset = null; 00046 String yaxis = null; 00047 dataset = request.getParameter("dataset"); 00048 yaxis = request.getParameter("yaxis"); 00049 00050 Paper p = null; 00051 try { 00052 // getting from xml file 00053 Data data = XMLUtils.getDataFromHepML(new File("/home/whalley/hd/hepdata-migration/shapes-hepml/"+ irn + ".hep.xml")); 00054 if (data != null) p = data.getFirstPaper(); 00056 if (p == null) throw new Exception("Null paper"); 00057 00058 this.displayHeader(p,out); 00059 if(dataset == null){ 00060 this.displayDatasetError(p,out,String.valueOf(1)); 00061 } 00062 else{ 00063 this.displayDatasetError(p,out,dataset); 00064 } 00065 if(dataset == null){ 00066 this.displayDatasets(p,out); 00067 } 00068 else if(yaxis == null){ 00069 this.displayDataset(p,out,dataset); 00070 } 00071 else { 00072 this.displayDataset(p,out,dataset,yaxis); 00073 } 00074 } 00075 catch (Exception e) { 00076 out.println("Exception: " + e.toString()); 00077 out.println("<pre>"); 00078 e.printStackTrace(out); 00079 out.println("</pre>"); 00080 return; 00081 } 00082 }