I am developing one application with GWT as client and my server side code written in Java servelt and I am fetching some data from another server. that another server code is in Scala. so the question is how can i push data from another server to my main server and display that data to client using comet ( gwt-comet.jar)
Please help me.
Thanks
Comet is something that your web server must support, via continuations or some other implementation (see this as an example). Usually web frameworks (like Lift) have some wrapper around this mechanism to facilitate using it.
I'm no expert on GWT, but for what you say it seems it has a Comet library. Using it should be as simple as to implement classes following this library specifications and using a server that supports Comet.
Related
I have a question, I was developing a desktop web application based on a REST API in Java using Servlets and JSP, but my boss said that it's not the best way to create a web application, because servlets and JSP are working as fat/thick clients( a request to the server make the application to download all content of data not a part like GWT does) and he suggested to go with GWT because it is working as a thin client.
As I was looking on the Internet I didn't see that servlets are working as fat clients, so my question is why is better GWT than servlets?
GWT solves a different problem than servlets. GWT is a tool to make clients, and servlets/JSP are tools for telling servers what to send to clients.
For example, my server uses a JSP to serve a GWT client, and servlets to connect the client to my database. I use all at once! You could use just one.
You can make your GWT client arbitrarily thick or thin. You can even run a GWT application with no server at all.
Use GWT if you want a nice tool for making complex, cross-browser web apps in Java. The decision to use JSP or servlets should be made separately.
Is it possible to write a server side of GWT application in other languages then Java if yes how to use GWT-RPC mechanism, an sample code please
Thanks
Please read the GWT documentation Communication with the Server:
If you can run Java on the backend and are creating an interface for your application's server-side business logic, GWT RPC is probably your best choice. [...]
If your application talks to a server that cannot host Java servlets, or one that already uses another data format like JSON or XML, you can make HTTP requests to retrieve the data.
You can write your server in any language you choose, GWT is just JavaScript to be run in your users' browsers.
If you decide to go that route, you should look into using RequestFactory to communicate with your server instead of GWT-RPC, which is Java-specific. RequestFactory uses standard JSON, which any language can read/write.
Dont waist your time with GWT-RPC. It's bad. Use RequestFactory. I am surprised people are promoting GWT-RPC. It's a broken toy.
What is the 'best' server-side technology on Linux to use with Google Web Toolkit & why? I'd like opinions about:
JSF and other Java based server technologies
Rails
Django
PHP
GWT is a client side technology used to convert Java to JavaScript.
If you want to use GWT as a client code for a client-server application you should use a Java based server to avoid problems.
You can use the GWT-RPC with any language or you can even use your own JSON wrapping, but the easier solution is to use a Java server.
My recommendation would be GAE, TomCat or Jetty. Both Tomcat and Jetty are really easy to configure in Linux and TomCat integrates nicely with Eclipse.
The server technology has very little to do with it; use whatever you're most comfortable with.
If you want to take advantage of GWT-RPC to pass Java objects between browser and server, you'll obviously need a server written in Java, but any Java server container will work more or less the same.
If you don't care about GWT-RPC, your server can be in any language, Python/Django, .NET/ASP, PHP, Rails, anything. At that point you're just going to be hosting JavaScript files, even static hosting should work for you.
You could even write a GWT app that doesn't connect to a server at all, where the user downloads the JS directly, perhaps packaged as a Chrome extension.
The path of least resistance will be a Java servlet container like Apache Tomcat or Jetty. The GWT servlets are deployed in the servlet container, and call into your own code for the purpose of persistence and other server-side application logic. All of the presentation logic should reside in the client-side GWT code.
May I also recommend that you take a good look at the Scala programming language? It integrates very neatly with Java, and is therefore a perfect language in which to write your server-side logic.
In terms of client-server communication, I recommend gwt-dispatch to you. It has a good following, and streamlines the handling of requests and responses on both the client side and the server side.
im searching for a GWT-RPC lib for the client side to communicate with a zend framework php server
thus rpc like json, xml or rest would be interesting
all i find are projects which have been stuck in years 2007/08 which dont seem to work anymore
so is there anyone who can suggest a working library?
thx
As far as I know nobody has built a GWT-RPC to communicate with a non-Java server, to allow you to have the automatic object sharing between client (written in Java) and server (written in non-Java) that GWT-RPC provides.
Luckily, GWT provides a mechanism for communicating with a server in regular JSON, using RequestBuilder. See this link for more information about making regular HTTP requests in GWT.
For web application development, I've been steeped in dynamic languages such as Ruby, PHP, and Python. Using popular frameworks for these languages, all my knowledge about HTML, CSS, and JavaScript transfers fairly straightforwardly: templates are basically HTML with embedded code that the server executes to generate the dynamic sections of the page.
Lately, I've been thinking about using GWT for building the UI of my next project. At this point, I'm just trying to wrap my head around how development with GWT works, as seems to follow an entirely different paradigm. In addition, it seems there's an unstated assumption that the server-side part of the app is written in Java. Would it be impractical to use something other than Java for the server side?
Related question:
GWT + GAE python: frameworks for COMET & RPC
While not actually impractical I would say that you get the most value from GWT by having the same code on client and server, since it allows for easy code reuse (fx. if your data objects are serializable then you could just send them directly to the client). So I guess my answer would be; yes you can do it and it's going to be more work than just having Java on the server side.
I don't think there's any requirement that you use Java on the server. At the end of the day, GWT compiles Java to JavaScript. You can do all the comms via the RequestBuilder object, you don't have to use the RPC services.
I guess the question is: if you don't like/know/prefer Java on the server side, why would you use it on the client when it's effectively an abstraction over JavaScript anyway?
There is no requirement to use Java on the server side. GWT supports JSON out of the box. Any server side component that can generate JSON ( or other supported serialization methods ) will work. You could use PHP on the server side, or bash shell scripts, it doesn't matter to the Javascript code that is generated by GWT.
Yes, it can be practical. I use Rails as my backend and GWT/GXT as my frontend. I love every bit of it! I couldn't stand worrying about browser incompatibilities, so GWT/GXT was a real joy. Also, I had already started my backend in Rails and did not have much experience with Java on the server, so I stuck with Rails.
You may want to take a look at an appropriate GWT Rest framework, as you won't be using RPC.
As an aside, there is one exception where you should use Java on the server. That's if you want to use Google App Engine.
Feel free to ask me any specific questions and I'll be happy to help you out.
Good Luck.
-JP