Hi,

Before you close the stream -> out.close() do a flush -> out.flush()
It might help you.

Regards.


>From: ajaikumar peddapanga <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
>        Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Using HTTP 1.1....URgent
>Date: Fri, 12 May 2000 19:41:34 GMT
>
>Hello !!
>I have read that  jdk 1.3 supports HTTP 1.1 protocol . I am trying to send
>Huge Amount of data as small chunks using Http Protocol .I know thats not
>possible with Http 1.0 .But i learnt that its possible with Http 1.1. Does
>anyone know how to enable the URLConnection Object to use HTTP 1.1 .Has any
>one tried sending data in chunks instead of sending as one large bundle??
>
>This is very urgent ....Any help is greately appreciated .
>Thanx in advance ...
>
>Here is my code which throws OutofMemory Exception with the normal
>URLConnection Object.Can any one suggest me how to make it work ...with
>Http1.1.
>Thank u very much ..
>
>
>try{
>       byte[] buf = new byte[1024];
>       URL url=new URL("http://localhost/servlet/ZipServlet");
>       URLConnection  con;
>       con =url.openConnection();
>       con.setDoOutput(true);
>       con.setDoInput(true);
>       con.setAllowUserInteraction(true);
>       con.setUseCaches(false);
>       con.setRequestProperty("Content-Type","application/octet-stream");
>       OutputStream ostream =con.getOutputStream();
>       ZipOutputStream out = new ZipOutputStream(ostream);
>       // Add ZIP entry to output stream.
>       double TotalBytes=0.0;
>       for(int i=0;i<args.length;i++){
>           File zipentryFile=new File(args[i]);
>           FileInputStream in = new FileInputStream(zipentryFile);
>           ZipEntry entry=new ZipEntry(args[i]);
>           out.putNextEntry(entry);
>           int len;
>           while ((len = in.read(buf)) > 0) {
>                  out.write(buf, 0, len);
>               out.flush();
>               TotalBytes=TotalBytes+len;
>           }
>           out.closeEntry();
>           in.close();
>       }
>       out.close();
>       System.out.println("Total number of bytes Sent"+TotalBytes);
>       System.out.println("Waiting for Server Response....");
>       BufferedReader reader =new BufferedReader(new
>InputStreamReadercon.getInputStream()));
>                  boolean more=true;
>                  while(more){
>                       String line=reader.readLine();
>                       if(line==null){
>                          more=false;
>                       }
>                       else
>                       System.out.println(line);
>                  }
>           }
>           catch (IOException e) {
>               System.out.println(e);
>               e.printStackTrace();
>           }
>
>
>________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to