These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:04 pm Advanced search

static web pages: templates

Here you can discuss stuff that doesn't fit elsewhere; anything you want really.

Postby lyosha » Tue Mar 24, 2009 10:11 pm

PMB9 wrote:You can only edit an resource if you are able to read the resource itself. If you can only read the "representation of a resource", you can't edit the resource.

Yes you can, anything at all that you GET, POST, or PUT over HTTP is a representation of the resource and not a resource itself.

When you GET a resource with a browser (you can also do web services with different formats) you get an HTML representation of the resource. When you POST, you post a <form> representation of a new resource which is then made into a new resource on the server (eg. a record in the database). When you PUT, same thing as POST, you send an updated representation of a resource to the server which then updates the resource itself. DELETE is the only HTTP method that doesn't really deal with a representation, but rather just tells the server which resource to destroy. That's just how REST works.

If the resource were a record in the database, the only way you could edit the resource directly would be to manually edit the database file, bypassing the database server. Because when you SELECT * FROM table WHERE id={id}, the database server responds with a result in the format of an array or other object, therefore technically a representation of the resource as well. If you want to get really technical and philosophical, the real resource is just an idea and is not tangible at all; the record in the database is a binary representation of the resource which is merely a thought; but not to complicate things to that degree a resource is generally defined as the record in the database, the original file on the server, etc.

So yes, you can edit a resource when all you have is a representation of it. Ruby on Rails and other RESTful frameworks emulate with with <form method="POST"><input type="hidden" name="_method" value="delete" />
Posts: 60
Joined: Fri Aug 22, 2008 9:26 pm

Postby PMB9 » Thu Mar 26, 2009 6:34 pm

So what if I want to use WebDAV instead of REST?
Posts: 50
Joined: Sat Jan 26, 2008 5:38 pm

Postby lyosha » Mon Mar 30, 2009 8:01 pm

Well, I don't know a lot about WebDAV, but it doesn't have much to do with HTML. AFAIK though, WebDAV does follow REST principles to some degree anyway.
Posts: 60
Joined: Fri Aug 22, 2008 9:26 pm

Postby Mx64 » Fri Apr 10, 2009 6:30 am

There is client-side XSLT and XInclude in X(HT)ML. Although I'm not aware of any browser which support XInclude right now.
Posts: 5
Joined: Tue Jan 20, 2009 12:35 pm


Return to Off Topic

Who is online

Users browsing this forum: No registered users and 1 guest