Web 2.0

pogonotomygobbleAI and Robotics

Nov 15, 2013 (3 years and 10 months ago)

71 views


Week 7 HttpExec / HttpGet / xmlHttpRequest


Page
1

of
8

Mel Dundas


Web 2.0


From Wikipedia, the free encyclopedia

Jump to:
navigation
,
search

Web 2.0
, a phrase coined by
O'Reilly Media

in 2004
[1]
, refers to a supposed second
generation

of
Internet
-
based
services

such as
social networking sites
,
wikis
,
communication tools, and
folksonomies

that emphasize online collaboration and
sharing among users. O'Reilly Media, in collaboration with MediaLive International,
used the phras
e as a title for a series of conferences and since 2004 it has become a
popular (though ill
-
defined and often criticized)
buzzword

amongst certain technical and
marketing communities.


Contents

[
hide
]



1 Introduction



2 Characteristics of Web 2.0



3 Technology overview



4 Innovations associated with "Web 2.0"


o

4.1 Web
-
based communities

o

4.2 Web
-
based applications and desktops

o

4.3 Rich Internet applications




4.3.1 Server
-
side software



4.3.2

Client
-
side software

o

4.4 RSS

o

4.5 Web protocols



5 Crit
icism



6 Trademark controversy



7 See also



8 References



9 External links


o

9.1 Supportive

o

9.2 Critical


[
edit
]

Introduction

Alluding to the
version
-
numbers that commonly designate software upgrades, the
phrase
"Web 2.0" hints at an improved form of the
World Wide Web
, and some people have
used the term for several years.


Week 7 HttpExec / HttpGet / xmlHttpRequest


Page
2

of
8

Mel Dundas

In the opening talk of the
first Web 2.0 conference
,
Tim O'Reilly

and
John Battelle

summarized key principles they believed characterized Web 2.
0 applications:



the Web as a platform



data as the driving force



network effects

created by an
architecture of participatio
n



innovation in assembly of systems and sites composed by pulling together
features from distributed, independent developers (a kind of "open source"
development)



lightweight
business models

enab
led by content and service syndication



the end of the software adoption cycle ("the perpetual beta")



software above the level of a single device, leveraging the power of
The Long
Tail
.

Earlier user
s of the phrase "Web 2.0" employed it as a synonym for "
Semantic Web
," and
indeed, the two concepts complement each other. The combination of
social
-
networking

systems such as
FOAF

and
XFN

with the development of tag
-
based
folksonomies
,
delivered through
blogs

and
wikis
, sets up a basis for a semantic environment. Although
the technologies and services that make u
p Web 2.0 lack the effectiveness of an internet
in which the machines can understand and extract meaning (as proponents of the
Semantic Web

envision), Web 2.0 represents a step in its direction.

As
used by its proponents, the phrase "Web 2.0" refers to one or more of the following:



The transition of
Web sites

from isolated
information s
ilos

to sources of content
and functionality, thus becoming
computing platforms

serving
Web applications

to
end users



A social phenomenon embracing an approach to generating and distributing Web
content itself, characterized by open communication, decentralization of
authority, freedom to share and re
-
use, and "the market as a
conversation
"



A more organized and categorized content, with a far more developed
deeplinking

Web architecture than hithertofore



A shift in e
conomic value of the Web, possibly surpassing that of the
dot com
boom

of the late
1990s



A marketing
-
term used to differentiate new Web businesses
from those of the dot
com boom, which due to the bust subsequently seem discredited



The resurgence of excitement around the implications of innovative Web
applications and services that gained a lot of momentum around mid
-
2005

Many
[
citation

needed
]

find it easiest to define Web 2.0 by associating it with companies
or products that embody its principles. Tim O'Reilly gave examples in his description of
his "four plus one" levels in the hie
rarchy of Web 2.0
-
ness:
[2]



Level
-
3 applications, the most "Web 2.0", which could only exist on the Internet,
deriving their
powe
r

from the human connections and network effects Web 2.0
makes possible, and growing in effectiveness the more people use them. O'Reilly

Week 7 HttpExec / HttpGet / xmlHttpRequest


Page
3

of
8

Mel Dundas

gives as examples:
eBay
,
craigslist
,
Wikipedia
,
del.icio.us
,
Skype
,
dodgeball
, and
Adsense
.



Level
-
2 applications, which can operate offline but which gain advantages from
going online. O'Reilly cited
Flickr
, which benefits from its shared photo
-
database
and from its community
-
generated tag database.



Level
-
1 applications, also available offline but which gain features online.
O'Reilly pointed to
Writely

(gaining group
-
editing capability online) and
iTunes

(because of its music
-
store portion).



Level
-
0 applications would work as well offline. O'Reilly gave the examples of
MapQuest
,
Yahoo! Local
, and
Google Maps
. Mapping applications using
contributions fr
om users to advantage can rank as level 2.



non
-
Web applications like
email
,
instant
-
messaging

clients and the
telephone
.

Examples of Web 2.0 other than those cited by O'Reilly include
digg
,
Shoutwire
,
last.fm
,
and
Technorati
.



Time bar of Web 2.0 buzz words.
[3]

This image shows the age of some buzzwords
claimed for

Web 2.0 or its dependencies.

