Project

General

Profile

« Previous | Next » 

Revision 8802

remove dependency on HttpMessage that was in the utilities project but is now removed in favor of newer (standard) http client library code.

View differences:

RemoteDocument.java
26 26

  
27 27
package edu.ucsb.nceas.metacat;
28 28

  
29
import edu.ucsb.nceas.metacat.client.MetacatClient;
30
import edu.ucsb.nceas.metacat.client.MetacatFactory;
29 31
import edu.ucsb.nceas.metacat.properties.PropertyService;
30 32
import edu.ucsb.nceas.metacat.util.MetacatUtil;
31
import edu.ucsb.nceas.utilities.HttpMessage;
32 33
import javax.servlet.ServletOutputStream;
33 34

  
34 35
import org.apache.log4j.Logger;
......
48 49
 */
49 50
public class RemoteDocument
50 51
{
52
	
53
	private MetacatClient metacat = null;
54
	
51 55
  private String docIdWithoutRevision = null; //Docid for this document
52 56
  private String revision = null; // Reviseion number for this document
53 57
  private String dataSetId = null; // Data set document Id which contains
......
79 83
    // Get data set id for the given docid
80 84
    dataSetId = DBUtil.findDataSetDocIdForGivenDocument(docIdWithoutRevision);
81 85
    documentHomeServerURL = getMetacatURLForGivenDocId(dataSetId);
86
    
87
    
88
    // make sure we initialize the client for making remote calls
89
	this.metacat = (MetacatClient) MetacatFactory.createMetacatConnection(documentHomeServerURL);
90
	  
82 91
    // Get revisionAndDocType
83 92
    getRevisionAndDocTypeString();
84 93
    revision = myRevision;
......
241 250
   */
242 251
  private void getRevisionAndDocTypeString()
243 252
  {
253
	  
244 254
    // Set property for login action
245 255
    Properties prop = new Properties();
246 256
    // Set action = getrevisionanddoctype
......
455 465
    String response = getMetacatString(prop);
456 466
    logMetacat.debug("Logout Message: "+response);
457 467
    // Set cookie to null
458
    HttpMessage.setCookie(null);
459 468
     
460 469
  }//logout
461 470
  
......
506 515
   * @param prop the properties to be sent to Metacat
507 516
   */
508 517
  private InputStream getMetacatInputStream(Properties prop) throws Exception
509
  {
518
  {	  
510 519
    // Variable to store the returned input stream
511
    InputStream returnStream = null;
512
    // Create a URL for remtate
513
    URL url = new URL(documentHomeServerURL);
514
    HttpMessage msg = new HttpMessage(url);
515
    // Now contact metacat and send the request
516
    returnStream = msg.sendPostMessage(prop);
520
    InputStream returnStream = metacat.sendParameters(prop);
517 521
    return returnStream;
518 522
 
519 523
  }//getMetacatInputStream

Also available in: Unified diff