This seems a very roundabout approach. Why not just use /about?from=warmup as the warmup url?
FWIW, I don't think there is any ambiguity in the docs. When the warmup request returns, GAE thinks your app is initialized. If you spawn a task to make the actual work asynchronous, of course that isn't going to work! Jeff On Sun, Mar 25, 2012 at 7:31 PM, Tapir <[email protected]> wrote: > Sorry, maybe I didn't get it before. But I really think the docs for > custom warmup servlet is not perfect. > > The new code: > > public void service(ServletRequest req, ServletResponse resp) > throws ServletException, IOException { > try { > URL url = new URL("/about?from=warmup"); > HttpURLConnection connection = (HttpURLConnection) > url.openConnection(); > connection.setDoInput(true); > connection.setDoOutput(true); > connection.setRequestMethod("POST"); > connection.setRequestProperty("Content-Type", > "application/ > octet-stream"); > > DataOutputStream outSteam = new DataOutputStream (new > BufferedOutputStream (connection.getOutputStream())); > > byte[] keyBytes = "warmup".getBytes ("UTF-8"); > outSteam.write (keyBytes, 0, keyBytes.length); > outSteam.flush (); > outSteam.close (); > > connection.getResponseCode(); > } catch (Exception e) { > } > } > > And the old code: > > public void service(ServletRequest req, ServletResponse resp) > throws ServletException, IOException { > try { > Queue queue = QueueFactory.getDefaultQueue(); > queue.add(TaskOptions.Builder.withUrl("/ > about").param("from", "warmup").method(Method.GET)); > } catch (Exception e) { > } > } > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
