Problem Statement: How to build very nice rich website?
Option 1: Single tier architecture
Advantages: Saves Time, Easy to implement
Disadvantages: Difficult to break up later to support other user interfaces.
Option 2: Two tier architecture
Advantages: Both are in its own spheres. Easy to modify and re-write later if required.
Disadvantages: Takes more time to setup the environment and looks like more code.
Technologies:
UI: GWT
Services: Spring, RESTful Services, Hibernate
Notes:
RESTful – http://www.xfront.com/REST-Web-Services.html
Restlet with Spring – http://jgoday.wordpress.com/2009/04/10/restlet-with-spring/
RESTful from Wiki: http://en.wikipedia.org/wiki/Representational_State_Transfer
Archtypes:
Archetype – HibernateSpringGwt https://opensource.fastconnect.org/redmine/projects/show/spring-gwt-archetype
maven-gwtext-archetype http://code.google.com/p/maven-gwtext-archetype/
-o-
Problem: How to read HTTP Headers in Restlet? Also we need to get Date from HTTP Headers.
Series<Parameter> headers = (Series<Parameter>) getRequest().getAttributes().get("org.restlet.http.headers");
Set<String> headerNames = headers.getNames();
for(String headerName:headerNames)
{
System.out.println( "name==>"+headerName+" value==>"+ headers.getFirstValue(headerName));
}
Output:
name==>accept-encoding value==>gzip,deflate
name==>connection value==>keep-alive
name==>accept-language value==>en-us,en;q=0.5
name==>host value==>localhost:8080
name==>accept-charset value==>ISO-8859-1,utf-8;q=0.7,*;q=0.7
name==>user-agent value==>Mozilla/5.0 (Windows; U; Windows NT 4.x; en-US; rv:1.x.x.x) Gecko/23423423 Firefox/2.4.6
name==>accept value==>text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
name==>keep-alive value==>300
Observation: Date is missing when tried from Browser.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
When tried from Restlet Client, it is working.
Form attributes = new Form();
attributes.add( "message.date", "Mar-03-2010 10:30 AM" );
request.getAttributes().put( "org.restlet.http.headers", attributes );
Final Solution:
It is difficult to depend on HTTP Headers when clients are from Flex and other applications.
Easiest way is add Query String parameter like &date=123123123123123
Reference:
http://www.restlet.org/documentation/1.0/faq
http://wiki.restlet.org/docs_2.0/13-restlet/27-restlet/130-restlet.html
http://en.wikipedia.org/wiki/List_of_HTTP_headers
Working on Restlet API for now….
http://www.restlet.org/
Test Restlet with http://code.google.com/p/rest-client/
Now Spring 3.0 is having support for Restlets, but I didn’t get a chance to look into it.
-o-