GWT, with multiple clients - ajax

I am designing a web application using GWT currently, which is also the first time i am using GWT. I just have a general question about how (or can) GWT handles communications between multilpe clients.
My application needs user to login and has personalized pages for different users, GWT is well able to do all of these. The only problem is user needs to know what other users are doing, a simple example is like Google Talk, when one user is "typing", the other side will be noticed. So i am just wondering if GWT can do this?
As i said this is my first time using GWT, so, if GWT is well able to provide the these user interacting functions, i will go with GWT, otherwise i can make changes when it is not too late.
Thanks!!!

Looking at the example you gave, if user A starts typing, there's no problem sending the "started typing" event to the server. The server would than have to look up who user A is talking with (say, user B), and get the information to B's browser. This is, of course, the trickier part, but there is more than one way to perform the task, as described for instance here.
In summary, if you're OK with passing the requests through the server, I don't see a problem with using GWT as the underlying technology.

What you need is server push/ajax push/comet/many other names. I've summarized the options you have for GWT in a different answer.
For a quick start, check out NGiNX_HTTP_Push_Module - IMHO it's the easiest one to customize to your needs and they provide a nice chat example that should get you started. However, if you also use jQuery or Mootools in your application (for example, for UI effects), you might want to also consider Ajax Push Engine/APE-Project (but remember that jQuery/Mootools might require some tweaking to work with GWT). Those two are my favorites :)

Related

Easiest language/framework to use for web app that follows MVC for someone who has experience with Java/JavaFX

I am trying to create a web app that allows the user to browse a noSQL (Preferably MongoDB) database and perform some queries using a graphical interface. All the queries are written in the code and the user only needs to click links and/or enter strings (mostly to search for matches to be displayed in properly formatted tables). The app follows MVC model.
Up until now I used to write similar desktop apps using Java and JavaFX. I have no experience with other languages or frameworks (Aside from C and SDL), neither have I ever deployed anything on a server, and the assignment should be completed within 6 weeks (Three other students are working with me). And I have the three following questions:
Which language/framework is easiest to learn (considering I/we know Java/JavaFX)?
The answer to that would most probably be JavaScript*, which takes me to the next question:Is there any (practical) way that I would make it possible to write the app without having to learn HTML and CSS?
The third and last question, in case I write the View class in JS or Angular, can I write the Controller and Modal with Java (If we disregard complicated workarounds)? And do I deploy all three MVC classes/packages on the same server?
*I believe some would suggest we use GWT or Vaadin, and in this case I wonder if these frameworks have any quirks or limitations that would make it difficult for us as students to work with, be it when it comes to deployment (which is totally new for us) or the writing of the code itself.
Thanks a lot in advance.
Since nobody answered I am posting the best answer I could find so if anyone googles this subject could read it. At last we went with Java for backend running on Tomcat server and JS for front end. It turns out that HTML is very simple and JS is pretty similar to C/Java in syntax.

Monitoring AJAX requests between a Flash applet and a server via a Google Chrome extension

I am playing a Flash-only game that uses AJAX to communicate with the server. The problem is that all the data is "drawn" and most of it not copy/pastable, so I end up retyping URLs and similar stuff from parts of it (i.e., from the chat).
I thought I'd make a simple page action extension for Chrome that would intercept all the AJAX communication between the game and the server, the way Developer tools can do it, and display only the data I'm interested in (parsing URLs and similar stuff is a no-brainer).
However, looking around the internet, I've found no info on how to do this. Many sites (including answers to some questions here) mention using Developer Tools (I'd prefer having a page action extension, simple enough to share with other players, but any other automation is welcome as well), some mention chrome.webRequest (which seems to be able to provide only the headers),...
I also thought of making a content script along the lines of this answer, but since I'm trying to read the data between a Flash applet (not a web page) and a server, I don't think injecting a JavaScript code is possible.
So, my question is: can this be done and, if yes, how?
In case anyone got the wrong idea, the aim of this is only to monitor the communication and extract the parts I'd want to be able to copy/paste, not change any data (i.e., the purpose is simplification of the game play, not cheating).

specific limitations of AJAX?

