Arvind Srinivasan wrote:
> 
> Christopher St. John wrote:
> >
> >  The obvious implementation is to have have ValveContext hold
> > the index.
> 
> But isn't a ValveContext (Pipeline) shared across requests ?
>

 It's shouldn't be, but it is now. StandardPipeline
implements VavleContext, but there's no particular reason
to do it that way.


> I think the stage has to be maintained in the Request object.
> 

 No, definitely not. Here's how MinTC (MinimalTomcat) does
it (this is alpha code, and I've deleted some of the methods
to keep the size down):


public class MinimalPipeline implements Pipeline {

  class MinimalValveContext implements ValveContext {
    protected int pos = 0;
    public void invokeNext(Request req, Response rsp)
      throws IOException, ServletException
    {
      Valve v = null;
      if (pos == valves.size())
        v = basicValve;
      else
        v = (Valve)valves.elementAt(pos++);
      if (v!=null)
        v.invoke(req, rsp, this);
    }
  }

  protected Valve basicValve = null;
  protected Vector valves = new Vector();
  protected Valve[] valve_array = null;
  protected Container container = null;

  public void invoke(Request req, Response rsp)
    throws IOException, ServletException
  {
    MinimalValveContext ctx = new MinimalValveContext();
    ctx.invokeNext(req, rsp);
  }

}


-- 
Christopher St. John [EMAIL PROTECTED]
DistribuTopia http://www.distributopia.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to