Hi Roberto,

I believe you used 
'org.apache.portals.bridges.velocity.BridgesVelocityViewServlet' instead of the 
default 'org.apache.velocity.tools.view.servlet.VelocityViewServet' in your 
web.xml because it is responsible for merging context objects from portlet side 
to servlet side velocity view servlet.
Anyway, did you ever put some objects by same names into request or session 
attributes?
The default velocity context 
(org.apache.velocity.tools.view.context.ChainedContext) will retrieve an object 
from request or session or application when it cannot find it by the name in 
the context object map. I think you can suspect this.

Regards,

Woonsan


--- On Wed, 5/27/09, Roberto Rossi <impias...@gmail.com> wrote:

> From: Roberto Rossi <impias...@gmail.com>
> Subject: velocity context problem
> To: jetspeed-user@portals.apache.org
> Date: Wednesday, May 27, 2009, 10:54 PM
> 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: jetspeed-user-unsubscr...@portals.apache.org
> For additional commands, e-mail: jetspeed-user-h...@portals.apache.org
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscr...@portals.apache.org
For additional commands, e-mail: jetspeed-user-h...@portals.apache.org

Reply via email to