tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nino Ulsamer <nino.ulsa...@wevade.de>
Subject ViewPreparer / concurrency issue
Date Fri, 19 Jun 2009 16:04:44 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message