diff options
Diffstat (limited to 'gwtquery-core/src/test/java')
-rw-r--r-- | gwtquery-core/src/test/java/com/google/gwt/query/servlet/GQAjaxTestServlet.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/servlet/GQAjaxTestServlet.java b/gwtquery-core/src/test/java/com/google/gwt/query/servlet/GQAjaxTestServlet.java index a41dd1d7..5152de4c 100644 --- a/gwtquery-core/src/test/java/com/google/gwt/query/servlet/GQAjaxTestServlet.java +++ b/gwtquery-core/src/test/java/com/google/gwt/query/servlet/GQAjaxTestServlet.java @@ -10,6 +10,8 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.google.gwt.query.client.plugins.ajax.Ajax; + public class GQAjaxTestServlet extends HttpServlet { private static final long serialVersionUID = 1L; @@ -29,16 +31,14 @@ public class GQAjaxTestServlet extends HttpServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - String t = req.getParameter("timeout"); if (t != null && t.matches("\\d+")) { try { int ms = Integer.parseInt(t); - System.out.println(" Sleeping: " + ms); + System.out.println(name + "sleeping: " + ms); Thread.sleep(ms); } catch (Exception e) { } - System.out.println(name + "timeout"); return; } @@ -49,11 +49,13 @@ public class GQAjaxTestServlet extends HttpServlet { data = req.getParameter("callback") + "(" + data + ");"; } } else if (req.getMethod().equalsIgnoreCase("post") - && req.getContentType().toLowerCase().startsWith("application/json")) { + && req.getContentType() != null + && req.getContentType().toLowerCase().startsWith(Ajax.JSON_CONTENT_TYPE)) { BufferedReader reader = req.getReader(); String line; - while ((line = reader.readLine()) != null) + while ((line = reader.readLine()) != null) { data += line; + } } String origin = req.getHeader("Origin"); |