Commentators see many
recently
-
developed concepts and technologies as contributing to
Web 2.0, including
Weblogs
,
linklogs
,
wikis
,
podcasts
,
RSS
feeds

and other forms of
many
-
to
-
many publishing;
social software
, Web
APIs
,
Web standards
, online
Web
services
, and others.


Week 7 HttpExec / HttpGet / xmlHttpRequest


Page
4

of
8

Mel Dundas

Ajax
, shorthand for
Asynchronous

JavaScript

and
XML
, is a
web development

technique
for creating interactive
web applications
. The intent is to make web pages feel more
responsive by exchanging small amounts of data with the server behind the scenes, so
that the entire web page does not have to be reloaded each time the user makes a change.
This is meant t
o increase the web page's interactivity, speed, and
usability
.

The Ajax technique uses a combination of:



XHTML

(or
HTML
) and
CSS
, for marking up and styling information.



The
DOM

accessed with a
client
-
side

scripting language
, especially
ECMAScript

implementations

such as
JavaScript

and
JScript
, to dynamically display and
interact with the information presented.



The
XMLHttpRequest

object is used to exchange data asynchronously with the
web server. In some
Ajax frameworks

and in certain situations, an
IFrame

object
is used instead of the XMLHttpRequest object to exchange data with the web
server, and in other implementations, dynamically added <
script
>
tags may be
used.



XML is sometimes used as the
format

for transferring data between the server and
client, although any format will work, including preformatted HTML, plain text,
JSON

and even
EBML
. These files may be created dynamically by some form of
server
-
side scripting
.

Like
DHTML
,
LAMP

and
SPA
, Ajax

is not a technology in itself, but a term that refers
to the use of a group of technologies together.


Week 7 HttpExec / HttpGet / xmlHttpRequest


Page
5

of
8

Mel Dundas

<html>


<head><title>Ajax test
-

index1</title>


<script type="text/javascript">


var xhr;


function getXMLHttpRequest(){


try { return new ActiveXObject
("Msxm12.XMLHTTP"); } catch(e){};


try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){};


try { return new XMLHttpRequest(); } catch(e){};



return null;

}


function parseHttpResponse(){




if(xhr.readyState == 4){






if(xhr.status == 200){








document.getElementById("T0").innerHTML=xhr.responseText;


}


else


{





}


}

}


function getTemp(){


xhr = getXMLHttpRequest();


xhr.open("GET", "Temp0.cgi", true);

xhr.onreadystatechange = parseHttpResponse;

xhr.send(null);

}



setInterval("getTe
mp()", 1000);



</script>

</head>


<body>


<h2>Headline</h2>


<p>Paragraph</p>


<div id='T0'>Loading Temp0...</div>

</body>

</html>

<body>


<h2>Headline</h2>


Week 7 HttpExec / HttpGet / xmlHttpRequest


Page
6

of
8

Mel Dundas


<p>Paragraph</p>


<div id='T0'>Loading Temp0...</div>

</body>

</html>


Not much here. The div t
ag has an id of ‘T0’ and the web page displays





In one second, javascript code executes a function.


setInterval("getTemp()", 1000);




function getTemp(){


xhr = getXMLHttpRequest();


xhr.open("GET", "Temp0.cgi", true);

xhr.onreadystatechange = parseH
ttpResponse;

xhr.send(null);

}


The function getTemp() calls getXMLHttpRequest().



function getXMLHttpRequest(){


try { return new ActiveXObject("Msxm12.XMLHTTP"); } catch(e){};


try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){};


try { r
eturn new XMLHttpRequest(); } catch(e){};



return null;

}



The function getXMLHttpRequest creates an instance of either the
ActiveX or XMLHttpRequest class or returns a null.


Week 7 HttpExec / HttpGet / xmlHttpRequest


Page
7

of
8

Mel Dundas



XMLHttpRequest Details

Regardless of how the
XMLHttpRequest
type is instanti
ated, and regardless of which browser

and platform are used, a set of methods and properties is associated with
XMLHttpRequest
.





function getTemp(){


xhr = getXMLHttpRequest();


xhr.open("GET", "Temp0.cgi", true);

xhr.onreadystatechange = parseHttpResp
onse;

xhr.send(null);

}



xhr.open("GET", "Temp0.cgi", true);


The open method is used to setup the xhr object for a GET request to the server.
The “Temp0.cgi” webpage is aked for and true means it is asynchronous.


xhr.onreadystatechange = parseHttpRespon
se;


sets up an event handler parseHttpResponse to be invoked when an HTTP
response is received.


xhr.send(null);


sends the GET request to the HTTP server.


Week 7 HttpExec / HttpGet / xmlHttpRequest


Page
8

of
8

Mel Dundas

function parseHttpResponse(){




if(xhr.readyState == 4){






if(xhr.status == 200){








docu
ment.getElementById("T0").innerHTML=xhr.responseText;


}


else


{





}



}

}


XMLHttpRequest Properties


onreadystatechange



Event handler that fires at each state change



You implement your own function that handles this


readyState


current status
of request



0 = uninitialized



1 = loading



2 = loaded



3 = interactive (some data has been returned)

• This is broken in IE right now



4 = complete


status



HTTP Status returned from server: 200 = OK , 404 = file missing


responseText



String ver
sion of data returned from server


responseXML



XML DOM document of data returned


statusText



Status text returned from server