Consider this: Filter every request. In that filter see if a "login" value is set in the httpsession. If not, send the request to the login servlet, poplulate the login value, then let the request go its way. If already set, just let the request go.
On May 11, 1:14 am, sim123 <[email protected]> wrote: > Thanks for your reply, actually I can not change the login servlet > method, that is out of my control. > > I still can not get these two things here, one is why my gwt > application is trying to call UserService without any mapping for it > in web.xml, I could see the logs like > > [WARN] 404 - POST /B/userinfo (127.0.0.1) 1411 bytes > in Jetty console. Another thing is, order of execution, because call > of userService is defined inside onResponseReceived() of login it > should get called once login response is received. > > Thanks for the help. > > On May 9, 7:14 am, gwtGrady <[email protected]> wrote: > > > > > Your example - "I have a login servlet which creates session for users > > and I want to make all > > RPC calls after successful login" > > > Instead of a login servlet use a login filter. This will ensure what > > ever login process you want has, in fact, taken place, then allows the > > request to continue to requested location. This is a common use of > > filtering. > > > Trying to coordinate the timing of servet requests is much more > > complicated/error prone solution... IMO > > > On May 8, 4:28 pm, sim123 <[email protected]> wrote: > > > > Thanks for the reply, but I don't want to filter the request,instead I > > > want is to control the order of execution of my requests. > > > > Thanks. > > > > On May 8, 12:07 pm, gwtGrady <[email protected]> wrote: > > > > > 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-exam... > > > > > 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.- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
