Categories
Uncategorized

Why we need REST

There’s a neat new toy from google—the Google Web Accelerator (GWA). It uses Googles cache to serve up web pages quickly, but it also apparently does link prefetching. This is good for the most part, as it speeds things up a lot.

The difference between GWA and Mozilla is that GWA pre-fetches every single link on the page if it doesn’t find a <link rel="next"> on that page.

This combines with the fact that some people have links to “delete” and “cancel” on their web sites.

Now, the HTTP spec says that if you GET a page, then that must cause no change on the server side (safe). By creating a link that deletes something, you are breaking the rules.

Of course, if browsers supported HTTP a bit better, then they’d use a DELETE verb for such an action. But even without that, you can still use a form and POST for non safe actions. It’s definitely worth bearing in mind next time you’re writing a web app.

Update: Tom Mortoel has described the problem better than I have. And also offered actual code for a solution, which helps. Also note the informative comments.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s