Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » jetty 7 continuation help!
icon8.gif  jetty 7 continuation help! [message #672511] Sat, 21 May 2011 13:10
ravi  is currently offline ravi Friend
Messages: 4
Registered: April 2011
Junior Member
Hi,

i'm using jetty-7.4.1.v20110513 and servlet-api-2.5

i tried to use continations in the following servlet.


import java.io.*;
 import java.util.*;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
  
 import org.eclipse.jetty.continuation.*;
 


public class cs extends HttpServlet {

public void service(HttpServletRequest req, HttpServletResponse res)
throws java.io.IOException {

String reqId = req.getParameter("id");

Continuation cc = ContinuationSupport.getContinuation(req);

res.setContentType("text/plain");
res.getWriter().println("Request: "+reqId+"\tstart:\t"+new Date());
res.getWriter().flush();

cc.setTimeout(2000);
cc.suspend();

res.getWriter().println("Request: "+reqId+"\tend:\t"+new Date());
cc.complete();
}
}



I'm expecting a 2 sec delay but when i deploy the servlet in jetty, i'm getting output in the browser as following without any delay:

Request: null	start:	Sat May 21 15:25:02 IST 2011
Request: null	end:	Sat May 21 15:25:02 IST 2011



please help.
Thanks,
ravi.
Previous Topic:command line compilation settings
Next Topic:JDK 7 support in eclipse 3.7 available?
Goto Forum:
  


Current Time: Thu Dec 18 18:29:17 GMT 2014

Powered by FUDForum. Page generated in 0.01538 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software