253 |
253 |
logMetacat = Logger.getLogger(ResourceHandler.class);
|
254 |
254 |
try {
|
255 |
255 |
String resource = request.getServletPath();
|
|
256 |
//substring off the /d1/
|
|
257 |
resource = resource.substring(resource.indexOf("d1/") + 3, resource.length());
|
|
258 |
resource = resource.trim();
|
256 |
259 |
String verb = "";
|
257 |
260 |
|
258 |
|
System.out.println("handling verb " + httpVerb + " request with resource " + resource);
|
|
261 |
System.out.println("handling verb " + httpVerb + " request with resource '" + resource + "'");
|
259 |
262 |
boolean status = false;
|
260 |
263 |
loadSessionData();
|
261 |
264 |
|
262 |
265 |
if (resource != null) {
|
263 |
|
resource = request.getServletPath().substring(1);
|
|
266 |
//resource = request.getServletPath().substring(1);
|
264 |
267 |
|
265 |
268 |
params = new Hashtable<String, String[]>();
|
266 |
269 |
initParams();
|
... | ... | |
271 |
274 |
if (resource.equals(RESOURCE_SESSION) &&
|
272 |
275 |
httpVerb == POST &&
|
273 |
276 |
params.get(FUNCTION_KEYWORD) != null) {
|
|
277 |
System.out.println("Using resource 'session'");
|
274 |
278 |
//System.out.println("function_keyword: " + params.get(FUNCTION_KEYWORD)[0]);
|
275 |
279 |
if (params.get(FUNCTION_KEYWORD)[0].equals(FUNCTION_NAME_LOGIN)) {
|
276 |
280 |
login();
|
... | ... | |
284 |
288 |
//System.out.println("done setting access");
|
285 |
289 |
}
|
286 |
290 |
} else if (resource.equals(RESOURCE_META)) {
|
|
291 |
System.out.println("Using resource 'meta'");
|
287 |
292 |
if(params != null && params.get(FUNCTION_KEYWORD) != null &&
|
288 |
293 |
params.get(FUNCTION_KEYWORD)[0].equals(FUNCTION_NAME_GENERATE_MISSING_SYSTEM_METADATA))
|
289 |
294 |
{ //generate system metadata for any object that is
|
... | ... | |
307 |
312 |
}
|
308 |
313 |
|
309 |
314 |
} else if (resource.equals(RESOURCE_OBJECTS)) {
|
|
315 |
System.out.println("Using resource 'object'");
|
310 |
316 |
logMetacat.debug("D1 Rest: Starting resource processing...");
|
311 |
317 |
loadSessionData();
|
312 |
318 |
|
... | ... | |
341 |
347 |
|
342 |
348 |
|
343 |
349 |
} else if (resource.equals(RESOURCE_IDENTIFIER)) {
|
344 |
|
|
|
350 |
System.out.println("Using resource 'identifier'");
|
345 |
351 |
String identifierId = request.getPathInfo();
|
346 |
352 |
if (identifierId != null && identifierId.length() > 1)
|
347 |
353 |
identifierId = request.getPathInfo().substring(1); //trim the slash
|
... | ... | |
373 |
379 |
}
|
374 |
380 |
|
375 |
381 |
} else if (resource.equals(RESOURCE_LOG)) {
|
|
382 |
System.out.println("Using resource 'log'");
|
376 |
383 |
//handle log events
|
377 |
384 |
if(httpVerb == GET)
|
378 |
385 |
{
|
... | ... | |
388 |
395 |
}
|
389 |
396 |
|
390 |
397 |
} else if(resource.equals(RESOURCE_CHECKSUM)) {
|
|
398 |
System.out.println("Using resource 'checksum'");
|
391 |
399 |
//handle checksum requests
|
392 |
|
System.out.println("Handling getChecksum request");
|
393 |
400 |
if(httpVerb == GET)
|
394 |
401 |
{
|
395 |
402 |
String guid = null;
|
changed d1 url to knb/d1/....