CVS update: sierra/src/java/org/openprivacy/sierra/test

From: cvs@openprivacy.org
Date: Sat Jan 06 2001 - 00:54:46 PST


Date: Saturday January 6, 19101 @ 0:54
Author: burton
CVSWEB Options: -------------------

Main CVSWeb: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi

View this module: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/test

-----------------------------------

Update of /usr/local/cvsroot/sierra/src/java/org/openprivacy/sierra/test
In directory openprivacy.org:/tmp/cvs-serv22375

Modified Files:
        HttpPostUtil.java
Log Message:
...

*****************************************************************
File: sierra/src/java/org/openprivacy/sierra/test/HttpPostUtil.java

CVSWEB Options: -------------------

CVSWeb: Annotate this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/test/HttpPostUtil.java?annotate=1.2

CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/test/HttpPostUtil.java?rev=1.2&content-type=text/x-cvsweb-markup

CVSWeb: Diff to previous version: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/test/HttpPostUtil.java.diff?r1=1.2&r2=1.1

-----------------------------------

Index: sierra/src/java/org/openprivacy/sierra/test/HttpPostUtil.java
diff -u sierra/src/java/org/openprivacy/sierra/test/HttpPostUtil.java:1.1 sierra/src/java/org/openprivacy/sierra/test/HttpPostUtil.java:1.2
--- sierra/src/java/org/openprivacy/sierra/test/HttpPostUtil.java:1.1 Fri Jan 5 23:58:21 2001
+++ sierra/src/java/org/openprivacy/sierra/test/HttpPostUtil.java Sat Jan 6 00:54:46 2001
@@ -26,25 +26,43 @@
  * document and the given document to the server and add the necessary parameters.
  *
  * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: HttpPostUtil.java,v 1.1 2001/01/06 07:58:21 burton Exp $
+ * @version $Id: HttpPostUtil.java,v 1.2 2001/01/06 08:54:46 burton Exp $
  */
 public class HttpPostUtil
 {
 
+ public static final String HTTP_VERSION = "HTTP/1.0";
+
     private Hashtable params = new Hashtable();
     private String server = null;
+ private String action = null;
     private int port;
     private File file = null;
+ private String contentType = null;
     
     public HttpPostUtil( String server,
                          int port,
+ String action,
+ String contentType,
                          File file )
     {
         this.server = server;
         this.port = port;
+ this.action = action;
+ this.contentType = contentType;
         this.file = file;
     }
 
+ public HttpPostUtil( String server,
+ int port,
+ String action,
+ String contentType,
+ String file )
+ {
+ this( server, port, action, contentType, new File( file ) );
+
+ }
+
     /**
        Add an HTTP parameter to this operation.
      */
@@ -57,21 +75,69 @@
        Do this post
        
        @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- @version $Id: HttpPostUtil.java,v 1.1 2001/01/06 07:58:21 burton Exp $
+ @version $Id: HttpPostUtil.java,v 1.2 2001/01/06 08:54:46 burton Exp $
        
      */
     public void execute() throws Exception
     {
 
         //connect to the server
+ Socket sock = new Socket( this.server, this.port );
+
+ //create a thread for handling output from the socket
+ LogPrintStream ps = new LogPrintStream( sock.getOutputStream() );
+
+ ps.println( "POST " + this.action + " " + HTTP_VERSION );
 
- //create a thread for handling output
+ ps.println( "Content-Type: " + this.contentType );
         
+ ps.print( "\n\n" );
+
     }
     
 }
 
+/**
+
+
+ */
 class OutputHandler extends Thread
 {
+
+ private InputStream is = null;
+
+ public OutputHandler( InputStream is )
+ {
+ this.is = is;
+ }
+
+ public void run()
+ {
+
+ System.out.println( "" );
+
+ }
+
+
+}
+
+class LogPrintStream extends PrintStream
+{
+ public LogPrintStream( OutputStream os )
+ {
+ super( os );
+ }
+
+ public void println( String data )
+ {
+ super.println( data );
+ System.out.println( data );
+ }
+
+ public void print( String data )
+ {
+ super.print( data );
+ System.out.print( data );
+ }
 
 }



This archive was generated by hypermail 2b30 : Mon Jan 22 2001 - 15:52:14 PST