Revision 1377
Added by Jing Tao almost 22 years ago
src/edu/ucsb/nceas/metacat/MetaCatServlet.java | ||
---|---|---|
330 | 330 |
} else if (action.equals("insert") || action.equals("update")) { |
331 | 331 |
PrintWriter out = response.getWriter(); |
332 | 332 |
if ( (username != null) && !username.equals("public") ) { |
333 |
handleInsertOrUpdateAction(out,params,response,username,groupnames);
|
|
333 |
handleInsertOrUpdateAction(out,params,username,groupnames); |
|
334 | 334 |
} else { |
335 | 335 |
out.println("Permission denied for " + action); |
336 | 336 |
} |
... | ... | |
1336 | 1336 |
* to the database connection |
1337 | 1337 |
*/ |
1338 | 1338 |
private void handleInsertOrUpdateAction(PrintWriter out, Hashtable params, |
1339 |
HttpServletResponse response, String user, String[] groups) {
|
|
1339 |
String user, String[] groups) { |
|
1340 | 1340 |
|
1341 | 1341 |
DBConnection dbConn = null; |
1342 | 1342 |
int serialNumber = -1; |
... | ... | |
1413 | 1413 |
} |
1414 | 1414 |
|
1415 | 1415 |
// set content type and other response header fields first |
1416 |
response.setContentType("text/xml"); |
|
1416 |
//response.setContentType("text/xml");
|
|
1417 | 1417 |
out.println("<?xml version=\"1.0\"?>"); |
1418 | 1418 |
out.println("<success>"); |
1419 | 1419 |
out.println("<docid>" + newdocid + "</docid>"); |
1420 | 1420 |
out.println("</success>"); |
1421 | 1421 |
|
1422 | 1422 |
} catch (NullPointerException npe) { |
1423 |
response.setContentType("text/xml"); |
|
1423 |
//response.setContentType("text/xml");
|
|
1424 | 1424 |
out.println("<?xml version=\"1.0\"?>"); |
1425 | 1425 |
out.println("<error>"); |
1426 | 1426 |
out.println(npe.getMessage()); |
1427 | 1427 |
out.println("</error>"); |
1428 | 1428 |
} |
1429 | 1429 |
} catch (Exception e) { |
1430 |
response.setContentType("text/xml"); |
|
1430 |
//response.setContentType("text/xml");
|
|
1431 | 1431 |
out.println("<?xml version=\"1.0\"?>"); |
1432 | 1432 |
out.println("<error>"); |
1433 | 1433 |
out.println(e.getMessage()); |
Also available in: Unified diff
Change some output for inser documents.