On Wed, Jan 18, 2012 at 7:00 AM, John Goche <[email protected]> wrote: > > In AccountsActivity.java we have methods getAuthToken() and getAuthCookie(). > Basically > the AccountManager takes care of storing the token information together with > the account > and we store the cookie in preferences together with our default account for > the application.
Right. It will also get a new token if the current one is expired. > We generate the cookie from the token somehow. > The particular algorithm depends on what authentication mechanism you are using. They are documented here: http://code.google.com/apis/accounts/docs/GettingStarted.html http://code.google.com/apis/accounts/ > Next comes AndroidRequestTransport.java. Here I don't understand why we have > the line: > > post.setHeader("Content-Type", "application/json;charset=UTF-8"); > Because GWT uses JSON to communicate with the server. > What if I want to communicate with the app engine server by sending XML > instead of JSON. Set the appropriate content type. However, If you want to use the automatically generated endpoints, this won't work. You'll have to write your own servlet that knows how to process your XML. > I think I need to send XML because the messages I send back and forth will > not correspond > directly with Java Objects but will be made up of many bits and pieces. > That doesn't make much sense. You can do pretty much the same thing with JSON. Unless you have some predefined XML structure (schema) you need to stick to, there is no *need* to use XML (you can if you want to). > I also don't understand why import > com.google.web.bindery.requestfactory.shared.RequestTransport > does not have any abstract methods to implement. > Don't have the code right now, but: generally automatically generated code will be harder to understand. Build a simple app manually (without wizards and code generation) to understand how the system works, once you are comfortable with that, you can use whatever tool makes your job easier. In this particular case, what makes you think it needs abstract methods? > I am trying to send data back and forth from the emulator to app engine in a > way that a response > is generated from the server by checking whether the user is authenticated > (a valid cookie is present) > and generating the appropriate response accordingly (the Users google api > should let me decide which > user is currently logged in on the server side). If the cookie is set properly, the Users API will return true, you don't have to check the cookie manually. BTW, you should really ask questions about the server side on the GAE forums. -- You received this message because you are subscribed to the Google Groups "Android Developers" 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/android-developers?hl=en

