About
fv_2007
Agile innovative developer with deep insight into lots of platforms, technologies and protocols. Absolute “early adopter” in Web 2.0 technologies and more. Large professional network and eagerly talking about architecture, strategy, design patterns, restful ressources, object-oriented thinking and modeling languages such as PML. Special interest in programminglanguages constructs, knowledge on languages like Smalltalk, Erlang, Java, Clojure, Scala, Ruby... read more
Follow
Feedfavicon
Language

My new website! January 10, 2008 13:57 over 2 years ago

Something is not working, yaaaa i know. I finally pulled myself together to a total rewrite on my website. I do not have time enough to do it for real, but anyway. Don’t ever do total rewrites in software development! Yaa I know. But, i have to rewrite everything to be completely restful. All services is now running full REST mode. Representational State Transfer.

Old services

This mens that a few services not are working anymore like fx Atom protocol, RSS feed are all gone. I am sorry. Temporary I have a method caching all calls the old services like this. It returns an 301 and a new location. Don’t know if this works whit google? We will see.


def redirection
render :text => “Moved Permanently!”, :status => 301, :location => ‘/posts’
end

I got a problem. Google is still pumping the googlebot spinder robot on my pages. So I will try something else and see if I can keep google out.

def redirection
render :text => “Gone”, :status => 410
end

Representations

All services can return more than one representation. Services deliver Javascript, JSON, XML and pure HTML.

Feeds

The new feed address are: http://www.frankvilhelmsen.com/posts.atom or http://www.frankvilhelmsen.com/posts with the content-type set to atom

REST API

  • “curl i -X GET -H ‘Accept: text/html’ /posts/1 ":/posts/1-My-new-website
  • “curl i -X GET -H ‘Accept: application/js’ /posts/1 ":/posts/1-My-new-website.js
  • “curl i -X GET -H ‘Accept: application/xml’ /posts/1 ":/posts/1-My-new-website.xml
  • “curl i -X GET -H ‘Accept: application/json’ /posts/1 ":/posts/1-My-new-website.json
  • “curl i -X GET -H ‘Accept: application/atom+xml’ /posts/1 ":/posts/1-My-new-website.atom

REST Nouns

This page has nouns like fx /posts /comments or /titles.

REST Verbs

All nouns can bee accessed with GET verb. Note that there are restrictions on all PUT, POST and DELETE verbs.

This output are the rake routes command in rails 2.0.2.


GET /posts {:controller=>"posts", :action=>"index"}
formatted_posts GET /posts.:format {:controller=>"posts", :action=>"index"}
POST /posts {:controller=>"posts", :action=>"create"}
POST /posts.:format {:controller=>"posts", :action=>"create"}
formatted_new_post GET /posts/new.:format {:controller=>"posts", :action=>"new"}
edit_post GET /posts/:id/edit {:controller=>"posts", :action=>"edit"}
formatted_edit_post GET /posts/:id/edit.:format {:controller=>"posts", :action=>"edit"}
post GET /posts/:id {:controller=>"posts", :action=>"show"}
formatted_post GET /posts/:id.:format {:controller=>"posts", :action=>"show"}
PUT /posts/:id {:controller=>"posts", :action=>"update"}
PUT /posts/:id.:format {:controller=>"posts", :action=>"update"}
DELETE /posts/:id {:controller=>"posts", :action=>"destroy"}
DELETE /posts/:id.:format {:controller=>"posts", :action=>"destroy"}

When you call the old RSS or Atom protocol something like this happens. Replay with 301 Moved Permanently and u get one new header Location to hit.


frank@howdy:~\> curl I -X GET localhost:3000/feed
HTTP/1.1 301 Moved Permanently
Connection: close
Date: Sun, 13 Jan 2008 17:39:42 GMT
Set-Cookie: _blog_session=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo%250ASGFzaHsABjoKQHVzZWR7AA%253D%253D
-830361ac99d21fe1231dde1ab3fc6f515599537d; path=/
Status: 301 Moved Permanently
Location: /posts.atom
X-Runtime: 0.00239
Cache-Control: no-cache
Server: Mongrel 1.0.1
Content-Type: text/html; charset=utf-8
Content-Length: 18

The content are maybe changing a bit, but what the hell, you will live. I hope that you will be some what provoked by the content and you are most welcome to comment. For the most part I write about stuff that I find stupid or just something around my job as software developer. I feel myself inspired from cssgarden website and want to fix it together with static and dynamic content and test out some ajax components.

A few funny links


By Frank Vilhelmsen - 4 tags: ajax rest web2 xml - 1 comment on My new website! - Add comment

Frank Vilhelmsen August 04, 2007 13:57 over 3 years ago

Dette er blot en test