Agile Ajax

Mashup Styles

OK, the Pet Store Application must die. ;-) Actually, its kind of comforting the way Sun keeps working the old war horse into it's publications, and the new article series, Mashup Styles, does not dissappoint. All kidding aside, this series, while not strictly Ajax related, is a good read so far. After all, we don't just write Ajax apps, we write apps that use Ajax as a part of doing something (Plus, it fits in nicely with my JSONP Ideas series). This series helps you do that by explaining not just how to write code, but the why and how of how mashups are designed and architected.

The first installment deals with server-side mashups:


In general, a server-side mashup works as illustrated in Figure 2.

Figure 2. How a Server-Side Mashup Works
Figure 2: How a Server-Side Mashup Works

Perhaps the biggest challenge in doing a mashup is contending with the basic security protection that the browser security sandbox provides. The browser security sandbox is responsible for keeping personal information secure. Many mashups use Ajax functionality. An XMLHttpRequest is a JavaScript object that is used to exchange data asynchronously between a client and server in an Ajax transaction. To protect against possible maliciousness, most browsers allow JavaScript code that contains an XMLHttpRequest to communicate only with the site domain, that is, the computer system that hosts the web site, from which the page was loaded. The site from which the page is loaded is usually called the server of origin. For example, if the page containing the XMLHttpRequest is loaded from mySite.com, the XMLHttpRequest can only connect to mySite.com. It won't allow the XMLHttpRequest to connect to another site. If the mashup requires a service in a site that is not the server of origin, such as yourSite.com, there's no way to access it through an XMLHttpRequest. Although the server-of-origin policy adds security, that security makes the creation of mashups more difficult.

The article illustrates how to add geocoding of pet locations to the Pet Store app using the Yahoo! geocoding service. If you've used web services in your J2EE apps before you won't find much new here, but if you are just getting started, there's lots of code and explanation here.


Technorati : ,

Leave a comment

Powered by WP Hashcash

About Pathfinder

  • We design and build extraordinary applications for companies looking to make the next great idea a reality.
  • learn more

Topics

WordPress

Comments about this site: info@pathf.com