Hmm, i must have been very tired when i tested this yesterday.

It doesnt work. The ComponentActionRequestFilter is handled after the
persistent fields are gathered. So my activation context variable that
I need when gathering persistent fields is not set before I gather the
fields.
I have tried to add the filter with "before:*"

A solution would be to inject the Request into the
PersistentFieldStrategy and get/decode the context from the path (or
post variables when posting) .. but that is not very clean in my
opinion.

It would be nice if the gathering of fields was done a little later or
maybe we could extend the Request API with a Object[]
getActivationContext()

Or do you have any other ideas.

I feel I should explain my use case here..
We are developing a checkout service where the current cart beeing
processed is passed around via a activation context variable (the
cart-hash). This means that the persistent variables in the components
should be "per cart-hash". This can be done transparently by
implementing a custom PersistentFieldStrategy which uses the first
value in the activation context (we decided that the cart-hash should
always be the first value).

Or the hash could be a part of the domain like hash.mydomain.com, then
the session is made unique per host and everything will work like
expected.
this is a third solution


2008/1/18, Howard Lewis Ship <[EMAIL PROTECTED]>:
> The pipelines and chains of command make it easy to "slip in" specific logic.
>
> OH, an alternative to defining a service to contain the data is to
> just write it as a Request attribute.  I've used that approach for
> handling a few awkward cases.
>
> On Jan 17, 2008 5:56 PM, Ted Steen <[EMAIL PROTECTED]> wrote:
> > Yep, that did it.
> > Thanks!
> >
> > 2008/1/18, Howard Lewis Ship <[EMAIL PROTECTED]>:
> >
> > > If you mean the event context (as opposed to the page activation
> > > context), then ...
> > >
> > > The path of least resistance is:
> > >
> > > 1) Define a service with a simple read/write property to store the
> > > context.  Make sure this is perthread scope.
> > > 2) Contribute a filter to the ComponentActionRequestHandler pipeline.
> > > The filter can capture the event context and store it in your service.
> > > 3) In your PersistentFieldStrategy, inject the context-storing service
> > > and read the context.
> > >
> > > You might simplify #1 to just store the piece of data you need from the 
> > > context.
> > >
> > > The approach is similar if you need page activation context,  but
> > > you'll need to contribute a similar filter into the
> > > PageRenderRequestHandler pipeline as well.
> > >
> > > On Jan 17, 2008 12:13 PM, Ted Steen <[EMAIL PROTECTED]> wrote:
> > > > I need to hook in somewhere between where the context is available and
> > > > the persistent fields are read.
> > > > I need to read a context variable just before my
> > > > PersistentFieldStrategy tries to read from the session, as I need a
> > > > value from the context when reading from the session.
> > > >
> > > > What should I inject into my PersistentFieldStrategy in order to be
> > > > able to read the context?
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Howard M. Lewis Ship
> > >
> > > Creator Apache Tapestry and Apache HiveMind
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > /ted
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
/ted

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to