From: cvs@openprivacy.orgCVS update: sierra/src/java/org/openprivacy/sierra/test
Date: Saturday January 6, 19101 @ 1:11
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-serv22437
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.3
CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/test/HttpPostUtil.java?rev=1.3&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.3&r2=1.2
-----------------------------------
Index: sierra/src/java/org/openprivacy/sierra/test/HttpPostUtil.java
diff -u sierra/src/java/org/openprivacy/sierra/test/HttpPostUtil.java:1.2 sierra/src/java/org/openprivacy/sierra/test/HttpPostUtil.java:1.3
--- sierra/src/java/org/openprivacy/sierra/test/HttpPostUtil.java:1.2 Sat Jan 6 00:54:46 2001
+++ sierra/src/java/org/openprivacy/sierra/test/HttpPostUtil.java Sat Jan 6 01:11:56 2001
@@ -26,7 +26,7 @@
* 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.2 2001/01/06 08:54:46 burton Exp $
+ * @version $Id: HttpPostUtil.java,v 1.3 2001/01/06 09:11:56 burton Exp $
*/
public class HttpPostUtil
{
@@ -44,7 +44,7 @@
int port,
String action,
String contentType,
- File file )
+ File file )
{
this.server = server;
this.port = port;
@@ -57,10 +57,9 @@
int port,
String action,
String contentType,
- String file )
+ String file )
{
this( server, port, action, contentType, new File( file ) );
-
}
/**
@@ -75,7 +74,7 @@
Do this post
@author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- @version $Id: HttpPostUtil.java,v 1.2 2001/01/06 08:54:46 burton Exp $
+ @version $Id: HttpPostUtil.java,v 1.3 2001/01/06 09:11:56 burton Exp $
*/
public void execute() throws Exception
@@ -85,11 +84,21 @@
Socket sock = new Socket( this.server, this.port );
//create a thread for handling output from the socket
+ OutputHandler oh = new OutputHandler( sock.getInputStream() );
+ oh.start();
+
+ //get the output stream from the socket
LogPrintStream ps = new LogPrintStream( sock.getOutputStream() );
-
+
ps.println( "POST " + this.action + " " + HTTP_VERSION );
ps.println( "Content-Type: " + this.contentType );
+
+ //fetch document to post as a String.
+
+ //post the new Content-Length..
+
+ //dump params to HTTP stream
ps.print( "\n\n" );
@@ -114,7 +123,19 @@
public void run()
{
- System.out.println( "" );
+ //continually read the output...
+ try {
+ byte bytes[] = new byte[200];
+
+ int readCount = 0;
+ while( ( readCount = is.read( bytes )) > 0 ) {
+ System.out.write(bytes, 0, readCount);
+ }
+
+ is.close();
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ }
}
This archive was generated by hypermail 2b30 : Mon Jan 22 2001 - 15:52:14 PST