You might need to put a fake Request object into RequestGlobals for
Tapestry to be happy.

You can use existing (public) Tapestry services, and the component's
ComponentResources, to generate a Link object; plugging that link's
URL into the fake Request's path property and using the normal
Tapestry code paths should get you MOST of the way there.

My thinking for push in 5.4 may incorporate similar use cases to this
... but I'm mostly thinking in terms of leveraging client-side pubsub
when server-side events happen.  Maybe part of that pubsub is delivery
of updated compone-t-rendered content.

On Wed, May 9, 2012 at 8:03 AM, Lance Java <lance.j...@googlemail.com> wrote:
> Hi guys, I've been thinking about a "push" component for a while and I
> thought I might make a start when I got some free time. I will be using an
> abstraction on top of DWR's reverse ajax to achieve this.
>
> Basically, it will look something like this:
>
> ItemsComponent.tml
> <div>
>        <t:zone t:id="zone" t:mixins="push" t:pushId="items-${user.id}"
> t:pushEvent="doPush">
>                <t:loop source="items" item="item">${item.name}</t:loop>
>        </t:zone>
> </div>
>
> public class ItemsComponent {
>        @Property
>        private List<Item> items;
>
>        @Property
>        private Item item;
>
>        @SessionState
>        @Property
>        private User user;
>
>        @InjectComponent
>        private Zone zone;
>
>        public Block doPush(List<Item> context) {
>                this.items = context;
>                return zone.getBody();
>        }
> }
>
> And at some point, an asynchronous process will call
> PushService.doPush(Object pushId, Object pushContext) which will fire
> "doPush" and update the zone.
>
> As part of this, I will need to do the following FROM A NON WEB THREAD
> 1. Get a component / page instance (using a path/id I stored earlier)
> 2. Execute an event on the component / page instance
> 3. Get the resultant block and run it through tapestry's template engine
> 4. Use DWR's reverse ajax to update the zone with the html fragment.
>
> A couple of questions:
> 5. The push mixin will be storing the pushId and pushEvent in DWR's
> http://directwebremoting.org/dwr/javadoc/org/directwebremoting/ScriptSession.html
> ScriptSession . I will also need a String which will allow me to lookup a
> component / page at a later stage. Is there a component path that will
> uniquely identify the component page / instance?
> 6. I *think* that DWR has a HTTPServletRequest and HTTPServletResponse that
> I *might* be able to get a handle on for the push. Any ideas on how I would
> lookup the page / component / component resources?
>
> Cheers,
> Lance.
>
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/tapestry-push-proof-of-concept-tp5697644.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to