Loading ...
Sorry, an error occurred while loading the content.
 

Move representation + support redirect

Expand Messages
  • Alan Dean
    Hi, I ve got another nitty-gritty issue to get feedback from the group on. I have been thinking about RESTful move operations. Obviously, a RESTful system
    Message 1 of 35 , Mar 8, 2007
      Hi,

      I've got another nitty-gritty issue to get feedback from the group on.

      I have been thinking about RESTful move operations. Obviously, a
      RESTful system should not require a MOVE verb, and the
      operation can be carried out as follows (assume that the
      representation already exists):

      -->
      GET /foo.txt

      <--
      HTTP/1.1 200 OK
      ETag: "hash"
      Content-Type: text/plain
      Content-Length: 16

      this is the body

      -->
      PUT /bar.txt
      If-None-Match: *
      Content-Type: text/plain
      Content-Length: 16

      this is the body

      <--
      HTTP/1.1 201 Created

      -->
      DELETE /foo.txt
      If-Match: "hash"

      <--
      HTTP/1.1 204 No Content


      That's fine. The question I am wrestling with at the moment is "how
      does the client tell the server to redirect requests from /foo.txt
      to /bar.txt (either temporarily or permanently)?"

      I had a look into the Atom Publishing Protocol to see if this is a
      matter that they have thought about, but I can't find any reference.

      I had feedback that you might use the Location header - but I don't
      much like the feel of that as it is a response header.

      Where my thinking is right now is that the server could support a PUT
      of Content-Type message/http, in the following manner:

      -->
      PUT /foo.txt
      Content-Type: message/http
      Content-Length: 49

      HTTP/1.1 301 Moved Permanently
      Location: /bar.txt

      <--
      HTTP/1.1 201 Created

      -->
      GET /foo.txt

      <--
      HTTP/1.1 301 Moved Permanently
      Location: /bar.txt


      What do you think?

      Regards,
      Alan Dean
      http://thoughtpad.net/who/alan-dean/
    • Alan Dean
      On 3/17/07, Benjamin Carlyle wrote: [snip] ... Can t say that I like the idea of making an internal structure public, such as
      Message 35 of 35 , Mar 17, 2007
        On 3/17/07, Benjamin Carlyle <benjamincarlyle@...> wrote:
        [snip]
        >
        > Then:
        >
        > -->
        > PUT /.htaccess HTTP/1.1
        > (headers)
        >
        > redirectMatch permanent ^/foo.txt$ /bar.txt
        >
        > <--
        > HTTP/1.1 201 Created
        >
        > This is the right-way-to-do-it(tm) in REST style. Don't introduce new
        > methods to deal with "properties". Instead, interact with a resource (in
        > this case the .htaccess file) that defines those properties. Use a
        > content-type that is understood by this resource to define the
        > properties. Technically you should probably be registering the format of
        > that htaccess file with the iana and making its content an rfc, but that
        > is the only place this approach really falls short.

        Can't say that I like the idea of making an internal structure public,
        such as an htaccess file (which is specific to Apache anyway afaik,
        and I'm not using Apache). I have the feeling that there are numerous
        security issues with that. Plus, as you say, there is no registered
        mime type.

        This is why I was investigating the possibility of using the
        message/http mime type.

        > As for MOVE... well that has been covered. Don't use it. You have no
        > right to assume that the server you send the MOVE to will be able to
        > operate on the two identified resources simultaneously. It could be a
        > mashup of several different services. MOVE introduces unnecessary
        > coupling, let alone its other failures already noted in this and other
        > threads. Its benefits do not outweigh its problems.

        I wasn't intending to use MOVE, simply trying to identify how to
        restfully carry out an operation that "looks like a move", followed by
        establishing a temporary or permanent redirect as a user-agent
        decision.

        Regards, Alan
      Your message has been successfully submitted and would be delivered to recipients shortly.