Project

General

Profile

« Previous | Next » 

Revision 3241

Added by Matt Jones about 17 years ago

Added new feature to allow metacat documents to be retrieved from a URL that does not use the query url syntax, instead embedding the docid and qformat in the url path, as in this example:
http://localhost:8180/knb/metacat/test.1.1/knb
This format allows clients to read documents without entering a query URL, which will be used in a subsequent step to allow search engines to better index metacat content.

View differences:

src/edu/ucsb/nceas/metacat/MetaCatServlet.java
29 29
import java.io.BufferedInputStream;
30 30
import java.io.File;
31 31
import java.io.FileInputStream;
32
import java.io.FileNotFoundException;
33 32
import java.io.FileReader;
34 33
import java.io.IOException;
35 34
import java.io.PrintWriter;
......
44 43
import java.text.ParseException;
45 44
import java.text.SimpleDateFormat;
46 45
import java.util.Enumeration;
47
import java.util.HashMap;
48 46
import java.util.Hashtable;
49 47
import java.util.Iterator;
50 48
import java.util.Properties;
51
import java.util.Set;
52 49
import java.util.Timer;
53 50
import java.util.Vector;
54 51
import java.util.zip.ZipEntry;
......
72 69
import com.oreilly.servlet.multipart.ParamPart;
73 70
import com.oreilly.servlet.multipart.Part;
74 71

  
72
import edu.ucsb.nceas.metacat.spatial.SpatialHarvester;
73
import edu.ucsb.nceas.metacat.spatial.SpatialQuery;
75 74
import edu.ucsb.nceas.utilities.Options;
76 75
import edu.ucsb.nceas.utilities.OptionsMetadata;
77
import edu.ucsb.nceas.metacat.spatial.SpatialHarvester;
78
import edu.ucsb.nceas.metacat.spatial.SpatialQuery;
79 76

  
80 77
/**
81 78
 * A metadata catalog server implemented as a Java Servlet
......
479 476
            String[] value = null;
480 477
            String[] docid = new String[3];
481 478
            Hashtable params = new Hashtable();
479
            
480
            // Check if this is a simple read request that doesn't use the "action" syntax
481
            // These URLs are of the form:
482
            //            http://localhost:8180/knb/metacat/docid/skinname
483
            //     e.g.,  http://localhost:8180/knb/metacat/test.1.1/knb
484
            String pathInfo = request.getPathInfo();
485
            if (pathInfo != null) {
486
            	String[] path = pathInfo.split("/");
487
            	if (path.length > 1) {
488
            		String docidToRead = path[1];
489
            		String docs[] = new String[1];
490
            		docs[0] = docidToRead;
491
            		logMetacat.debug("READING DOCID FROM PATHINFO: " + docs[0]);
492
            		params.put("docid", docs);
493
            		String skin = null;
494
            		if (path.length > 2) {
495
            			skin = path[2];
496
            			String skins[] = new String[1];
497
            			skins[0] = skin;
498
            			params.put("qformat", skins);
499
            		}
500
                    handleReadAction(params, request, response, "public", null, null);
501
                    return;
502
            	}
503
            }
504
            
482 505
            Enumeration paramlist = request.getParameterNames();
483

  
484 506
            while (paramlist.hasMoreElements()) {
485 507

  
486 508
                name = (String) paramlist.nextElement();
487 509
                value = request.getParameterValues(name);
488 510

  
489 511
                // Decode the docid and mouse click information
512
                // THIS IS OBSOLETE -- I THINK -- REMOVE THIS BLOCK 4/12/2007 MBJ
490 513
                if (name.endsWith(".y")) {
491 514
                    docid[0] = name.substring(0, name.length() - 2);
492 515
                    params.put("docid", docid);

Also available in: Unified diff