Flushing output streams

Hello,
          I was a getting a harmlous excpetion :
          <4/06/2002 16:48:04> <Error> <HTTP> <Servlet execution in servlet
          context "WebAppServletContext(5985988,root,/root)" failed,
          java.net.ProtocolException: Didn't meet stated Content-Length, wrote:
          '7358
          4' bytes instead of stated: '94440' bytes.
          java.net.ProtocolException: Didn't meet stated Content-Length, wrote:
          '73584' bytes instead of stated: '94440' bytes.
          at
          weblogic.servlet.internal.ServletOutputStreamImpl.finish(ServletOutputStreamImpl.java:413)
          at
          weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.java:974)
          at
          weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1964)
          at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
          at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
          I read about it on this newsgroup, and I saw some people suggesting to
          flush the output streams with ( out.flush()).
          But this is weird, doesn't Weblogic flush the output streams by itself??
          I had the same application running on tomcat before and everything was
          fine, I didn't have to flush the output streams with tomcat
          And what is the consequence of not flushing the output streams.
          Thanks guys
          Itani
          [att1.html]
          

I have the same problem. I have seen a lot of messages reporting this
          problem... what is the right solution? Can weblogic become instable
          due to this condition?
          I use some Oreilly classes (com.oreilly.servlet.MultipartRequest) to
          intercept some POST data; Is there anyone who knows if these classes
          can cause the ProtocolException problem?
          Bye
          Luca
          "Vinod Mehra" <[email protected]> wrote in message news:<[email protected]>...
          > No flush will not help here.
          >
          > This exception will show up in only two cases:
          >
          > 1. You wrote less than the promised content length was.
          >
          > 2. While you were writing the client terminated the connection. I
          > remember we used
          > to throw this ProtocolException exception at the end, which was
          > unnecessary.
          > I know this problem has been fixed. We don't throw this exception
          > anymore
          > when the client abnormally terminates the connection. I believe the
          > problem has
          > been fixed in 610sp2. Which release/service pack are you using? If
          > you
          > can't upgrade and need a one off patch please contact support.
          > CR057091
          > was used to track this problem. One off patches are available for
          > 610sp1 and
          > 510sp12.
          >
          > Cheers!
          > --Vinod.
          > "Mohamed Itani" <[email protected]> wrote in message
          > news:[email protected]...
          > Hello,
          > I was a getting a harmlous excpetion :
          >
          > <4/06/2002 16:48:04> <Error> <HTTP> <Servlet execution in servlet
          > context "WebAppServletContext(5985988,root,/root)" failed,
          > java.net.ProtocolException: Didn't meet stated Content-Length, wrote:
          > '7358
          > 4' bytes instead of stated: '94440' bytes.
          > java.net.ProtocolException: Didn't meet stated Content-Length, wrote:
          > '73584' bytes instead of stated: '94440' bytes.
          > at
          > weblogic.servlet.internal.ServletOutputStreamImpl.finish(ServletOutputStr
          > eamImpl.java:413)
          > at
          > weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.ja
          > va:974)
          > at
          > weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.j
          > ava:1964)
          > at
          > weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
          > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
          >
          > I read about it on this newsgroup, and I saw some people suggesting to
          > flush the output streams with ( out.flush()).
          >
          > But this is weird, doesn't Weblogic flush the output streams by
          > itself??
          > I had the same application running on tomcat before and everything was
          > fine, I didn't have to flush the output streams with tomcat
          >
          > And what is the consequence of not flushing the output streams.
          >
          > Thanks guys
          > Itani
          >
          >
          >
          > --
          

