Project

General

Profile

« Previous | Next » 

Revision 534

Added by berkley almost 24 years ago

can now send a file to another server

View differences:

src/edu/ucsb/nceas/metacat/MetacatReplication.java
116 116
    {
117 117
      handleUpdateRequest(out, params, response);
118 118
    }
119
    
120
    if(params.containsKey("getdocument"))
121
    {
122
      handleGetDocumentRequest(out, params, response);
123
    }
119 124
  }
120 125
  
126
  private void handleGetDocumentRequest(PrintWriter out, Hashtable params, 
127
                                   HttpServletResponse response)
128
  {
129
    try
130
    {
131
      String docid = ((String[])(params.get("getdocument")))[0];
132
      System.out.println("incoming get request for document: " +
133
                         docid);
134
      Connection conn = util.openDBConnection();
135
      DocumentImpl di = new DocumentImpl(conn, docid);
136
      response.setContentType("text/xml");
137
      out.println(di.toString());
138
      conn.close();
139
    }
140
    catch(Exception e)
141
    {
142
      System.out.println("error getting document: " + e.getMessage());
143
    }
144
    
145
  }
146
  
121 147
  private void handleUpdateRequest(PrintWriter out, Hashtable params, 
122 148
                                   HttpServletResponse response)
123 149
  {
124
    System.out.println("incoming request for dt/time " + 
150
    System.out.println("incoming update request for dt/time " + 
125 151
                       ((String[])params.get("update"))[0] +
126 152
                       " from external metacat");
127 153
    response.setContentType("text/xml");
......
158 184
      ResultSet rs = pstmt.getResultSet();
159 185
      boolean tablehasrows = rs.next();
160 186
      returnXML.append("<server>").append(util.getOption("server"));
187
      returnXML.append(util.getOption("replicationpath"));
161 188
      returnXML.append("</server><updates>");
162 189
      while(tablehasrows)
163 190
      {
......
167 194
        tablehasrows = rs.next();
168 195
      }
169 196
      returnXML.append("</updates></replication>");
197
      conn.close();
170 198
      out.print(returnXML.toString());
171 199
    }
172 200
    catch(Exception e)

Also available in: Unified diff