70 |
70 |
}
|
71 |
71 |
catch(Exception e)
|
72 |
72 |
{
|
|
73 |
System.err.println("marineServlet: Error in init:");
|
73 |
74 |
e.printStackTrace(System.err);
|
74 |
75 |
}
|
75 |
76 |
}
|
... | ... | |
113 |
114 |
}
|
114 |
115 |
catch(Exception e)
|
115 |
116 |
{
|
116 |
|
System.err.println("marineServlet: Exception in init in handleGetOrPost: ");
|
|
117 |
System.err.println("marineServlet: Exception in init in handleGetOrPost (try1): ");
|
117 |
118 |
e.printStackTrace(System.err);
|
118 |
119 |
}
|
119 |
120 |
|
... | ... | |
171 |
172 |
}
|
172 |
173 |
catch (Exception npe)
|
173 |
174 |
{
|
|
175 |
System.err.println("marineServlet: Error in handleGetOrPost (try2): ");
|
174 |
176 |
npe.printStackTrace(System.err);
|
175 |
177 |
}
|
176 |
178 |
|
177 |
179 |
//Jivka's login code should go here!
|
178 |
180 |
|
179 |
181 |
try{
|
180 |
|
if(action.equals("query") || action.equals("squery")
|
181 |
|
|| action.equals("init"))
|
182 |
|
{
|
183 |
|
//send any type of query action to handleQueryAction
|
184 |
|
handleQueryAction(out, params, response);
|
|
182 |
if(action.equals("query") || action.equals("squery"))
|
|
183 |
{
|
|
184 |
//send any type of query action to handleQueryAction
|
|
185 |
handleQueryAction(out, params, response);
|
|
186 |
}
|
|
187 |
else if(action.equals("init"))
|
|
188 |
{
|
|
189 |
handleInitAction(out);
|
|
190 |
}
|
|
191 |
else if(action.equals("viewabstract"))
|
|
192 |
{
|
|
193 |
//when the user clicks the view abstract graphic
|
|
194 |
handleViewAbstractAction(out, params, response);
|
|
195 |
}
|
|
196 |
else if(action.equals("viewdocumentation"))
|
|
197 |
{
|
|
198 |
//when the user clicks the view documentation graphic
|
|
199 |
handleViewDocumentationAction(out, params, response);
|
|
200 |
}
|
|
201 |
else if(action.equals("download"))
|
|
202 |
{
|
|
203 |
//when the user clicks the download graphic
|
|
204 |
handleDownloadAction(out, params, response);
|
|
205 |
}
|
|
206 |
else
|
|
207 |
{
|
|
208 |
out.println("Error: action " + action + " not registered" +
|
|
209 |
"Please report this error.");
|
|
210 |
}
|
|
211 |
|
|
212 |
conn.close();
|
185 |
213 |
}
|
186 |
|
else if(action.equals("viewabstract"))
|
187 |
|
{
|
188 |
|
//when the user clicks the view abstract graphic
|
189 |
|
handleViewAbstractAction(out, params, response);
|
190 |
|
}
|
191 |
|
else if(action.equals("viewdocumentation"))
|
192 |
|
{
|
193 |
|
//when the user clicks the view documentation graphic
|
194 |
|
handleViewDocumentationAction(out, params, response);
|
195 |
|
}
|
196 |
|
else if(action.equals("download"))
|
197 |
|
{
|
198 |
|
//when the user clicks the download graphic
|
199 |
|
handleDownloadAction(out, params, response);
|
200 |
|
}
|
201 |
|
else
|
202 |
|
{
|
203 |
|
out.println("Error: action " + action + " not registered" +
|
204 |
|
"Please report this error.");
|
205 |
|
}
|
206 |
|
}
|
207 |
214 |
catch(Exception e)
|
208 |
215 |
{
|
209 |
|
//out.print("There was an exception, check the log file for details.<br>");
|
210 |
|
//out.print("msg:<br> ");
|
|
216 |
System.err.println("marineServlet: Error in handleGetOrPost (try3)");
|
211 |
217 |
e.printStackTrace(System.err);
|
212 |
|
//out.println("<br><br>marineServlet says: ok");
|
213 |
|
//out.close();
|
214 |
218 |
}
|
215 |
219 |
System.err.println("msg: " + msg);
|
216 |
220 |
out.close();
|
... | ... | |
254 |
258 |
}
|
255 |
259 |
catch(SQLException sqle)
|
256 |
260 |
{
|
257 |
|
System.err.println("Error returning abstract");
|
|
261 |
|
|
262 |
System.err.println("marineServlet: SQLError " +
|
|
263 |
"in handleViewAbstractAction");
|
|
264 |
sqle.printStackTrace(System.err);
|
258 |
265 |
}
|
259 |
266 |
catch(Exception e)
|
260 |
267 |
{
|
261 |
|
System.err.println("error in handleviewabstract " +
|
262 |
|
e.fillInStackTrace().toString());
|
|
268 |
System.err.println("marineServlet: Error " +
|
|
269 |
"in handleViewAbstractAction");
|
|
270 |
e.printStackTrace(System.err);
|
263 |
271 |
}
|
264 |
272 |
out.println(markup); //send the output to the browser
|
265 |
273 |
}
|
... | ... | |
272 |
280 |
{
|
273 |
281 |
String doc = null;
|
274 |
282 |
String docid = ((String[])params.get("docid"))[0];
|
275 |
|
//out.println("view documentation not yet implemented");
|
|
283 |
out.println("view documentation not yet implemented");
|
276 |
284 |
try{
|
277 |
285 |
doc = docreader.readXMLDocument(docid);
|
278 |
|
|
|
286 |
|
279 |
287 |
XMLDocumentFragment htmldoc = null;
|
280 |
288 |
XSLStylesheet style = new XSLStylesheet(
|
281 |
289 |
new URL(docStyleURL), null);
|
... | ... | |
286 |
294 |
}
|
287 |
295 |
catch(Exception e)
|
288 |
296 |
{
|
289 |
|
System.err.println("error retrieving document details.");
|
290 |
|
System.err.println(e.fillInStackTrace().toString());
|
|
297 |
System.err.println("marineServlet: error in " +
|
|
298 |
"handleViewDocumentationAction");
|
|
299 |
e.printStackTrace(System.err);
|
291 |
300 |
}
|
292 |
301 |
}
|
293 |
302 |
|
|
303 |
private void handleInitAction(PrintWriter out)
|
|
304 |
{
|
|
305 |
try{
|
|
306 |
StringBuffer temp = new StringBuffer();
|
|
307 |
XMLDocumentFragment html = null;
|
|
308 |
|
|
309 |
temp.append("<?xml version=\"1.0\"?>\n");
|
|
310 |
temp.append("<resultset></resultset>\n");
|
|
311 |
|
|
312 |
//create a null query and run it through the
|
|
313 |
//xsl processor to create the opening page
|
|
314 |
|
|
315 |
XSLStylesheet style = new XSLStylesheet(
|
|
316 |
new URL(resultStyleURL), null);
|
|
317 |
html = (new XSLProcessor()).processXSL(style,
|
|
318 |
(Reader)(new StringReader(temp.toString())), null);
|
|
319 |
html.print(out);
|
|
320 |
}
|
|
321 |
catch(Exception e)
|
|
322 |
{
|
|
323 |
System.err.println("marineServlet: error in handleQueryAction (try1)");
|
|
324 |
e.printStackTrace(System.err);
|
|
325 |
}
|
|
326 |
}
|
294 |
327 |
|
295 |
328 |
/**
|
296 |
329 |
Handles when the user clicks the Download graphic.
|
... | ... | |
373 |
406 |
(Reader)(new StringReader(temp.toString())), null);
|
374 |
407 |
html.print(out);
|
375 |
408 |
}
|
376 |
|
catch(IOException ioe)
|
377 |
|
{
|
378 |
|
System.err.println("IO error in init");
|
379 |
|
}
|
380 |
|
catch(XSLException xsle)
|
381 |
|
{
|
382 |
|
System.err.println("XSL exception in init");
|
383 |
|
}
|
384 |
409 |
catch(Exception e)
|
385 |
410 |
{
|
386 |
|
System.err.println("error in init");
|
|
411 |
System.err.println("marineServlet: error in handleQueryAction (try1)");
|
|
412 |
e.printStackTrace(System.err);
|
387 |
413 |
}
|
388 |
414 |
}
|
389 |
415 |
else
|
... | ... | |
467 |
493 |
}
|
468 |
494 |
catch (Exception e)
|
469 |
495 |
{
|
470 |
|
System.err.println("Error transforming document:\n"
|
471 |
|
+ e.fillInStackTrace().toString());
|
472 |
|
|
|
496 |
System.err.println("marineServlet: error in handleQueryAction (try2)");
|
|
497 |
e.printStackTrace(System.err);
|
473 |
498 |
}
|
474 |
499 |
}
|
475 |
500 |
}
|
... | ... | |
551 |
576 |
pstatement.execute();
|
552 |
577 |
dateResults = pstatement.getResultSet();
|
553 |
578 |
}
|
554 |
|
catch(SQLException s)
|
|
579 |
catch(Exception e)
|
555 |
580 |
{
|
556 |
|
System.err.println("error in SQL " + s.getMessage());
|
|
581 |
System.err.println("marineServlet: error in createExtendedQuery(try1)");
|
|
582 |
e.printStackTrace(System.err);
|
557 |
583 |
}
|
558 |
584 |
|
559 |
585 |
try{
|
... | ... | |
656 |
682 |
moreRows = dateResults.next();
|
657 |
683 |
}
|
658 |
684 |
}
|
659 |
|
catch(SQLException e)
|
|
685 |
catch(Exception e)
|
660 |
686 |
{
|
661 |
|
System.err.println("Error in SQL " + e.getMessage());
|
662 |
|
|
|
687 |
System.err.println("marineServlet: error in createExtendedQuery(try2)");
|
|
688 |
e.printStackTrace(System.err);
|
663 |
689 |
}
|
664 |
690 |
|
665 |
691 |
return result;
|
no message