AJAX vs JAVA: A Comparison of Web Development Languages

  • Java
  • Thread starter Ulysees
  • Start date
  • Tags
    Java
In summary, AJAX suffers from the fact that 90% of development time is spent trying to work around intricacies of specific platforms, but JAVA can still be used to build a system like PF with AJAX techniques.
  • #36
Ulysees said:
I got stuck in another issue with java once. My applet was not allowed to access web pages (plain html) on servers other than the one I downloaded the applet from, "for security reasons" this was not allowed.

You know any workaround?

That's a security measure to prevent cross-site scripting - the alternative is to sign your JARs. A signed java applet will have full permissions.
 
Technology news on Phys.org
  • #37
What about this one, -Job-:

> Is it possible to not ask the server at all, just get data straight from the cache? Because the main problem of the internet is delay, not download rate. It's a replacement for Outlook I'm trying to come up with, that interrogates the server every 5 minutes or whatever for any new messages (ie updates the cache every 5 minutes), and shows message threads immediately when requested.
 
  • #38
Ulysees said:
What about this one, -Job-:

> Is it possible to not ask the server at all, just get data straight from the cache? Because the main problem of the internet is delay, not download rate. It's a replacement for Outlook I'm trying to come up with, that interrogates the server every 5 minutes or whatever for any new messages (ie updates the cache every 5 minutes), and shows message threads immediately when requested.

You can load everything at once (e.g. load all message pages at once) and show only the active content but this is definitely not a good approach for many reasons.

The best strategy is to use AJAX (or frames) to preload content and hold it in the background until it needs to be used. For example in a mail client you can have the main page load with the first page of messages and subsequently perform AJAX requests to retrieve the next message pages so that when the user clicks to view messages 50 - 100 it can display them immediately with no load time (just some setup time). You just have to ensure that you manage the cache size and don't let it get out of control.
 
Last edited:
  • #39
But then I'd have to preload the entire forum in every session.

Can't I keep messages from previous sessions on the hard disk, just like Outlook does?

Because these days hard disk space is not an issue. Neither is bandwidth so much of an issue, unless every user downloads a ton of messages over and over in every session. The only remaining issue is delay.
 
Last edited:
  • #40
In fact I am sure there is a lot of future in this asynchronous approach, not just Asynchronous Javascript with Xml (ajax) but anything that achieves this objective, of interactivity in web pages.
 
Last edited:
  • #41
The browser can cache Ajax requests - if you ensure that the Ajax request is the same as previous ones then standard browser caching applies.
 
  • #42
-Job- said:
if you ensure that the Ajax request is the same as previous ones then standard browser caching applies.

You said this earlier:

> You can set content expiration headers on the server side to inform the browser to use cached content.

This means:

1. ask the server
2. server says "not expired yet"
3. show the cached content

We don't want this. We don't want to ask the server at all, the delay is too much. Instead, we want to show what's in the cache.

There's got to be a way to show what's in the cache from previous sessions.

Can the browser be forced to offline mode by a java applet?
 
Last edited:
  • #43
Ulysees said:
You said this earlier:

> You can set content expiration headers on the server side to inform the browser to use cached content.

This means:

1. ask the server
2. server says "not expired yet"
3. show the cached content

We don't want this. We don't want to ask the server at all, the delay is too much. Instead, we want to show what's in the cache.

There's got to be a way to show what's in the cache from previous sessions.

Can the browser be forced to offline mode by a java applet?

Really, too much delay? You have some pretty high standards. The browser makes HEAD requests which are very lightweight (contain no data) to check if new content is available - these are very fast - in addition you can also have the server set actual content expiration dates though I'm not 100% clear how the browsers handle these (they might ignore them to some degree).

IMHO I think you're getting too particular with the cache - you might be better off taking your app off the browser. You can use a single Java applet which makes socket requests to your site to retrieve content and stores it on the user's file system - so it's able to implement its own caching rules. However the main page containing the applet and the applet itself are cached (or not) according to the browser (still HEAD requests) - not to mention that the JAVA applet itself will be slower to load than any other approach. If delay is the problem then JAVA is not the solution.
 
Last edited:
  • #44
Actually I'm now reminded that Google is working on a new browser plugin called Google Gears, check it out - it's geared towards allowing applications to function offline so might be used to minimize content-related delays (it's still very much under development though). It implements a database accessible from Javascript, so you can store your content there.
 
Last edited:
  • #45
Thanks a million -Job-.

Certainly easier to convince people to install a plugin by google, than to run a windows executable of mine.

How they'd feel about giving lots of permissions to a JAVA applet is another story. Some hacker must have worked around this obstacle. But I wonder if there's a legitimate way to do it. Under the user's full supervision. Maybe the user could maintain a file and manually give it to the applet at the beginning of every session, and manually save it at the end of the session, if nothing better can be done.

Do you participate in any web-development-specific forums? Can you recommend a JAVA forum? Any AJAX one?
 
  • #46
Ulysees said:
Do you participate in any web-development-specific forums? Can you recommend a JAVA forum? Any AJAX one?

Not really - i don't have much time nowadays.
 
Back
Top