Semantic Response - Ajax Patterns

Semantic Response

From Ajax Patterns

(Difference between revisions)
Revision as of 10:08, 19 July 2012
Mikeharry089 (Talk | contribs)
Solution
← Previous diff
Revision as of 21:27, 16 August 2012
111.119.177.78 (Talk | contribs)

Next diff →
Line 78: Line 78:
[http://www.thietkewebsitehanoi.net/thiet-ke-web/18/thiet-ke-web-gia-re.html/ Thiet ke web gia re] [http://www.thietkewebsitehanoi.net/thiet-ke-web/18/thiet-ke-web-gia-re.html/ Thiet ke web gia re]
[http://tkwebgiare.com/ Thiet ke website dep] [http://tkwebgiare.com/ Thiet ke website dep]
 +[http://creditloanadvice.com/best-top-10-english-songs-2012-ten-latest-list-2011/ Top 10 songs]
[http://www.thietkewebsitehanoi.net/thiet-ke-web.html/ Thiet ke web] [http://www.thietkewebsitehanoi.net/thiet-ke-web.html/ Thiet ke web]
[http://www.thietkewebsitehanoi.net/dich-vu-thiet-ke-web.html/ Dich vu thiet ke web] [http://www.thietkewebsitehanoi.net/dich-vu-thiet-ke-web.html/ Dich vu thiet ke web]

Revision as of 21:27, 16 August 2012

Note: This pattern is deprecated - see the patterns representing different types of Semantic Response: Plain-Text Message, XML Message, JSON Message.

Evidence: 2/3

Tags: Data Fact Information Raw Semantic


Contents

In A Blink

Diagam Server talks (balloon) HTML.

  • Browser: "Tell me about the account balance."
  • Server: "Cr3000000|Db1000000|Bal2000000."


Goal Story

Devi's producing a web statistics report so that managers can see how much each web page is being viewed. Fortunately, all the page access data is already exposed as XML by an existing RESTful service, being used by link building service the billing department. Devi's browser script only has to grab an XML document from that service, and transform it to HTML.


Problem

What format should be used for server responses?


Forces

  • Ajaxian applications usually require interaction between browser and server, which necessitates a form of message-passing.
  • The browser contains display-related information, while the server usually contains business and application logic.
  • It's undesirable to couple server-side services to browser display.


Solution

Have the server respond with abstract, semantic, data. Server-side services output data structures in the form of XML, JSON, or some custom, text-based, format. Because the data is not web-specific, it is often in a generic form which can be used by external applications as well as the browser script. Hair Transplant in Pakistan

For example, imagine you're designing a weather website. You accepts queries like http://www.example.com/temperature/max/melbourne and respond with the current weather, using a semantic message like this:

  <weather>
    <location>Melbourne</location>
    <date><year>2005</year>1<month></month<day>1</day></date>
    <time>14:00</time>
    <temperature format="celcius">32</temperature>
  </weather>

Your own website's Javascript can access the data cassette player with an XMLHttpRequest Call and render it however it pleases. For example, it might run a switch statement to pick out a weather icon according to the current temperature. Meanwhile, external clients can also use the content easily. For example, an insurance company might pull in the weather data to help understand its risk exposure. Semantic data is easy for third-parties to access because its designed as an open API, free of application-specific detail.

The browser application can use semantic content in different ways:

  • Transform some or all of it into HTML to present it to the user.
  • Interrogate the content to decide what to do next.
  • Store some or all of it for later use, e.g. as a Javascript variable.
  • Modify it based on client state and upload it again.

Semantic Responses provide a clean separation by preventing the server from knowing HTML and encapsulating the entire UI in the browser. Message content and format must be suitable for manipulation on both sides. The precise message format will vary, but the key characteristic is raw, semantic, data; as opposed to code or display detail.

Note that the emphasis here is on the response from server to browser. Semantic content can also be passed from browser to server. Indeed that's what usually happens anyway. When the browser sends a GET query, the query usually consists of abstract concepts, e.g. in the query, http://www.example.com/games?manufacturer=namco (Not working), the manufacturer name and value are semantic content.

Pool Pumps pacquiao vs marquez loan modification pop up display Diploma Programme essay writing buy research paper phone number lookup seo services forex Hair Transplant in Pakistan Vorsorgen seo vietnam Thiet ke web gia re Thiet ke web ban hang Thiet ke web gia re Thiet ke website dep Top 10 songs Thiet ke web Dich vu thiet ke web Thiet ke web chuyen nghiep Thiet ke web gia re Thiet ke website chuyen nha chuyen nha gia re chuyen van phong Mua thanh lý đồ cũ Chuyên mua đồ thanh lý các loại

welding-schools Welding Training Culinary Training Culinary Schools viec lam sinh vien bcs championship tickets daytona 500 tickets berto vs ortiz tickets condit vs diaz evans vs davis tickets lesnar vs overeem live streaming dịch vụ seo seo gía rẻ rao vat seo uy tin dịch vụ seo là gì dịch vụ seo miễn phí

Atlanta General Contractor Atlanta Bathroom Remodeling Tennessee Spinal Surgeon Neurosurgeon in Kentucky Garden Weddings Garden Wedding Locations Garden Wedding Venues Wedding Tux Wedding Tuxedos Tuxedo Rentals Wedding Tuxedos Dunlop Q2 Tires Dunlop 401 Tires Dunlop 404 Tires Metzeler 880 Tires

Decisions

Which message format to use?

Semantic Responses can be represented in several different forms. Each of the following is captured as a separate pattern.

macklin vs martinez tickets pacquiao vs bradley tickets bradley vs pacquiao tickets mayweather vs cotto mayweather vs cotto tickets mayweather vs cotto tickets bcs national championship tickets cotto vs mayweather tickets bradley vs pacquiao tickets pacquiao vs bradley ticket pacquiao vs bradley live streaming mayweather vs cotto live streaming pacquiao vs bradley pacquiao vs bradley tickets

Each of the above patterns discusses its own strengths and weaknesses. There are several factors involved:

  • Browser-Side Environment: Which browser versions are being targeted will affect feasibility of message formats. In particular, XML support is limited in older browsers.
  • Server-Side Environment: What sort of support is there for the message formats in the server-side coding environment. If using JSON, for example, is there a suitable binding for the server-side language?
  • Developer Skills: What sort of skill base is available to deal with the message format? You might be tempted to use XML because you feel browser-based XSLT is the most elegant solution, but that requires XSLT talent.
  • External Agents: The browser and the server may not be the only things that access the message. If the server is offering a generic REST service, the message format will need to be suitable for external applications too.


Real-World Examples

Google Maps

essay help analysis essay Water In Basement rochester ny

ib program downloads geographic information in a semantic, XML, format. See XML Message for more details.

Foreclosure defense attorney Florida to help you defend your land banner design services business logo design head lice treatment french doors french door exterior french doors exterior french door interior french doors interior french door cosmetic dentist washington dentists everett wa cosmetic dentistry washington everett dental washington cosmetic dentistry personalized photo necklaces picture jewelry mom jewelry photo jewelry personalized rings personalized jewelry personalized bracelets customized bracelets photo pendant necklace trophy hunting deer hunting fallow deer hunting sika deer hunting Texas fallow deer huntingsaigontech forum ban lai coupon mua chung thuc tap sinh thuc tap ke toan thuc tap viec lam sinh vien viec lam thuc tap seo forum dien dan seo link building services bao tri seo seo services forex seo vietnam link building services dich vu seo bao tri seo free backlinks thiet ke website online marketing bang gia seo timeshare cong ty seo tin hot cong cu seo download film marketing online seo services download film hd cach tao blog rao vat thuc tap su pham thuc tap ke toan thuc tap sinh thuc tap su pham viec lam thuc tap cho sinh vien viec lam them viec lam online viec lam ban thoi gian viec lam them thuc tap ke toan dich vu seo seo gia re rao vat seo uy tin dich vu seo la gi dich vu seo mien phi mouflon sheep hunting trophy whitetail deer huntingmay quay sony may quay phim sony dien thoai nokia mac pro tu bep noi that samsung 3d led tivi sony lcd tivi samsung plasma tivi 3d tivi 3d plasma tivi 3d tivi tivi 3d plasma macbook macbook apple macbook pro imac mac mini mac mini thiet bi van phong dau dia tien dat dau dia dau dvd sony dau dia dvd loa loa ampli loa vi tinh amply sony son nuoc tranh thu phap cha me tranh son dau gom su phan bon trien lam hoi cho san pham 3d gian hang 3d gian hang 3d van phong 3d 3d offices web 3d hoi cho trien lam cong nghe 3d fair 3d products 3d products 3d showroom 3d fair exhibition trien lam 3d business exhibitions business fair Texas hunting packages

Magnetic Poetry

Magnetic Poetry uploads user drag activity to the server in a custom, plain-text, format. See Plain-Text Message for more details.

Route Planning

Jim Ley's Route Planning For Round the World Flights downloads flight route information using JSON format. See JSON Message for more details.


Code Examples

Please refer to the Code Examples and Refactoring Illustrations for specific message types, Plain-Text Message, XML Message, JSON Message.


Alternatives

HTML Response

HTML Response involves sending display information as opposed to semantic data. Usually, the browser transforms Semantic Responses into HTML, whereas it's the server that handles HTML generation in the case of HTML Response.


Related Patterns

RESTFul Service

RESTful Services generally deliver Semantic Responses.

Ajax Stub

Ajax Stub relies on a generic framework to make calls between the browser and the server. The message from browser to server is a remote call including a function name and arguments, and the message from server to browser is a result. These are a form of Semantic Response, but developers using such frameworks don't need to be aware of the precise format.


Visual Metaphor

Sending a semantic message is like sending a textual description of an object - the facts are there and they can be rendered as the receiver sees fit, or used in other ways such as being synthesised with related descriptions. http://www.rentalprotectionagency.com/background-check.php