I'm still pretty new to AJAX and javascript, but I'm getting there slowly.
I have a web-based application that relies heavily on mySQL and there are individual user accounts that are accessed and the UI is populated with user specific data.
I'm working on getting rid of a tabbed navigation bar that currently loads new pages because all that changes from page to page is information within one box.
The thing is that box needs to reload info from the database, etc.
I have had great help from users here showing that I need to call the database within the php page that ajax is calling.
OK-so pardon the lengthy intro-what I'm wondering is are there any specific limitations to what ajax can call that I need to know about? IE: someone mentioned that it's best not to call script files and that I should remove scripts from the php page that is being called and keep those in the 'parent' page. Any other things like this I need to keep in mind?
To clarify: I'm not looking to discuss the merits/drawbacks of the technology. I'm wondering about specific coding implementation that I need to be aware of (for example-I didn't until yesterday realize that if even if I had established a mySQL connection on the page, that I would need to re establish that connection in my called page as well...makes perfect sense now).
XMLHttpRequest which powers ajax has a number of limitations. I recommend brushing up on the same origin policy. This is a pivotal rule because it limits where AJAX calls can be made.
First, you can't have Javascript embedded in the HTTP response to an AJAX call. That's a security issue.
No mention of the dynamics of the database, but if the data to be displayed in tabs doesn't have to be real-time, why not cache it server-side?
I find that like any other protocol, Ajax works best in tightly controlled conditions. It wouldn't make much sense for updating nearly the whole page, unless you find that the user experience is improved with an on-page 'loader'. Without going into workarounds, disadvantages will include losing the browser back button / history, issues such as the one your friend mentioned, and also embedded resources and other rich content can suffer as well, and just having an extra layer of complexity to deal with in your app. Don't treat it as magic sauce for your app - make sure every use delivers specific results that benefit your client / audience.
IMHO, it's best to put your client side javascript in a separate page and then import it - neater container. one thing I've faced before is how to call xml back which contains code to run such as more javascript - it's worth checking if this is likely earlier on and avoiding, than having to look at evals.
Mildly interesting.

Workflow engines that integrate easily/work well with Spring Web?

I have a Spring MVC web application that I need to introduce workflow into and was wondering if anyone had recommendations on existing products that would integrate well/easily with Spring.
The steps (if that's the term) in any given workflow may or may not involve user interaction - so you could imagine kicking off something like a sign-in workflow that involves the following steps:
- user choosing a login name and password and submitting
- once submitted an email is generated with a confirmation URL
- on click of the confirmation URL the user is asked a few more questions and then the account is enabled
- if URL is not click on in three days a reminder is sent
- if URL is not clicked on after reminder is sent, account is deleted
Admittedly this is a workflow that could be solved without a workflow engine and I'm just using the example to illustrate that the steps involved in the workflows may or may not involve user interaction, have a time element and a concept of branching on certain event.
I had a look at Spring WebFlow and this seems more geared toward putting webpages together in a certain order to achieve a particular flow through the UI as opposed to specifying a persistent workflow.
I had a look at Spring Workflow Extensions but (a)the documentation seemed a bit thin on the ground and (b) its still in incubation state, both of which make me a bit nervous.
Any suggestions?
I've worked with and evaluated a few workflow engine solutions. In general, they end up being so complicated to setup, it ends up being easier to code your workflow by hand. There is one open source project called OS Workflow that looks like it takes this complexity into account, but I haven't had an opportunity to give it a closer look yet. Also it doesn't look like the product is under active development currently.
I've used jBPM on a project, but I found the product to be confusing and not well documented. We ended up only using a very small set of the functionality and we plan on eventually replacing the functionality we're using with something homegrown.
Both frameworks also have Spring support via the Spring Modules project (which also looks to no longer have any development activity).
A quick google search found me this article on popular Java workflow solutions, but I'm not familiar with most of these products.

How is AJAX implemented, and how does it help web dev?

From http://en.wikipedia.org/wiki/AJAX, I get a fairly good grasp of what AJAX is. However, it looks like in order to learn it, I'd have to delve into multiple technologies at the same time to get any benefit out of it. So two questions:
What are resources that can help me understand/use AJAX?
What sort of website would benefit from AJAX?
If you aren't interested in the nitty gritty, you could use a higher-level library like JQuery or Prototype to create the underlying Javascript for you. The main benefit is a vastly more responsive user interface for web-based applications.
There are many libraries out there that can help you get benefit out of AJAX without learning about implementing callbacks, etc.
Are you using .NET? Look at http://ajax.asp.net. If you're not, then take a look at tools like qcodo for PHP, and learn about prototype.js, jquery, etc.
As far as websites that would benefit: Every web application ever. :) Anything you interact with by exchanging information, not just by clicking a link and reading an article.
Every website can benefit from AJAX, but in my opinion the biggest benefit to AJAX comes in data entry sections - forms basically. I have done entire sites where the front end - the part the user sees had almost no AJAX functionality in it. All the AJAX stuff was in the administration control panel for assisting in (correct!) data entry.
There is nothing worse than submitting a form and getting back an error, using AJAX you can pretty much prevent this for everything but file uploads.
I find it easiest to just stay away from all the frameworks and other helpers and just do basic Javascript. This not only lets you understand what's going on under the covers, it also lets you do it in the simplest way possible. There's really not much to it. User the JS XML DOM objects to create an xml document client side. Sent it to the server with XMLHTTPRequest, and then process the result, again using the JS XML DOM objects. Start with something simple. Just try sending one piece of information to the server, and getting a small piece of information back.
The Mozilla documentation is good. Sites that benefit from it the most are ones that behave almost like a desktop application and need high interactivity. You can usually improve usability on almost any site by using it, however.
Ajax should be thought of as a means to alter some content on a page without reloading the entire page.
So when do you need to do this? Really only when you have some user interactions or form information that you want to keep intact while you change some content on the page.

Resources