I wrote a handler that used an OutputStream and a StringBuffer.  Once
I did this, I could not reproduce your problem.  Before I made this
change, I could reproduce your problem.  BTW, I am testing this using
MINA 2.0.

------------------------------------------ START
--------------------------------------
Map<String, String> headers = new TreeMap<String, String>();
BufferedReader in = new BufferedReader(new InputStreamReader(this.in));

                       try {

                                StringBuffer buffer = new StringBuffer();
                                
                                // Get request URL.
                                //String url = in.readLine().split(" ")[1];

                                // Read header
                                String line;
                                while ((line = in.readLine()) != null && 
!line.equals("")) {
                                        String[] tokens = line.split(": ");
                                        headers.put(tokens[0], tokens[1]);
                                }

                                // Write header
                                buffer.append("HTTP/1.0 200 OK");
                                buffer.append("Content-Type: text/html");
                                buffer.append("Server: MINA Example");

                                buffer.append("<html><head></head><body>");

                                Iterator it = headers.entrySet().iterator();
                                while (it.hasNext()) {
                                        Entry e = (Entry) it.next();
                                        buffer.append("<p>" + e.getKey() + "-" 
+ e.getValue()
                                                        + "</p>");
                                }

                                for (int i = 0; i < 1024; i++) {
                                        buffer.append("<p>this is line: " + i + 
"</p>");
                                }

                                buffer.append("</body></html>");
                                
                                out.write( buffer.toString().getBytes() );
                                out.flush();
                                
                        } catch (Exception e) {
                                e.printStackTrace();
                        } finally {
                                out.flush();
                                out.close();
                                try {
                                        in.close();
                                } catch (IOException e) {
                                }
                        }
---------------------------------- END ----------------------------------------

--
..Cheers
Mark

Reply via email to