>
The exception is gone (using flushBuffer)
but the output is not yet sended.
this is the piece of code that doesn't work
basically is the same of yesterday, i have add "resume" "BAU" and
some other output.
i can see "START" (thread start)
"RESUME" (request is resumed)
"BAU" (request is handled by the adapter, and since it was suspended,
ouput is send to res)
but no output on browser.
hope this will help :)
public class Webserver {
public static void main(String[] args) {
try {
GrizzlyWebServer ws = new GrizzlyWebServer();
ws.addGrizzlyAdapter(new GrizzlyAdapter() {
public void service(final GrizzlyRequest req, final
GrizzlyResponse res) {
if (res.isSuspended()) {
try {
System.out.println("BAU");
res.getWriter().println("rama stupid");
res.flushBuffer();
} catch (IOException e) {
e.printStackTrace();
}
return;
}
System.out.println("REQ "+req.getRequestURI()+"
"+Thread.currentThread().toString());
FakeSession s = new FakeSession();
s.res = res;
s.start();
res.suspend(100000, this, new
CompletionHandler<GrizzlyAdapter>() {
public void cancelled(GrizzlyAdapter arg0) {
System.out.println("cancelled");
arg0.service(req, res);
}
public void resumed(GrizzlyAdapter arg0) {
System.out.println("RESUME");
arg0.service(req, res);
}
});
}
}, new String[]{});
ws.start();
} catch (IOException ex){
// Something when wrong.
}
}
static class FakeSession extends Thread {
protected GrizzlyResponse res;
public void run() {
try {
System.out.println("START");
Thread.sleep(10000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (!res.isCommitted())
res.resume();
}
}
}
> rama wrote:
>> on this snapshot problem is still present -- grizzly-http-
>> webserver-1.9.2-20081217.130345-9.jar
>> Probably it will take until tomorrow to see the correct snapshot?
>
> Hum....Still seeing the exception(NPE) or no output? Strange....
>
> A+
>
> -- Jeanfrancois
>