commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sul...@apache.org
Subject cvs commit: jakarta-commons/httpclient/src/examples PostXML.java
Date Wed, 07 Aug 2002 04:42:57 GMT
sullis      2002/08/06 21:42:57

  Modified:    httpclient/src/examples PostXML.java
  Log:
  
  
  Revision  Changes    Path
  1.2       +8 -22     jakarta-commons/httpclient/src/examples/PostXML.java
  
  Index: PostXML.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/examples/PostXML.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PostXML.java	21 Jun 2002 04:16:03 -0000	1.1
  +++ PostXML.java	7 Aug 2002 04:42:57 -0000	1.2
  @@ -103,29 +103,15 @@
   		URL u = new URL(strURL);
   		
   		String strXMLFilename = args[1];
  -		
  -		FileInputStream fis = new FileInputStream(strXMLFilename);
  -
  -		ByteArrayOutputStream baos = new ByteArrayOutputStream();
  -		int n = 0;
  -
  -		byte[] buf = new byte[2048];
  -				
  -		while (n != -1)
  -		{
  -			n = fis.read(buf, 0, buf.length);
  -			if (n > 0)
  -			{
  -				baos.write(buf, 0, n);
  -			}
  -		}
   
  +		InputStream input = null;
   		
  -		PostMethod post = new PostMethod();
  +		input = new FileInputStream(strXMLFilename);
   
  -		String strXMLRequest = new String(baos.toByteArray());
  +		PostMethod post = new PostMethod();
   
  -		post.setRequestBody(strXMLRequest);
  +		post.setRequestBody(input);
  +		
   		if ( (u.getPath() == null) || (u.getPath().length() == 0) )
   		{
   			post.setPath("/");
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message