• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet Life Cycle

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'm new to web dev and especially to GWT. I would like to make some points clear in order to start my project on good basis:

  • When are the RemoteServiceServlet objects created, destroyed, and by who? One for each browser window? For example, for a typical login form, one only needs to store the current user's information in the members of the servlet and they will be kept until the browser is closed?


  • What are the best ways to split an application into servlets? What would be the relevant criterions for grouping requests in the same servlet?


  • If a XML file is parsed client-side in JAVA giving a static path aiming to my disk, the generated JavaScript code will not contain any evidence of this file being read, right? In other words, most of the client-side java code is preprocessing from the compiler point of view?


  • Thanks!
     
    Bartender
    Posts: 11497
    19
    Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Welcome to the Ranch.

    For a more detailed explanation of the RPC mechanism, you can refer to http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html#DevGuideRemoteProcedureCalls

    If you are using pure RPC, you don't really need multiple servlets. Just one XXXImpl with different methods

    What would be the relevant criterions for grouping requests in the same servlet?


    I am not really sure I understand what you are trying to say here. The XXXImpl is effectively a servlet. You can very well have an application, which only one servlet (viz. XXXImpl) but with different methods to handle different data/functionality. e.g. your XXXImpl can have methods like registerUser(), loginUser(), updateUser() etc.

    If a XML file is parsed client-side in JAVA giving a static path aiming to my disk, the generated JavaScript code will not contain any evidence of this file being read, right? In other words, most of the client-side java code is preprocessing from the compiler point of view?


    GWT is compiled into JS. All you can do on the client side is choose a file and upload to the server.
     
    Jason Mil
    Greenhorn
    Posts: 2
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks for your reply.

    From what I've read, a servlet object is created only once when the server is launched, not for every client session. Some tutorials are somewhat confusing: the user's information are stored in a pair of attributes (username, password) of the servlet, which means that all the users will actually share the same information. It does not make sense. Anyway, calling getThreadLocalRequest() is the best way to know which user the request is sent from?

    GWT is compiled into JS. All you can do on the client side is choose a file and upload to the server.



    For instance, in the client side I have the following java code:

    The generated javascript will look like this?

    It is what I meant by "preprocessing".
    reply
      Bookmark Topic Watch Topic
    • New Topic