I want to use XStream to serialize my RPC calls on my GWT application, and I'm hoping to get it done both ways, as I'm sending java objects back and forth. Is it possible to run XStream on the client side? how? Alternatively, can you recommend of any other xml-serializer for the client side?
I developed a client-side XML serializer, modeled after XStream. It uses annotations and GWT code generators to create serializers at compile time. It's a custom in-house project. I've wanted to polish it up and open source it but I just don't have the time right now. I just wanted to say it's possible... maybe someone will put something out there.
You're probably better off doing JSON or GWT-RPC however (even if it means you have an seperate endpoint that has to reroute calls). It's all about ease of maintenance (not hand-writing serializers).
I'm confused. You have a Java back end? Why not use the built in RPC mechanism? It's second to none if you're running Java on the back end.
I don't think it's possible to run XStream on the browser. Why don't you serialize using native JSON on the client side? XStream has got JSON parsing capabilities on the server. See http://x-stream.github.io/json-tutorial.html
Related
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.
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.
i have a problem with gwt application. i have an array of strings in the client application and i want to export it to a file, but it isn't probably possible so i have to use servlet, right? but i don't really know how.
It is quite unfortunate, given the advance of browser applications, that data produced by such applications cannot be saved by the user locally, but instead has to make e round trip to the server. It would be really helpful, I think, to adopt the data scheme (http://en.wikipedia.org/wiki/Data_URI_scheme) for such cases, and not only for images, which has proved itself quote useful. If this scheme is adopted a GWT app could build a link and provide the data to be saved as part of the href attribute of the tag.
Here's a guide on How to Call a Servlet in GWT.
Alternatively, use the GWT HTTP client to send a GET or POST request to the servlet.
In this case using servlet is a good idea or maybe RPC is better. What do you think? So far I wrote a separate servlet that writes an array of strings to a file. But I don't know how to connect to the gwt project. Will this created file be HttpServletResponse response in this case?
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