You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by su...@apache.org on 2002/08/07 06:42:57 UTC

cvs commit: jakarta-commons/httpclient/src/examples PostXML.java

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>