Hello Conor,
>following the post, go back to the user list - where does that
responsibility lie?
Let's say the POST equest is handled by a "users" resource.
Basically, this resource returns the new representation of the users
list after handling the post request.
Another case is when the POST request is handled by another resource, so
this resource must redirect the client: use one of the
ServerResource#redirect* which suits you.
>But they have, what seems like a hack, for getting an edit form:
By order of personal preference.
One way is to use javascript. One button on your HTML page allows the
user to enter into the "edit" mode: it consists in refreshing the
display of the HTML page. No additional request is required, the web
page is a sophisticated view of the resource's state.
Another way is to add a query parameter indicating the display mode. One
button on the "read-only by default" page allows the user to send
another request with the right query parameter.
Another way is to introduce a distinction between data resources and
graphical resources with distinct URIs...
Another way is to always display the resource in edit "mode" with or
without the form buttons.
Best regards,
Thierry Boileau
> Hi,
> this may not be the best place to post this question, but pointers elsewhere
> may be satisfactory answers.
>
> I'm struggling with the following:
> Here's the context -
> - I'm running a web app in a browser.
> - I was on a list of users, and I clicked an add button
> - I get shown a form to enter some fields.
> - I click submit
>
> So I'm about to create a new user for example:
> ------
> POST /users ....
> ------
>
> After creating the user, in a typical web app I might expect to go back to
> the "list of users" screen. And in an MVC (Model2), the controller would
> usually handle that.
>
> The question is simple: how to handle that in a restlet app - following the
> post, go back to the user list - where does that responsibility lie?
> In general, what are the recommendations of the resty guys for doing screen
> flow - does that all move to the client side?
>
> Most of my "rest" experience comes from dealing with ruby on rails, which I
> guess is not quite purist rest. So they have a controller.
>
> My other question relates to a rails thing also.
>
> Edit screen vs. View/Show screen
> So I want to show details of a user I use:
> GET /users/{id}
>
> But they have, what seems like a hack, for getting an edit form:
> GET /users/{id}/edit
> (I'm not sure what corresponding Merb urls are)
>
> To me we are talking about one resource here, with different representaions.
> But not at the level of MediaType.
> The media type for my web-app might be text/html for both the view and edit
> page.
>
> So again how best to handle this from the point of view of a rest purist?
>
> Any info greatfully appreciated. Perhaps I'm not looking at things in the
> right way yet.
>
> cheers
> Conor
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2430295
>
>
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2430339