Sunday, July 02, 2006

 

EJAX: GET on a resource

EJAX recognises two kinds of resources: static ones, for example an HTML page but also anything made available outside the EJAX frame. A static resource looks like this:
<resource name="quote">
<url>/quote/car.html</url>
<get>
<representation content-type="text/html">
<static-page>
<filename>car.html</filename>
</static-page>
</representation>
</get>
</resource>
Note the representation option. Clients can request a resource in various formats, for example HTML for people and XML for machines.

The opposite of a static resource is a dynamic resource. Such representations are created dynamically. Example:
<resource name="quote">
<url>/quote/car.html</url>
<get>
<representation content-type="text/html">
<dynamic-page>
<html-template>car.html</html-template>
<response-collection>
<response-name>car-detail</response-name>
<response-name>options</response-name>
</response-collection>
</dynamic-page>
</representation>
</get>
</resource>
Not a lot is going on here, and that is on purpose. The real work happens in the creation of the individual response. In EJAX a page resource is just replacing elements in an HTML file with parts received elsewhere.

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?