Revision 7695
Added by ben leinfelder almost 11 years ago
MetacatHandler.java | ||
---|---|---|
2136 | 2136 |
} |
2137 | 2137 |
|
2138 | 2138 |
/** |
2139 |
* Look up the pid (guid)-to-docid mapping. |
|
2140 |
* Returns XML on the response, e.g.: |
|
2141 |
* <docid>sample.1.1</docid> |
|
2142 |
* |
|
2143 |
* @param params |
|
2144 |
* @param response |
|
2145 |
* @throws IOException |
|
2146 |
*/ |
|
2147 |
protected void handleGetDocid(Hashtable<String, String[]> params, HttpServletResponse response) throws IOException { |
|
2148 |
response.setContentType("text/xml"); |
|
2149 |
ServletOutputStream out = response.getOutputStream(); |
|
2150 |
try { |
|
2151 |
// Get pid from parameters |
|
2152 |
String pid = null; |
|
2153 |
if (params.containsKey("pid")) { |
|
2154 |
pid = params.get("pid")[0]; |
|
2155 |
} |
|
2156 |
String docid = IdentifierManager.getInstance().getLocalId(pid); |
|
2157 |
out.println(PROLOG); |
|
2158 |
out.println("<docid>"); |
|
2159 |
out.println(docid); |
|
2160 |
out.println("</docid>"); |
|
2161 |
|
|
2162 |
} catch (Exception e) { |
|
2163 |
// Handle exception |
|
2164 |
out.println(PROLOG); |
|
2165 |
out.println(ERROR); |
|
2166 |
out.println(e.getMessage()); |
|
2167 |
out.println(ERRORCLOSE); |
|
2168 |
} finally { |
|
2169 |
out.close(); |
|
2170 |
} |
|
2171 |
|
|
2172 |
} |
|
2173 |
|
|
2174 |
/** |
|
2139 | 2175 |
* Handle "getrevsionanddoctype" action Given a docid, return it's current |
2140 | 2176 |
* revision and doctype from data base The output is String look like |
2141 | 2177 |
* "rev;doctype" |
Also available in: Unified diff
Allow use of PID instead of docid in the Perl registry. At least for reading/editing and deleting existing content. Does not create content using a pid. https://projects.ecoinformatics.org/ecoinfo/issues/5932