You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Nino Ulsamer <ni...@wevade.de> on 2009/06/19 18:04:44 UTC

ViewPreparer / concurrency issue

Hello everybody,
I have a question concerning the ViewPreparer of tiles 2.
We are using the preparer to switch the "content" attribute of a couple of
tiles-definitions based on a value stored in the session. Basically we have
multiple companies with different layouts using the same system and I want
to select the corresponding template based on the company.

Everything works perfectly, I do something like the following:

ViewPreparer.execute(TilesRequestContext, AttributeContext){
  (...)

attributeContext.getAttribute("content").setValue("/path/to/some/page.jsp");
}

Now the problem is the following: I thought the preparer is used to prepare
the current rendering of a tiles definition. However, when the preparer is
executed the second time, the "content" attribute still has the new value
that was set when it was executed the first time (so
"/path/to/some/page.jsp"), not the original value!
Okay, this may or may not be a problem. I can simply overwrite the value to
its default value again or to some other value to be used this time.

But what about concurrency issues? I imagine two almost simultaneous
pageviews of two different companies. Can I assume that one rendering
process (i.e. ViewPreparer.execute() - <tiles:insertAttribute
name="content"> - sequence) will not be interrupted by another such process?
Because that could potentially mess things up seriously.

I hope someone knows the answer to that. Maybe my approach using a
ViewPreparer is not the best at all anyways? I am using a framework on top
of Spring / Struts / Tiles, and for me right now this was the easiest
solution.

Hopefully someone can help,
Thanks!
Nino

Re: ViewPreparer / concurrency issue

Posted by Nino Ulsamer <ni...@wevade.de>.
Hi Antonio,

that is what I would have expected. I am using version 2.0.7. Tiles is
integrated into Spring 2.5.6 using the
org.springframework.web.servlet.view.tiles2.TilesConfigurer if that is
relevant.

best regards,
Nino


On Fri, Jun 19, 2009 at 7:43 PM, Antonio Petrelli <
antonio.petrelli@gmail.com> wrote:

> 2009/6/19 Nino Ulsamer <ni...@wevade.de>
>
> > Now the problem is the following: I thought the preparer is used to
> prepare
> > the current rendering of a tiles definition. However, when the preparer
> is
> > executed the second time, the "content" attribute still has the new value
> > that was set when it was executed the first time (so
> > "/path/to/some/page.jsp"), not the original value!
>
>
>
> Strange, the attribute context that arrives to the preparer is a "copy" of
> the original definition.
> What version of Tiles are you using?
>
> Antonio
>



-- 
Nino Ulsamer
Managing Director

Wevade GmbH
Fichtenstraße 6
D-82041 Oberhaching (München)

Phone: +49 (0) 89 381 5755-32
Fax: +49 (0) 89 381 5755-39

nino.ulsamer@wevade.de

Wevade Group Munich
www.wevade.de

Registernummer: HRB 175234
Registergericht: Amtsgericht München
USt-IdNr.: DE261171098
Geschäftsführer: Stefan Bures und Nino Ulsamer

Der Inhalt dieser E-mail ist vertraulich und enthält möglicherweise
Informationen, die ausschließlich für ausgewählte Empfänger und nicht für
die Öffentlichkeit bestimmt sind. Falls diese Nachricht nicht an Sie
gerichtet ist oder fehlgeleitet wurde, zeigen Sie dies bitte dem Absender
unter der Telefonnummer +49 (0) 89 21 80 69 46 an. Die unerlaubte
Verwendung, Vervielfältigung oder Verbreitung dieser Nachricht ist
strengstens verboten.

Re: ViewPreparer / concurrency issue

Posted by Antonio Petrelli <an...@gmail.com>.
2009/6/19 Nino Ulsamer <ni...@wevade.de>

> Now the problem is the following: I thought the preparer is used to prepare
> the current rendering of a tiles definition. However, when the preparer is
> executed the second time, the "content" attribute still has the new value
> that was set when it was executed the first time (so
> "/path/to/some/page.jsp"), not the original value!



Strange, the attribute context that arrives to the preparer is a "copy" of
the original definition.
What version of Tiles are you using?

Antonio

Re: ViewPreparer / concurrency issue

Posted by Nino Ulsamer <ni...@wevade.de>.
Hi Antonio,
thanks for your reply - I created an issue in JIRA:

https://issues.apache.org/struts/browse/TILES-429

best regards,
Nino


On Sat, Jun 20, 2009 at 1:23 PM, Antonio Petrelli <
antonio.petrelli@gmail.com> wrote:

> 2009/6/19 Nino Ulsamer <ni...@wevade.de>
>
> >
> >
> attributeContext.getAttribute("content").setValue("/path/to/some/page.jsp");
> > }
>
>
>
> Well, it seems that the attribute maps are not copied deeply: the map
> containing the name/attribute pairs is copied, but the compound attributes
> are not copied!
>
> Can you open a JIRA issue along with a test case, please?
>
> Thanks
> Antonio
>

Re: ViewPreparer / concurrency issue

Posted by Antonio Petrelli <an...@gmail.com>.
2009/6/19 Nino Ulsamer <ni...@wevade.de>

>
> attributeContext.getAttribute("content").setValue("/path/to/some/page.jsp");
> }



Well, it seems that the attribute maps are not copied deeply: the map
containing the name/attribute pairs is copied, but the compound attributes
are not copied!

Can you open a JIRA issue along with a test case, please?

Thanks
Antonio