Mercurial > hg > eSciDocImport
view src/de/mpiwg/itgroup/eSciDoc/Tools/SendFileToeSciDoc.java @ 8:a844f6948dd8
?nderungen im Walker
tools f?r pubman
author | dwinter |
---|---|
date | Mon, 14 May 2012 09:58:45 +0200 |
parents | c6929e63b0b8 |
children | b6cf6462d709 |
line wrap: on
line source
package de.mpiwg.itgroup.eSciDoc.Tools; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.log4j.BasicConfigurator; public class SendFileToeSciDoc { //private static final String ESCIDOC_SERVER = "xserve07.mpiwg-berlin.mpg.de"; private static final String ESCIDOC_SERVER = "escidoc.mpiwg-berlin.mpg.de"; //private static final String ESCIDOC_SERVER = "escidoc-test.mpiwg-berlin.mpg.de"; /** * @param args * @throws IOException * @throws IllegalStateException */ public static void main(String[] args) throws IllegalStateException, IOException { if (args.length<4){ System.out.println("Usage: sendfile command urlOfFile user password"); return; } BasicConfigurator.configure(); EScidocBasicHandler handler = new EScidocBasicHandler(ESCIDOC_SERVER,8080,args[2],args[3]); URL url; HttpResponse ret; try { url = new URL(args[1]); } catch (MalformedURLException e) { e.printStackTrace(); return; } try { //ret = handler.eScidocDelete(args[0]); ret = handler.eScidocPost(args[0], url); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); return; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); return; } System.out.println(ret.getStatusLine()); String outTXT = EScidocBasicHandler.convertStreamToString(ret.getEntity().getContent()); System.out.println(outTXT); // File nf = new File("/tmp/out.log"); // FileWriter fw = new FileWriter(nf); // fw.append(outTXT); // fw.close(); } }