[Catalyst] Re: Reseting a chained action
Pedro Melo
melo at simplicidade.org
Wed Aug 8 22:56:17 GMT 2007
Hi,
On Aug 8, 2007, at 1:38 PM, A. Pagaltzis wrote:
> * Pedro Melo <melo at simplicidade.org> [2007-08-07 11:20]:
>> In the course of a project I'm working on, I found it useful to
>> "reset" chained actions. It would work like this:
>>
>> . assume that you have a chain like /company/ID/copywrongs
>> . and in certain situations you want a alternative
>> environment for the chain, like this:
>> /approve/company/ID/copywrongs
>>
>> The /approve would modify the stash to include some alternative
>> schema or environment that the rest of the chain could use to
>> tweak their behavior. The thing is, the /approve action would
>> like to tell catalyst "ei, please disregard me and start
>> over".
>
> That doesn’t look very HTTPish. The URI should be purely the
> address of a resource, whereas you seem to be putting an
> operation in there. See also REST.
they are diferent resources, so diferent URLs. It makes total sense
REST-wyse.
Imagine that you have some DB, that only a few people can commit, but
several can suggest changes.
Showing a entry in that table or showing the proposed change is a
matter of merging the delta with the actual data.
the real data sits at /dbdata/ID, a delta to be approved can sit at /
delta/DELTA_ID/dbdata/ID
What I wanted was to reuse the last part of the chain. I think mst
proposal will work for us, with a common base controller for the
shared chain part.
> If you do in fact modify state on the server based on information
> in the URI, I hope that you at least require POST for these
> requests?
We always redirect after POST.
> Otherwise things like Google Web Accelerator or
> Firefox’s prefetching will badly break your app, proxy caches may
> cause heisenbugs, and all sorts of other mayhem.
I understand the dangers of not redirecting after POST :)
best regards,
--
Pedro Melo
Blog: http://www.simplicidade.org/notes/
XMPP ID: melo at simplicidade.org
Use XMPP!
More information about the Catalyst
mailing list