velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kaur, Jasdeep Guglani" <jasdee...@gmail.com>
Subject Re: Initializing multiple VelocityServlets
Date Wed, 23 Jan 2008 15:08:03 GMT
Hi Thanks for responding...

If I have to use Velocity Servlet...can this problem be rectified....


On 1/23/08, Will Glass-Husain <wglass@forio.com> wrote:
>
> Hi,
>
> Have you looked at the Velocity Tools subproject?  Look at the
> VelocityViewServlet.  It's a much better servlet and is actively
> maintained.
>
> Let's take any other discussion to the user@velocity.apache.org
> mailing list please.
>
> WILL
>
> On 1/23/08, Kaur, Jasdeep Guglani <jasdeepkg@gmail.com> wrote:
> > Hi
> >
> > I wish to use the code written by. Attcahed is the file you wrote. It
> has
> > alternate version of the Velocity servlet to load multiple instances.
> >
> > I extend this class and want multiple instances of the subclass too. Is
> it
> > possible? or how else can I proceed to wards it...
> >
> >
> >
> > I can quote my problem in following way:
> >
> > There is a servlet (VMServlet) that handles all our requests. It has a
> > member variable viz. "user" that stores the username etc. As we are
> using
> > singleton model; only one copy of the VMServlet class gets created.
> >
> >
> >
> > So when multiple users log into the application, and there is one
> instance
> > of the VMServlet which is handling the requests, we see wrong user name
> in
> > the application. This problem appears when more than one instance of the
> > application are  busy processing simulataneously.
> >
> >  The VM Servlet class extends VelocityServlet.
> >
> >
> >
> > In VelocityServlet class I made some change to drop the singleton model
> > being followed earliar.
> >
> > The change is
> >
> > protected void initVelocity(ServletConfig config)
> >
> >         throws ServletException
> >
> >     {
> >
> >         try
> >
> >         {
> >
> >             Properties props = loadConfiguration(config);
> >
> >             //Velocity.init(props); This line was commented
> >
> >
> >
> >             /* Code inserted */
> >
> > ve = new VelocityEngine();
> >
> >                   System.out.println("\n\n\n*************In Velocity
> Servlet
> > Modified****************");
> >
> >             ve.init(props);
> >
> >         }
> >
> >         catch(Exception e)
> >
> >         {
> >
> >             throw new ServletException("Error initializing Velocity: " +
> e,
> > e);
> >
> >         }
> >
> >     }
> >
> > But this has not solved the problem.
> >
> >
> >
> > Do you have any idea how to go about it? your alternate velocity servlet
> has
> > not solved my problem.
> >
> > Please help...n thanks!
> >
> >
> >
>
>
> --
> Forio Business Simulations
>
> Will Glass-Husain
> 415 440-7500x89
> wglass@forio.com
> www.forio.com
>

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