GAE java and javascript applications

102 views
Skip to first unread message

Mary

unread,
Apr 8, 2013, 6:27:39 AM4/8/13
to google-a...@googlegroups.com
Hi, I have a java application on GAE with a datastore (high replication). 
I would like to develop a new application in javascript and css (I'm using the phonegap framework) that works on the same datastore. Is it possible? 
I know there is a javascript version (rhino) supported by java.
Is this a possibility? Or is it better to use a java compiler/interpreter?

Wolfram Gürlich

unread,
Apr 8, 2013, 7:15:03 AM4/8/13
to google-a...@googlegroups.com
I've been using Rhino on GAE for over a year now and I'm happy with it. I haven't run into any compatibility issues. If you want it to, it even compiles your javascripts to java bytecode on the fly which makes it even faster. Also Rhino won't do extensive classpath scanning that would add to your instance startup time.

I'm just wondering why wanted to go that road in the first place. Isn't your phonegap app meant to be run on the phone? The kind of backend service and its implementation language shouldn't matter at all. Maybe I did get you wrong.

Greetings - Wolfram

Maria Carmela Vitelli

unread,
Apr 8, 2013, 10:02:55 AM4/8/13
to google-a...@googlegroups.com
So I have a java web application on GAE with a datastore. There is also a mobile application for android that takes and writes data on the datastore through json and servlet, and the data model is written in java (there is a conversion of data and a synchronization with the datastore and not a direct access from this app). Now I want to write a new application with phonegap to have an android-ios-windows application, but now the data model is completely in javascript. So I don't know how share datasore between web and mobile application. 


2013/4/8 Wolfram Gürlich <w.gue...@gmail.com>
I've been using Rhino on GAE for over a year now and I'm happy with it. I haven't run into any compatibility issues. If you want it to, it even compiles your javascripts to java bytecode on the fly which makes it even faster. Also Rhino won't do extensive classpath scanning that would add to your instance startup time.

I'm just wondering why wanted to go that road in the first place. Isn't your phonegap app meant to be run on the phone? The kind of backend service and its implementation language shouldn't matter at all. Maybe I did get you wrong.

Greetings - Wolfram

--
You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/4HNuju25BGg/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Wolfram Gürlich

unread,
Apr 9, 2013, 8:59:44 AM4/9/13
to google-a...@googlegroups.com
The json + servlet approach sounds fine to me. Ideally you won't have to write any new server-side code at all. Simply reuse the API you've already implemented for your android version. Just use XHR in phonegap to make the connection.

Greetings - Wolfram

Vinny P

unread,
Apr 9, 2013, 10:30:04 AM4/9/13
to google-a...@googlegroups.com

On Monday, April 8, 2013 9:02:55 AM UTC-5, Mary wrote:
So I have a java web application on GAE with a datastore. There is also a mobile application for android that takes and writes data on the datastore through json and servlet, and the data model is written in java (there is a conversion of data and a synchronization with the datastore and not a direct access from this app). Now I want to write a new application with phonegap to have an android-ios-windows application, but now the data model is completely in javascript. So I don't know how share datasore between web and mobile application. 


 To be clear, you already have an Android app that writes to GAE via JSON, and now you want to port it to iOS (Obj-C) and Windows Phone (VB.Net/C#)? Wolfram is correct, you shouldn't even need to write any code. The fact that the PhoneGap data model is Javascript is not a blocking issue, Javascript can write to JSON, and you can use cross domain requests/JSONP to transfer it to your web application. Here's some sample code to get you started: http://simonmacdonald.blogspot.com/2011/12/on-third-day-of-phonegapping-getting.html

One last thing: Make sure your server is setting the Access-Control-Allow-Origin header to * (just an asterisk), otherwise XHR won't work.


-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL

@GOV on AppDotNet: https://alpha.app.net/gov

Maria Carmela Vitelli

unread,
Apr 9, 2013, 11:47:47 AM4/9/13
to google-a...@googlegroups.com
Thanks Wolfram, I'll try!


2013/4/9 Vinny P <vinn...@gmail.com>

--

Maria Carmela Vitelli

unread,
Apr 9, 2013, 12:00:47 PM4/9/13
to google-a...@googlegroups.com
Yes, I have and Android app that writes on GAE via json. The idea is to use the PhoneGap framework to write an app available for Android, iOS and WP without write every app in its own language but just changing some configuration files and using javascript and css. So I have to write this new app with its several configurations file and then I can choise a method (rhino, or json+servlet+xhr, or your linked example) to communicate with datastore. Is it right?


2013/4/9 Maria Carmela Vitelli <vitel...@gmail.com>

Vinny P

unread,
Apr 9, 2013, 12:38:38 PM4/9/13
to google-a...@googlegroups.com

On Tuesday, April 9, 2013 11:00:47 AM UTC-5, Mary wrote:
Yes, I have and Android app that writes on GAE via json. The idea is to use the PhoneGap framework to write an app available for Android, iOS and WP without write every app in its own language but just changing some configuration files and using javascript and css. So I have to write this new app with its several configurations file and then I can choise a method (rhino, or json+servlet+xhr, or your linked example) to communicate with datastore. Is it right?


 That's correct. Basically PhoneGap handles all the device-dependent stuff; you write your app in HTML/Javascript (or a language that compiles down to JS) and PhoneGap builds the mobile-specific application for you. The only device-dependent issue that you need to deal with are the config files, but those are fairly short and easy to understand.

It doesn't matter what method you choose in the end, frankly all that matters is that you feel comfortable programming in that style. All 3 choices are valid.

Maria Carmela Vitelli

unread,
Apr 9, 2013, 12:43:01 PM4/9/13
to google-a...@googlegroups.com
Perfect! Thanks Vinny :)


2013/4/9 Vinny P <vinn...@gmail.com>
Reply all
Reply to author
Forward
0 new messages