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.

Reply via email to