Take a look at filtering. I think this is what you actually want to
do.
http://viralpatel.net/blogs/2009/01/tutorial-java-servlet-filter-example-using-eclipse-apache-tomcat.html


On May 8, 12:59 pm, sim123 <[email protected]> wrote:
> I have couple of RPC classes in my application and some plain old
> servlets to perform specific actions. I am wondering how is order of
> execution for RPC vs other HTTP requests works. For example I have a
> login servlet which creates session for users and I want to make all
> RPC calls after successful login
>
> public void onModuleLoad() {
>
>         final RequestBuilder builder = new RequestBuilder
> (RequestBuilder.POST, "http://localhost:8080/A/login?debug=true";);
>
>         builder.setCallback(new RequestCallback() {
>                 public void onResponseReceived(Request request, Response 
> response) {
>
>                         userService.getUserInfo(new AsyncCallback<User>(){
>
>                                 public void onFailure(Throwable caught) {
>                                                 // TODO Auto-generated method 
> stub
>                                 }
>
>                                 public void onSuccess(User result) {
>                                         System.out.println("User info 
> received" + result.getUserName());
>                                 }
>
>                 });}
>
> public void onError(Request request, Throwable exception) {
>                         // TODO Auto-generated method stub
>
>                         }
>                 });
>
>                 try {
>                                 builder.send();
>                         }
>                         catch (RequestException e) {
>                                 // TODO Auto-generated catch block
>                                 e.printStackTrace();
>                 }
>
> }
>
> but for some reason the RPC request is getting executed first, and I
> get exception there because session is not created.
> I know login is not the perfect example here and I will do login via
> simple HTML and than load the application. But this should work and my
> service call should happen after login response is received, any idea?
>
> Thanks for the all the help and support.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to