- From: Claire Ledrich <claire@research.att.com>
- Date: Thu, 26 Jul 2001 11:12:02 -0400
- To: www-jigsaw@w3.org, ylafon@w3.org
Hi, I posted this question a few weeks ago already. Here is a piece
od code describing the problem I have encoutered.
I need to receive data real time and I noticed that Jigsaw, version
2.2.0 on Solaris would do a great deal of buffering.
If you have time to, try this little piece of code I wrote to show
evidence of what I am saying:
You install a servlet: LogTest on Solaris and you just put my little
Java application on Windows 2000.
This shows, that on the servlet side. The HTTP Server waits until a
buffer is fillled to send any data. I'm using the jdk1.2.2 distribution.
I even tried to use jdk13 HTTPServletResponse class so as to be able to
tell the buffer size I want but it has no effect on the buffering. When
I set the buffer size to 1 , it is actually set to 4096.
What's more, if I send an HTTP/1.1 to the servlet, then it never
receives and understands the request and the only byte I can read is -1.
I launched Jigsaw with the option -trace,
when I used HTTP/1.0 to open a connection to the servlet, I got on the
servlet side :
GET /servlet/jamap.servlet.LogTest? HTTP/1.0
Date ...
Host ...
HTTP/1.1 200 OK
Date ..
Content-type: text/html
Server: Jigsaw/2.2.0
and then I have to wait for 40 sec before I get something on my Java
application which shoulld mean there is some buffering on Jigsaw ..
when I use HTTP/1/1 to open a connection to the servlet, I got this
exception on the servlet side:
+++ client-0(http-server-socket-clients:42) got exception:
org.w3c.www.http.HttpParserException: missing Host header
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Exception.java:42)
at
org.w3c.www.mime.MimeParserException.<init>(MimeParserException.java:11)
at
org.w3c.www.http.HttpParserException.<init>(HttpParserException.java:27)
at
org.w3c.www.http.HttpRequestMessage.notifyEndParsing(HttpRequestMessage.java:237)
at org.w3c.jigsaw.http.Request.notifyEndParsing(Request.java:82)
at org.w3c.www.mime.MimeParser.parse(MimeParser.java:207)
at org.w3c.www.mime.MimeParser.parse(MimeParser.java:220)
at org.w3c.jigsaw.http.Client.getNextRequest(Client.java:259)
at org.w3c.jigsaw.http.Client.startConnection(Compiled Code)
at org.w3c.jigsaw.http.socket.SocketClient.run(SocketClient.java:125)
at org.w3c.util.CachedThread.run(Compiled Code)
HTTP/1.1 400 Bad Request
Connection: close
Date: Thu, 26 Jul 2001 14:41:26 GMT
Content-Length: 0
Server: Jigsaw/2.2.0
Here are the two pieces of my code :
the servlet :
package jamap.servlet;
import java.io.*;
import java.net.*;
import java.util.*;
import jamap.server.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class LogTest extends HttpServlet {
ObjectOutputStream outstream;
ByteArrayOutputStream buffer;
public void init (ServletConfig cfg) throws ServletException {
super.init (cfg);
}
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws
ServletException, IOException
{
System.out.println("GET on the LogTest Servlet");
// response.setBufferSize(1);
ServletOutputStream out=response.getOutputStream();
this.buffer=new ByteArrayOutputStream();
outstream =new ObjectOutputStream(out);
while(true){
outstream.writeObject(new String("essai"));
outstream.flush();
buffer.writeTo(out);
out.flush();
System.out.println("wrote something");
try{
Thread.sleep(50);
}catch(InterruptedException e){
e.printStackTrace();
}
}
}
}
Here is a small Java application , running on Windows 2000 :
package jamap.test;
import java.text.*;
import javax.swing.*;
import java.util.*;
import java.io.*;
import java.net.*;
import javax.activation.*;
import javax.mail.internet.*;
import javax.mail.*;
public class eventtest{
public static void main(String argv[]) {
Socket s=null;
try{
String
u="http://fidelity.research.att.com:8080/servlet/jamap.servlet.LogTest?";
URL url=new URL(u);
s=new Socket(url.getHost(),url.getPort());
PrintStream out = new PrintStream(s.getOutputStream());
out.println("GET /servlet/jamap.servlet.LogTest?"+" HTTP/1.0
\r\n\r\n");
}
catch(Exception e){e.printStackTrace();}
while(true){
try{
System.out.println(s.getInputStream().read());
}catch(Exception e2){e2.printStackTrace();}
}
}
}
I would like to do a release of a reseach prototype using JIGSAW but
giving real time management. Could you help me out ?
THANK YOU
Claire
Received on Thursday, 26 July 2001 11:19:47 UTC