Revision 5063
Added by ben leinfelder about 15 years ago
download.jsp | ||
---|---|---|
12 | 12 |
import="java.sql.ResultSet"%><%@page |
13 | 13 |
import="edu.ucsb.nceas.metacat.dataquery.DataQuery"%><%@page |
14 | 14 |
import="java.io.IOException"%><%@page |
15 |
import="edu.ucsb.nceas.utilities.PropertyNotFoundException"%><%@page |
|
15 |
import="edu.ucsb.nceas.utilities.PropertyNotFoundException"%><%@page |
|
16 |
import="edu.ucsb.nceas.metacat.util.SystemUtil"%><%@page |
|
16 | 17 |
import="java.util.Hashtable"%><%@ page |
17 | 18 |
language="java" %><% |
18 | 19 |
/** |
... | ... | |
362 | 363 |
value = value.replaceAll("</head>", " "); |
363 | 364 |
value = value.replaceAll("<body>", " "); |
364 | 365 |
value = value.replaceAll("</body>", " "); |
366 |
//translate any ecogrid urls |
|
367 |
value = convertEcogridURL(value); |
|
365 | 368 |
} |
366 | 369 |
return value; |
367 | 370 |
} |
368 | 371 |
%><%! |
372 |
private String convertEcogridURL(String value) { |
|
373 |
if (value != null) { |
|
374 |
String prefix = "ecogrid://knb/"; |
|
375 |
if (value.startsWith(prefix)) { |
|
376 |
//String docid = value.substring(prefix.length(), value.length()); |
|
377 |
// TODO make URL |
|
378 |
String contextURL = ""; |
|
379 |
try { |
|
380 |
contextURL = SystemUtil.getContextURL(); |
|
381 |
} |
|
382 |
catch (PropertyNotFoundException pnfe) { |
|
383 |
//do nothing |
|
384 |
} |
|
385 |
value = value.replaceFirst(prefix, contextURL + "/metacat?action=read&docid="); |
|
386 |
} |
|
387 |
} |
|
388 |
return value; |
|
389 |
} |
|
390 |
%><%! |
|
369 | 391 |
private void handleDataquery( |
370 | 392 |
Hashtable<String, String[]> params, |
371 | 393 |
HttpServletResponse response, |
Also available in: Unified diff
include download link instead of an ecogrid pointer
http://bugzilla.ecoinformatics.org/show_bug.cgi?id=4412