- 保存文件
- 取回文件
- 查询
1、GetFileHTTP.java
package com.neohope.existdb.test;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
public class GetFileHTTP {
public static void GetXML(String fileId) throws IOException {
URL url = new URL("http://localhost:8080/exist/rest/db/CDA/" + fileId);
System.out.println("GET file from " + url.toString());
HttpURLConnection connect = (HttpURLConnection) url.openConnection();
connect.setRequestMethod("GET");
connect.connect();
System.out.println("Result:");
BufferedReader bis = new BufferedReader(new InputStreamReader(connect.getInputStream()));
String line;
while ((line = bis.readLine()) != null) {
System.out.println(line);
}
}
public static void main(String[] args) throws IOException {
GetXML("入院患者护理评估单01.xml");
}
}