Similar Messages

  • Error flushing output stream when stop button is used

    Hello,
    I have a servlet running on the Sun ONE Web server 6.1 that throws this error message: "java.io.IOException: WEB8004: Error flushing the output stream".
    Through my testing, it seems as if this is caused by the user pressing the stop button before the output can be completely commited to the client. Strangely enough the error seems to thrown when IE is the browser but not when Firefox is. My guess is that what is happening is the client connection is closed when stop is pressed in IE and the server cannot write to the client anymore so the error is thrown.
    I was wondering if anyone has any insight into how to prevent this from getting thrown. I realize that this error is not a major thing and probably doesn't need to be worried about, but it is quite annoying because webmaster gets emailed anytime an exception is thrown so cutting down on pointless exceptions is something we like to do :)
    Thanks in advance.

    Hay, did you ever figure it out. I am getting it when one user hits my Servlet to download a specific piece of data????? I can't figure it out?
    Thanks for the info,
    Jeff

  • Not able to flush the data output stream in n/w prg.

    Hi,
    I am trying to send and receive the data using TCP/IP channel using socket programming.
    Following is the server side code I have
    Socket socket = server_socket.accept();
    OutputStream output = socket.getOutputStream();
    BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    String inputMessage = (String) input.readLine();
    System.out.println(inputMessage);
    output.write("Message from server");
    output.flush();I am able to receive the message from the client and as per the code the message is getting printed in the console. But I am unable to send the message back to the Client inspite of flushing the output stream.
    I am sure that the problem is because of the flush method which is not acutally flushing the data. If I use the "println" method instead of the write & flush method, everything seems to be working fine. I do not want to use the "println" method because I get an extra new line character in the msg I send to the Client.
    Any help on this is appreciated!

    No. I am not using BufferedReader to listen for the server response. Given below is my client side code.
    Socket socket = new Socket(<ip>, <port>);
    InputStream input = socket.getInputStream();
    PrintWriter output = new PrintWriter(socket.getOutputStream(),true);
    output.println("Request from the client");
    System.out.println("Waiting for the server response...");
    byte buffer[] = new byte[2000];
    input.read(buffer);
    System.out.println(new String(byte));I am not receiving the message from server, it hangs on "Waiting for the server response..".

  • Error flushing the output stream in Sun One server

    Hi All,
    I was running my servlet code in iPlanet 6.0 version and it was working fine. I upgraded my web server to new Sun One server (Oracle-iPlanet-Web-Server-7.0.9). With the new web server almost 90% of my application works fine, but there is a features in my application to download an Excel sheet by clicking a button. This feature is failing in new Sun One web server.
    Below are my piece of code and the error log I m getting. Can anyone tell me how I can fix this error, I mean is there any web server specific change or configuration parameter need to be set.
    Please ask for any information regarding my server configuration settings if needed for finding a solution for this
    Code:
    byte abyte0[] = new byte[1024];
    BufferedInputStream bufferedinputstream=null;
    BufferedOutputStream bufferedoutputstream=null;
    java.io.InputStream inputstream = httpurlconnection.getInputStream();
    bufferedinputstream = new BufferedInputStream(inputstream);
    bufferedoutputstream = new BufferedOutputStream(httpservletresponse.getOutputStream());
    int j;
    long byteCount=0;
    while((j = bufferedinputstream.read(abyte0, 0, 1024)) != -1)
    byteCount=byteCount+j;
    if(logger != null && logger.traceOn())
    logger.log("total"+byteCount);
    logger.log("Read bytes:"+j);
    bufferedoutputstream.write(abyte0, 0, j);
    if(logger != null && logger.traceOn())
    logger.log("Wrote bytes:"+j);
    bufferedoutputstream.flush(); // <<<<<< ERROR POINT >>>>>>
    Error Log :
    ClientAbortException: java.io.IOException: WEB8004: Error flushing the output stream
    at org.apache.coyote.tomcat5.OutputBuffer.doFlush(OutputBuffer.java:343)
    at org.apache.coyote.tomcat5.OutputBuffer.flush(OutputBuffer.java:313)
    at org.apache.coyote.tomcat5.CoyoteOutputStream.flush(CoyoteOutputStream.java:147)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124)
    at com.reuters.bdec.as.ASRequestHandler.processResponse(ASRequestHandler.java:285)
    at com.reuters.bdec.as.ASRequestHandler.initiateGetRequest(ASRequestHandler.java:89)
    at com.reuters.bdec.as.ASRequestHandler.proceedToDestination(ASRequestHandler.java:220)
    at com.reuters.bdec.as.ASExtension.authorisationCheck(ASExtension.java:84)
    at com.reuters.bdec.as.ASExtension.doGet(ASExtension.java:114)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:794)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:915)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:398)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:255)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:187)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
    at com.sun.webserver.connector.nsapi.NSAPIProcessor.service(NSAPIProcessor.java:160)
    Caused by: java.io.IOException: WEB8004: Error flushing the output stream
    at com.sun.webserver.connector.nsapi.NSAPIProcessor.action(NSAPIProcessor.java:243)
    at org.apache.coyote.Response.action(Response.java:197)
    at org.apache.coyote.tomcat5.OutputBuffer.doFlush(OutputBuffer.java:339)
    ... 20 more

    Don't flush it yourself. The servlet container will automatically flush for you once its send buffer is full. You can change the size of the send buffer though.

  • Preventing servlet output stream to flush

    I increased the buffersize in the response object in order to make it possible for the entire jsp page to process before writing any output to the webclient.
    BUT since I use dynamic jsp-includes I fail to accomplish this, since according to the JSP1.3 specification the output stream is flushed before processing a dynamic include instruction.
    Is there a way I can make JSP to process the include and write output to buffer WITHOUT flushing it?
    Regards, Jon

    No I am using JSP 1.3. And I want to do the following:<%
    for (int i = 0; i < 5; i++) {
       // include("file_"+ i +".jsp");
    %>This to include file_0.jsp up to file_4.jsp.
    I assume the <jsp:include>tag is preprocessed hence only included once.

  • Is there a way to flush out a socket's output stream without...

    ...having to close it (the stream)?
    I'm trying to implement a keep-alive feature in a simple HTTP Server application. This is a draft of the code I have trouble with:
    ==========
    //'clientSocket' is the socket obtained by the 'serverSocket.accept()' method
    OutputStream out = clientSocket.getOutputStream();
    //'message' is a string to be sent to the client
    InputStream data = new ByteArrayInputStream(message.getBytes());
    byte[] buff = new byte[2048];
    while (true)
    int read = data.read(buff, 0, 2048);
    if (read <= 0)
    break;
    out.write(buff, 0, read);
    out.flush();
    ==========
    If I don't call 'out.close()', the data will not be sent to the client.
    If I call 'out.close()', the data will be sent, but the socket will be closed too, which I don't want to. I need to be able to reuse that socket .
    Is there any way to properly push out the data to the client without having to close the output stream?

    ...having to close it (the stream)?Yes. OutputStream.flush(). But if you're not using any kind of buffered writer/output stream you don't even have to do that.
    If I don't call 'out.close()', the data will not be sent to the client.Untrue. The client will read everything that has been written If you don't close the output stream, the client will never get the EOS indication (e.g. read() returning -1). So if your client is looping until that happens it will loop forever ...
    Your problem at the moment is at the reading end.

  • Questions about input/output streams

    In the following tutorial:
    http://chortle.ccsu.ctstateu.edu/CS151/Notes/chap85/ch85_10.html
    It mentions that some methods, such as write(), writeByte(), writeBytes(), and writeChar(), return the low eight bits of the argument to the output stream. I am a little unsure of what exactly that means, might somebody be able to clarify for me?
    In addition, I've been encountering the flush() method in some of the byte- and character-streaming objects that deal with buffers. What exactly is the flush() method's purpose, and when might it be used? Thank you.

    flush pushes the data out of the buffer. the write methods write to the buffer, when the buffer is full, it flushes itself (usually), or it could block the write methods (in theory). flush just lets you make sure that it's flushed.
    I'm not sure there's any reason to worry about high and low bytes in Java most of the time. I suppose, like anything, there's times you need to, but I can't think of any offhand.

  • Exception writing binary data to the output stream to client -Broken pipe

    Hi,
    I am trying to use the drag & drop feature using Contributor mode of Webcenter sites. Single Image Page Attribute is working properly where as Multiple Image Page Attribute throws the following error:
    [ERROR] [.kernel.Default (self-tuning)'] [logging.cs.satellite.request] Exception writing binary data to the output stream to client 10.191.117.106
    java.net.SocketException: Broken pipe
         at java.net.SocketOutputStream.socketWrite0(Native Method)
         at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
         at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
         at weblogic.servlet.internal.ChunkOutput.writeChunkTransfer(ChunkOutput.java:568)
         at weblogic.servlet.internal.ChunkOutput.writeChunks(ChunkOutput.java:539)
         at weblogic.servlet.internal.ChunkOutput.flush(ChunkOutput.java:427)
         at weblogic.servlet.internal.ChunkOutput$2.checkForFlush(ChunkOutput.java:648)
         at weblogic.servlet.internal.ChunkOutput.write(ChunkOutput.java:333)
         at weblogic.servlet.internal.ChunkOutputWrapper.write(ChunkOutputWrapper.java:148)
         at weblogic.servlet.internal.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:148)
         at COM.FutureTense.Servlet.ServletRequest$OutputOutputStream.write(ServletRequest.java:80)
         at COM.FutureTense.Servlet.ServletRequest.write(ServletRequest.java:1633)
         at com.openmarket.Satellite.RequestContext.write(RequestContext.java:1123)
         at com.openmarket.Satellite.BytePiece.stream(DataPiece.java:253)
         at com.openmarket.Satellite.CacheObjectImpl.stream(CacheObjectImpl.java:651)
         at com.openmarket.Satellite.Http11Responder.respondForWrapper(Http11Responder.java:142)
         at com.openmarket.Satellite.WrapperAwareResponder.respond(WrapperAwareResponder.java:36)
         at com.openmarket.Satellite.SatelliteServer.execute(SatelliteServer.java:85)
         at com.openmarket.Satellite.servlet.BaseServlet.doGet(BaseServlet.java:118)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at com.fatwire.wem.sso.cas.filter.CASFilter.doFilter(CASFilter.java:557)
         at com.fatwire.wem.sso.SSOFilter.doFilter(SSOFilter.java:51)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    Thanks
    KarthiK

    Thank u very much,
         FileOutputStream opGif = new FileOutputStream(destFile, false);
    I have changed above line with the following line:
         PrintWriter opGif = new PrintWriter ( new FileWriter(destFile, false));
    and now this code is working very fine.
    Thanks once again...

  • PDF Document as an Output Stream.

    Hi,
    I have created a PDFwriter class that easily creates and writes a PDF document stream to a fileout stream.I am using JSP to do the same.
    What i want to do now is directly send the stream to an output stream instead of a fileoutput stream. Question is which one??
    How do i pass it to response obj, (response.setOutputStream(System.out) does not work)
    I am Pasting some code so that you can understand what i mean( >> means next step)
    Document document = new Document(PageSize.A4.rotate(), 10, 10, 30, 20); >>
    File file = new File("C:\\ePro\\PDFGenerator\\Report.pdf"); >> document.open();
    Table table = new Table(9); >> table.setPadding(0); >> table.setSpacing(1); >>
    table.addCell(new cell ("Any String",fontF); >> document.add(table); >> document.close(); >>
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file));
    The above code creates a PDF file on my disk which i can then redirect. Eg
    response.setContentType("application/pdf");
    response.sendRedirect("Report.pdf");
    What i want now is to replace the constructor for PDFWriter with a different Output stream and directly write it to browser.
    Please help as i am stuck for quite some time now....

    byte[] pdfContent = PDFProcessor.getPDFStream(roleID,report,Integer.parseInt(languageID));
    response.setContentType("application/pdf");
    ServletOutputStream out = response.getOutputStream();
    System.out.println("Writing PDF");
    out.write(pdfContent);
    out.flush();

  • Output Stream to JTextArea

    Hi there,
    I would like to have the output stream coming from the server to the client displayed on a JTextArea. However, because the coming file is a text document that had its file name passed as a local variable in the main method header with String a[ ], I am having difficulty setting this as the area text because of the incompatible types. This text prints on my command prompt window but I cannot figure out how to get this stream into the JTextArea. This is my code. The objective is to ask a file from the server and have the server send this file to the client so the client can then make changes and save.
    import java.io.*;
    import java.net.*;
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import javax.swing.JScrollPane;
    import javax.swing.JButton;
    import javax.swing.Box;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.FileNotFoundException;
    import java.io.PrintWriter;
    import java.util.Scanner;
    import java.util.Formatter;
    public class Client extends JFrame{
            public static JTextArea enterArea1;
            public static JTextArea enterArea2;
            public JButton change;
            public JButton save;
      public Client()
            super ("Client to Server");
            Box box = Box.createHorizontalBox();
            enterArea1 = new JTextArea(10, 15);
            enterArea1.setEditable (true);
            box.add (new JScrollPane (enterArea1));
            change = new JButton("Make Changes");
            box.add(change);
            change.addActionListener(
             new ActionListener()
                public void actionPerformed(ActionEvent event)
                Scanner console = new Scanner (System.in);
             System.out.print ("Input File: ");
             String inputFileName = console.next ();
             System.out.print ("Enter the text that you want to change");
             String inputText1 = console.next ();
             System.out.print ( "Output File: ");
             String outputFileName = console.next();
              try
              FileReader reader = new FileReader (inputFileName);
              Scanner in = new Scanner (reader);
              PrintWriter out = new PrintWriter (outputFileName);
                   String line1 = in.nextLine();
                   out.println( " " + inputText1 );
              out.close();
              catch (IOException exception)
              System.out.println ("Error processing file: " + exception);
            save = new JButton("Save to File");
            box.add(save);
            save.addActionListener(
             new ActionListener()
                public void actionPerformed(ActionEvent event)
                enterArea2.setText (enterArea1.getSelectedText());
            enterArea2 = new JTextArea (10, 15);
            enterArea2.setEditable (false);
            box.add (new JScrollPane (enterArea2));
            add (box);
      public static void main(String a[]) throws IOException {
            Socket sock;
            BufferedReader dis;
            PrintWriter dat;
            Client sendServer = new Client();
            sendServer.setSize (500, 200);
            sendServer.setVisible(true);
            sendServer.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
            sock = new Socket("127.0.0.1",4444);
            dis = new BufferedReader( new InputStreamReader(sock.getInputStream()) );
            dat = new PrintWriter( sock.getOutputStream() );
            dat.println(a[0]);
            dat.flush();
            enterArea1.setText(a[0]);
            PrintStream os = new PrintStream (new FileOutputStream ("out.txt"));
            String fromServer = dis.readLine();
            while (fromServer != null )
               System.out.println(fromServer);
               os.println(fromServer);
               fromServer = dis.readLine();
            sock.close();
    }

    I believe that the logic is to append the text to the JTextArea with something along the lines of this, but since String a[0] is passed in my void method, it is not accepted as a string anymore. The question then becomes how to create a variable that is referenced to the output text on the command window so that this variable can be used to append the same text to the JTextArea. I will appreciate any comments. Right now, it sees the String text as null.
    String text = dat.println(a[0]);
                          dat.flush();
            enterArea1.append(text]);

  • Buffered input/output stream

    How the buffereing is done in buffered input/output streams?
    From the API doc I got to know that they use internal buffer to store bytes before they can be read or written. But i found that File input/output stream also have methods like read(byte[]) or write(byte[]). So what is extra in buffered input/ouput streams? Does the phrase "buffered" suggests that bytes can be read from an array or be written to an array? Am i thinking the right way?

    How the buffereing is done in buffered input/output
    streams?
    From the API doc I got to know that they use internal
    buffer to store bytes before they can be read or
    written. But i found that File input/output stream
    also have methods like read(byte[]) or write(byte[]).Thouse are your buffer, not the streams'.
    So what is extra in buffered input/ouput streams?
    Does the phrase "buffered" suggests that bytes can be
    read from an array or be written to an array? Am i
    thinking the right way?No. It means that the stream either prefetches some data even if it's not requested yet, or that it withholds data that it's supposed to write until it's flushed or gets a larger chunk.

  • REG:SERVLET OUTPUT STREAM

    I am trying to implement upload/view functionality..To view an uploaded txt file or html file,I am just flushing out the file contents into servlet's output stream..The content type has been set appropriately.
    The problem is for some html files ia m able to see the file contents in the browser,and for some html files,the browser displays a open/save dialog box..
    Can any1 explain me why this discrepency?Its the sam e code and same content type..why is it so?

    Thanks for ur reply...
    All i mentioned was in the same browser..PFB the code snippet
         ServletOutputStream pic = null;
         pic = response.getOutputStream();
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         byte b[] = new byte[5*1024];
         while(true)
              int bytes = in.read(b);
              if(bytes == -1)
                   break;
              baos.write(b, 0, bytes);
         response.setContentLength(b.length);
         b = baos.toByteArray();
         pic.write(b, 0, b.length);
         pic.flush();
         pic.close()

  • No more output streams available error

    I have created a class to connect to a webserver extending the Thread class now using that i am trying to send data to the server with a timere task every 5 seconds first time works fine but when it tries to send for the second time it gives me an error saying. java.io.IOException: no more output streams available
    can any one help me how to get rid of this. The line
    connection.openDataOutputStream() is where things go wrong.

    this is the problamatic code
      try {
            OutputStream ostr = connection.openDataOutputStream();
            DataOutputStream os = new DataOutputStream(ostr);
            os.writeInt(5);
            //os.flush();
            os.close();
          catch (IOException ex) {
            ex.printStackTrace();
    when this part executes for the first time things are just fine but the second time it gives the no stream available exception at connection.openDataOutputStream()thanks 4 ur reply.can u look into this code if u could.

  • Challenge: Controlling the output stream of includes within iterative tags

    Problem:
    How can you control the output stream of an iterative tag that is making an include on each iteration (either by using the jsp include tag or by a custom tag that does an pageContext.include(). Example of the first of such a case could be:
    <wf:iterator name="...">
    <div>
    <jsp:include page="test.jsp" flush="true"/>
    </div>
    <wf:iterator>
    I now want to see the following output:
    <div>
    ..content of jsp file 1
    </div>
    <div>
    ...content of jsp file 2
    </div>
    etc....
    However what I AM seeing is that the jsp content is flushed to the output stream before the divs like this:
    ...content of jsp file 1
    ...content of jsp file 2
    <div>
    </div>
    <div>
    </div>
    See!? How is that and what can I do to control the output stream??
    Thanks
    Alf Johannessen
    Ariol

    This is a stab in the dark, but have you tried writing your div tags out using the JSP directive:
    out.println("<div>");
    or
    <%="<div>"%>
    It looks like a bug in the iterator. I'd suggest you try setting flush to be false, but I know that's not supported yet (unless you've updated your libraries) ...

  • Weird network output streaming....

    This is what I notice...
    I have made a simple file uploader, just for fun, which uploads files to my own file server, by a POST method through a multi-part/data form...
    obviously I use an output stream to write the file content to the server..
    say:
    for(int i = file.read(); i!=-1; i=file.read())
    uc.getOutputStream.write(i);
    uc.getOutputStream.flush();btw, the above is just a very simplified code..
    How come the upload does not finish when i=-1? I use a web analyzer to track my java program, and it tells that my Java program is still uploading file content despite i is already -1....
    any explanation on this??
    thanks alot

    no one can help??
    can any one explain how does the streaming/uploading mechanism work on behalf of Java's implementation?
    thanks

Maybe you are looking for

  • HP Officejet and PSC Full Feature Software for HP PSC 1210 All in one printer

    Hello ,              I have  HP PSC 1210 All in one printer but i am using windows 7 system.how can i find                                                                             'HP Officejet and PSC Full Feature Software' compatible for windows

  • Re: error creating domain - need help!

    Hi all, Getting the below error in install logs while configuring Forms/Reports (11.1.2.1) Create Domain fails for missing prerequisites Setting ORACLE_HOME to C:\Ora_MWhome\Ora_FRHome Setting Doracle.config.mode to true Adding c:\tmp\OraInstall2013-

  • Slow Moving/Dead Stock Report

    Hi Guys BEsides T.COdes MC46 and MC50 what other reports that are available on SAP to give the same information and also their Current Stock Balances Vishnu

  • Sql Loader - Concurrent request id issue!

    Hello there: I want to load request id in my sql loader script please advice how can I do. Below is my scipt file. LOAD DATA INFILE '${CINT_TOP}/uploads/f_cost/inprocess.dat' BADFILE '/tmp/inprocess.CFL.bad' INTO TABLE cost_temp REPLACE FIELDS TERMIN

  • Wireless driver triggers warm/hot macbook and low battery life after OS 10.8 mountain lion upgrade

    Hello frustrated Macbook users. I have tried to get help on other Apple discussions but no one seems to want to help, they aren't actually reading my posts, or they hate me for some reason.  No matter. If you have a warm Macbook that has 2.5 hours of