What method gets called in your code when your app receives a GET request?  Or 
a POST request?  I think that's what you're looking for.  Unfortunately the 
documentation for these frameworks sometimes tries to sugar coat things and 
hide ("abstract away") these low level details, or they assume it's obvious how 
things work, which it may be to to some but not all of us.


John V Denley wrote:
> LOL - damn... though it shouldnt matter whats being used for the front
> end really....maybe Im asking the wrong question!!
> 
> Does anyone else have any idea how to explain what the entry point is
> within the java code, or where the code is that actually executes what
> the task queue is supposed to do? Does anyone know how to ask the
> question Im trying to ask?!
> 
> On Dec 13, 8:22 pm, Rusty Wright <[email protected]> wrote:
>> Heh, I'm on the flip side; I don't know anything about GWT.
>>
>>
>>
>> John V Denley wrote:
>>> Thanks for this Rusty, Im not sure I understand all of it right away
>>> (perhaps with more investigation I will work it out)
>>> However Its worth mentioning that as far as I know Im not using Spring
>>> or Stripes or Struts (not even sure what any of these are!)
>>> I am using native GWT (v2.0)/GAE(v1.2.8) and using RPC to make calls
>>> to the server side.
>>> I have tried creating a "public" function in my main java file (right
>>> above the onModuleLoad() function) as follows:
>>>     public void testqueues()
>>>     {
>>>            Window.alert("hello test queues");
>>>     }
>>> The thinking then being that I might be able to make a call to
>>> http://your-gae-app.appspot.com/testqueuesand it would show the alert
>>> box. (I would like to prove this in the dev environment, but Im not
>>> sure how to do this now that the URL for that is currently
>>> http://localhost:8888/IDeBanet.html/testqueues?gwt.codesvr=192.168.0....)
>>> Its entirely possible that I have totally misunderstood how this is
>>> meant to be working and if so I apologise for asking stupid questions,
>>> or making incorrect/confusing statements, but it seems theres no real
>>> way of figuring out this stuff until you just try to implement it! Ive
>>> learnt a huge amount about web development and in particular GWT/GAE
>>> over the last 4-5 months!!
>>> Cheers,
>>> J
>>> On Dec 13, 5:46 am, Rusty Wright <[email protected]> wrote:
>>>> I think I got the gist of it.  As a test I modified the Stripes action 
>>>> bean that handles my first page and added the following to its 
>>>> @DefaultHandler method:
>>>>   finalQueuequeue= QueueFactory.getDefaultQueue();
>>>>  queue.add(TaskOptions.Builder.url("/zugzug.zug")); // web.xml maps *.zug 
>>>> to stripes
>>>> It's adding ataskto thequeue.
>>>> Then I created an action bean for thegaetaskqueueautomaton to poke:
>>>>   @UrlBinding("/zugzug.zug")
>>>>   public class TaskQueueActionBean implements ActionBean { ...
>>>> and its @DefaultHandler method contains:
>>>>   @SuppressWarnings("unchecked")
>>>>   final List headerNames =
>>>>           Collections.list(getContext().getRequest().getHeaderNames());
>>>>   this.log.debug("header names: {}", headerNames);
>>>> And then the log received:
>>>>   header names: [Content-Type, User-Agent, Referer, Host, 
>>>> X-AppEngine-QueueName, X-AppEngine-TaskName, X-AppEngine-TaskRetryCount, 
>>>> Content-Length]
>>>> The first time I tried it I forgot to create the corresponding jsp view 
>>>> file, zugzug.jsp (which is essentially empty), and thetaskqueueautomaton 
>>>> kept retrying because stripes was returning an error because the jsp file 
>>>> was missing; lots of those log.debug lines in the log file.  After I fixed 
>>>> that then it was only in there once for each time I went to my first page.
>>>> The first page action bean enqueued thetask, thetaskqueueautomaton sent an 
>>>> http request to the url zugzug.zug, then the TaskQueueActionBean was 
>>>> invoked and its success caused the automaton to dequeue thetask(but not if 
>>>> it returned an error; then the automaton retries).
>>>> Rusty Wright wrote:
>>>>> The docs say "The defaultqueuewill call the request handler at the URL
>>>>> /worker ..."  So it sounds to me that if you were, forexample, using
>>>>> Spring MVC, and had a Spring controller with
>>>>> @Controller
>>>>> @RequestMapping("/worker")
>>>>> public final class WorkerController {
>>>>>    @RequestMapping(method = RequestMethod.GET)
>>>>>    public String handleGetRequest(final ModelMap model) {
>>>>>        this.log.debug("called");
>>>>>        return (null);
>>>>>    }
>>>>> }
>>>>> then it would call your handleGetRequest() method 5 times a second, by
>>>>> sending an http GET (or POST?) request to your /worker url each time.
>>>>> Similarly, with Stripes (and for Struts 2 probably something similar) it
>>>>> would be something like
>>>>> @UrlBinding("/worker")
>>>>> public class WorkerActionBean implements ActionBean {
>>>>>    @DefaultHandler
>>>>>    public Resolution handleRequest() {
>>>>>        this.log.debug("called");
>>>>>        return (null);
>>>>>    }
>>>>> }
>>>>> I'm returning null because I don't know what thetaskqueuething does
>>>>> with what it gets back (I didn't read much of their docs; to tell the
>>>>> truth, I stopped at that sentence I quoted at the top because it sounds
>>>>> very similar to their cron thing, which docs I did read most of).  I'm
>>>>> undoubtedly also lacking the code needed to pull the nexttaskoff the
>>>>> queueand do something with it.
>>>>> I'm assuming that you have some web framework in front of everything and
>>>>> thus don't need a servlet mapping in your web.xml for the /worker url
>>>>> since the web framework is handling the url mapping.
>>>>> So they're "pinging" your /worker url using a plain old http request to
>>>>> initiate running eachtask; your controller or action bean is what
>>>>> performs thetask.  Think of it like you typed in your browser's address
>>>>> boxhttp://your-gae-app.appspot.com/worker?task_queue_params_go_hereor
>>>>> you used the command line programs cURL or wget.
>>>>> If I understand this correctly then I would say that their sentence I
>>>>> quoted isn't as clear as it could be.  Given the way it's stated, is the
>>>>> taskqueuereally able to bypass all of the http request processing and
>>>>> directly invoke my handler method?  How would it know which class+method
>>>>> handles that url?  I would think that the servlet container calls the
>>>>> request method, as a result of theirtaskqueueautomaton diddling the url.
>>>>> John VDenleywrote:
>>>>>> Yes, I would like a "real"exampleof how to do this too, I get that
>>>>>> we need to use a URL to accept the request to do something, but where
>>>>>> does the URL start executing code. obviously its not going to be at
>>>>>> the "onModuleLoad" entry point.
>>>>>> Thanks,
>>>>>> John
>>>>>> On Nov 11, 1:23 am, edarroyo <[email protected]> wrote:
>>>>>>> Is there anygaesamples usingtaskqueues that we can look at?
>>>>>>> I am having a really hard time understanding how to useTaskQueues.
>>>>>>> Thanks!
>>>>>>> On Oct 27, 6:18 pm, Vincent <[email protected]> wrote:
>>>>>>>> Thanks , Jason. It's very helpful for me to understand how to use this
>>>>>>>> new API.
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Google App Engine for Java" 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-java?hl=en.
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "Google App Engine for Java" 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 
>>> athttp://groups.google.com/group/google-appengine-java?hl=en.
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine for Java" 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-java?hl=en.
> 
> 

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" 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-java?hl=en.


Reply via email to