Hi everyone.
I'd like to share a very strange behaviour of the velocity context
using the velocity bridge.
I'm using Jetspeed 2.1.2 with Tomcat 6 and Velocity 1.5 (Velocity Tools 1.3).
I found that in case of many concurrent requests to a psml page made
by many fragments of velocity portlets the velocity templates are not
receiving correct objects.
My portlets (at the end of their execution) call context.put("object",
object) but the template is not receiving the correct object and
inside the variable $object there is another object
(put before in the context by some other portlet using the same key).
With just 1 request there are no problems, but using a repeated wget
command in background (like this: for i in `seq 0 500`; do wget
"http://www.sample.com/jetspeed/portal/page.psml"; done) and asking
for the same psml page the objects to velocity templates are often
wrong .
The velocity context shouldn't be empty for every portlet fragment?
I checked all my objects before putting them in the context (logging
their properties) and they are all right.
Any ideas about this problem? Maybe I'm wrong in my portlet
development approach?
I cannot found the reason for this issue, but I think it is very
urgent (if we can confirm that it's a bug).
-----------------------------------
This is my portlet code writing approach:
import ...
public class MyVelocityPortlet extends GenericVelocityPortlet {
// some private variables
public void doView(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response)
throws javax.portlet.PortletException, java.io.IOException
{
PortletContext portletContext = null;
PortletRequestDispatcher portletRequestDispatcher = null;
// obtaining the velocity context
context = getContext(request);
// portlet relevant code
...
// putting object to context (in this case a menu)
context.put("object", object);
/* go to template */
response.setContentType("text/html");
portletContext = (PortletContext) this.getPortletContext();
portletRequestDispatcher = (PortletRequestDispatcher)
portletContext.getRequestDispatcher("view.vm");
portletRequestDispatcher.include(request,response);
}
}
ROb
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]