User: janb    
  Date: 02/02/19 21:33:44

  Modified:    jetty/src/main/org/mortbay/jetty/servlet
                        AbstractSessionManager.java Dispatcher.java
                        FilterHandler.java FilterHolder.java
                        HashSessionManager.java Holder.java
                        ServletHandler.java ServletHolder.java
                        ServletHttpContext.java ServletHttpRequest.java
                        ServletHttpResponse.java ServletIn.java
                        ServletOut.java ServletSSL.java ServletWriter.java
                        SessionContext.java SessionManager.java
                        WebApplicationContext.java
  Log:
  Updating to latest Jetty with tag JBOSS_20020220222111
  
  Revision  Changes    Path
  1.2       +7 -7      
contrib/jetty/src/main/org/mortbay/jetty/servlet/AbstractSessionManager.java
  
  Index: AbstractSessionManager.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/AbstractSessionManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractSessionManager.java       10 Feb 2002 17:57:44 -0000      1.1
  +++ AbstractSessionManager.java       20 Feb 2002 05:33:43 -0000      1.2
  @@ -1,6 +1,6 @@
   // ===========================================================================
   // Copyright (c) 1996 Mort Bay Consulting Pty. Ltd. All rights reserved.
  -// $Id: AbstractSessionManager.java,v 1.1 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: AbstractSessionManager.java,v 1.2 2002/02/20 05:33:43 janb Exp $
   // ---------------------------------------------------------------------------
   
   package org.mortbay.jetty.servlet;
  @@ -40,7 +40,7 @@
    * to return a specialized version of the Session inner class that
    * provides an attribute Map.
    *
  - * @version $Id: AbstractSessionManager.java,v 1.1 2002/02/10 17:57:44 olegnitz Exp 
$
  + * @version $Id: AbstractSessionManager.java,v 1.2 2002/02/20 05:33:43 janb Exp $
    * @author Greg Wilkins (gregw)
    */
   public abstract class AbstractSessionManager implements SessionManager
  @@ -94,10 +94,6 @@
       }
       
       /* ------------------------------------------------------------ */
  -    /**
  -     * @param id
  -     * @return
  -     */
       public HttpSession getHttpSession(String id)
       {
           HttpSession s = (HttpSession)_sessions.get(id);
  @@ -199,9 +195,13 @@
       public void start()
           throws Exception
       {
  -        Log.event("Initializing random session key: "+_random);
           if (_random==null)
  +        {
  +            Log.event("New random session seed");
               _random=new Random();
  +        }
  +        else
  +            Log.event("Initializing random session key: "+_random);
           _random.nextLong();
           
           if (_sessions==null)
  
  
  
  1.3       +2 -9      contrib/jetty/src/main/org/mortbay/jetty/servlet/Dispatcher.java
  
  Index: Dispatcher.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/Dispatcher.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Dispatcher.java   10 Feb 2002 17:57:44 -0000      1.2
  +++ Dispatcher.java   20 Feb 2002 05:33:44 -0000      1.3
  @@ -1,6 +1,6 @@
   // ===========================================================================
   // Copyright (c) 1996 Mort Bay Consulting Pty. Ltd. All rights reserved.
  -// $Id: Dispatcher.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: Dispatcher.java,v 1.3 2002/02/20 05:33:44 janb Exp $
   // ---------------------------------------------------------------------------
   
   package org.mortbay.jetty.servlet;
  @@ -45,7 +45,7 @@
   /* ------------------------------------------------------------ */
   /** Servlet RequestDispatcher.
    * 
  - * @version $Id: Dispatcher.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  + * @version $Id: Dispatcher.java,v 1.3 2002/02/20 05:33:44 janb Exp $
    * @author Greg Wilkins (gregw)
    */
   public class Dispatcher implements RequestDispatcher
  @@ -365,13 +365,6 @@
               return(_forwarded)?_query:super.getQueryString();
           }
           
  -        /* ------------------------------------------------------------ */
  -        public String getRequestURI()
  -        {
  -            return (!_included)
  -                ?URI.addPaths(_contextPath,URI.addPaths(_servletPath,_pathInfo))
  -                :super.getRequestURI();
  -        }
   
           /* ------------------------------------------------------------ */
           void addParameters(MultiMap parameters)
  
  
  
  1.3       +24 -3     
contrib/jetty/src/main/org/mortbay/jetty/servlet/FilterHandler.java
  
  Index: FilterHandler.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/FilterHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FilterHandler.java        10 Feb 2002 17:57:44 -0000      1.2
  +++ FilterHandler.java        20 Feb 2002 05:33:44 -0000      1.3
  @@ -1,6 +1,6 @@
   // ===========================================================================
   // Copyright (c) 2001 Mort Bay Consulting Pty. Ltd. All rights reserved.
  -// $Id: FilterHandler.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: FilterHandler.java,v 1.3 2002/02/20 05:33:44 janb Exp $
   // ---------------------------------------------------------------------------
   
   package org.mortbay.jetty.servlet;
  @@ -30,6 +30,7 @@
   import org.mortbay.http.handler.NullHandler;
   import org.mortbay.util.Code;
   import org.mortbay.util.MultiMap;
  +import org.mortbay.util.MultiException;
   
   
   /* ------------------------------------------------------------ */
  @@ -41,7 +42,7 @@
    * or more intelligently merge entries in the cache.
    *
    * @since Servlet 2.3
  - * @version  $Id: FilterHandler.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  + * @version  $Id: FilterHandler.java,v 1.3 2002/02/20 05:33:44 janb Exp $
    * @author Greg Wilkins (gregw)
    */
   public class FilterHandler
  @@ -76,6 +77,14 @@
       public void setCacheFilterChains(boolean cache)
       {
           _cacheFilterChains=cache;
  +
  +        if (isStarted())
  +        {
  +            if (_cacheFilterChains)
  +                _chainMap=new HashMap();
  +            else
  +                _chainMap=null;
  +        }
       }
       
       /* ------------------------------------------------------------ */
  @@ -143,17 +152,29 @@
   
           if (_cacheFilterChains)
               _chainMap=new HashMap();
  +
  +        MultiException mex = new MultiException();
  +        try
  +        {
  +            if (!_servletHandler.isStarted())
  +                _servletHandler.start();
  +        }
  +        catch(MultiException e) {mex=e;}
  +        catch(Exception e) {mex.add(e);}
           
           // Start filters
           Iterator iter = _filterMap.values().iterator();
           while (iter.hasNext())
           {
               FilterHolder holder = (FilterHolder)iter.next();
  -            holder.start();
  +            try{holder.start();}
  +            catch(Exception e) {mex.add(e);}
           }
   
           Code.debug("Path Filters: "+_pathFilters);
           Code.debug("Servlet Filters: "+_servletFilterMap);
  +
  +        mex.ifExceptionThrow();
       }
       
       /* ------------------------------------------------------------ */
  
  
  
  1.3       +2 -3      
contrib/jetty/src/main/org/mortbay/jetty/servlet/FilterHolder.java
  
  Index: FilterHolder.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/FilterHolder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FilterHolder.java 10 Feb 2002 17:57:44 -0000      1.2
  +++ FilterHolder.java 20 Feb 2002 05:33:44 -0000      1.3
  @@ -1,6 +1,6 @@
   // ===========================================================================
   // Copyright (c) 1996 Mort Bay Consulting Pty. Ltd. All rights reserved.
  -// $Id: FilterHolder.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: FilterHolder.java,v 1.3 2002/02/20 05:33:44 janb Exp $
   // ---------------------------------------------------------------------------
   
   package org.mortbay.jetty.servlet;
  @@ -16,8 +16,7 @@
   
   /* --------------------------------------------------------------------- */
   /** 
  - * @see org.mortbay.jetty.ServletHandler
  - * @version $Id: FilterHolder.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  + * @version $Id: FilterHolder.java,v 1.3 2002/02/20 05:33:44 janb Exp $
    * @author Greg Wilkins
    */
   public class FilterHolder
  
  
  
  1.3       +3 -4      
contrib/jetty/src/main/org/mortbay/jetty/servlet/HashSessionManager.java
  
  Index: HashSessionManager.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/HashSessionManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HashSessionManager.java   10 Feb 2002 17:57:44 -0000      1.2
  +++ HashSessionManager.java   20 Feb 2002 05:33:44 -0000      1.3
  @@ -1,6 +1,6 @@
   // ===========================================================================
   // Copyright (c) 1996 Mort Bay Consulting Pty. Ltd. All rights reserved.
  -// $Id: HashSessionManager.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: HashSessionManager.java,v 1.3 2002/02/20 05:33:44 janb Exp $
   // ---------------------------------------------------------------------------
   
   package org.mortbay.jetty.servlet;
  @@ -32,10 +32,9 @@
   
   
   /* ------------------------------------------------------------ */
  -/** An in-memory implementation of SessionManager
  - * <p>
  +/** An in-memory implementation of SessionManager.
    *
  - * @version $Id: HashSessionManager.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  + * @version $Id: HashSessionManager.java,v 1.3 2002/02/20 05:33:44 janb Exp $
    * @author Greg Wilkins (gregw)
    */
   public class HashSessionManager extends AbstractSessionManager
  
  
  
  1.3       +0 -0      contrib/jetty/src/main/org/mortbay/jetty/servlet/Holder.java
  
  Index: Holder.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/Holder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Holder.java       10 Feb 2002 17:57:44 -0000      1.2
  +++ Holder.java       20 Feb 2002 05:33:44 -0000      1.3
  @@ -1,6 +1,6 @@
   // ===========================================================================
   // Copyright (c) 1996 Mort Bay Consulting Pty. Ltd. All rights reserved.
  -// $Id: Holder.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: Holder.java,v 1.3 2002/02/20 05:33:44 janb Exp $
   // ---------------------------------------------------------------------------
   
   package org.mortbay.jetty.servlet;
  @@ -20,7 +20,7 @@
   
   /* --------------------------------------------------------------------- */
   /** 
  - * @version $Id: Holder.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  + * @version $Id: Holder.java,v 1.3 2002/02/20 05:33:44 janb Exp $
    * @author Greg Wilkins
    */
   public class Holder
  
  
  
  1.3       +25 -23    
contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletHandler.java
  
  Index: ServletHandler.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServletHandler.java       10 Feb 2002 17:57:44 -0000      1.2
  +++ ServletHandler.java       20 Feb 2002 05:33:44 -0000      1.3
  @@ -1,6 +1,6 @@
   // ===========================================================================
   // Copyright (c) 1996 Mort Bay Consulting Pty. Ltd. All rights reserved.
  -// $Id: ServletHandler.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: ServletHandler.java,v 1.3 2002/02/20 05:33:44 janb Exp $
   // ---------------------------------------------------------------------------
   
   package org.mortbay.jetty.servlet;
  @@ -70,7 +70,7 @@
    * initialized, then a HashSessionManager with a standard
    * java.util.Random generator is created.
    * 
  - * @version $Id: ServletHandler.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  + * @version $Id: ServletHandler.java,v 1.3 2002/02/20 05:33:44 janb Exp $
    * @author Greg Wilkins
    */
   public class ServletHandler
  @@ -353,6 +353,9 @@
       public synchronized void start()
           throws Exception
       {
  +        if (isStarted())
  +            return;
  +        
           _httpContext=getHttpContext();
           
           _sessionManager.start();
  @@ -415,8 +418,11 @@
                                                       HttpResponse httpResponse)
       {
           // Look for a previously built servlet request.
  -        ServletHttpRequest servletHttpRequest = (ServletHttpRequest)
  -            httpRequest.getFacade();
  +        ServletHttpRequest servletHttpRequest = null;
  +        HttpMessage facade = httpRequest.getFacade();
  +        if (facade!=null)
  +            servletHttpRequest 
=((ServletHttpRequest.Facade)facade).getServletHttpRequest();
  +        
           if (servletHttpRequest==null)
               servletHttpRequest=newFacades(pathInContext,
                                             pathParams,
  @@ -436,7 +442,10 @@
       public HttpServletResponse getHttpServletResponse(HttpResponse httpResponse)
       {
           // Look for a previously built servlet request.
  -        return (ServletHttpResponse)httpResponse.getFacade();
  +        HttpMessage facade = httpResponse.getFacade();
  +        if (facade==null)
  +            return null;
  +        return ((ServletHttpResponse.Facade)facade).getServletHttpResponse();
       }
       
       /* ------------------------------------------------------------ */
  @@ -447,11 +456,11 @@
                                             Map.Entry entry)
       {
           // Build the request and response.
  -        ServletHttpRequest servletHttpRequest  = new 
ServletHttpRequest(this,httpRequest);
  -        httpRequest.setFacade(servletHttpRequest);
  +        ServletHttpRequest servletHttpRequest  = new 
ServletHttpRequest(this,pathInContext,httpRequest);
  +        httpRequest.setFacade(servletHttpRequest.getFacade());
           ServletHttpResponse servletHttpResponse =
               new ServletHttpResponse(servletHttpRequest,httpResponse);
  -        httpResponse.setFacade(servletHttpResponse);
  +        httpResponse.setFacade(servletHttpResponse.getFacade());
           
           // Handle the session ID
           servletHttpRequest.setSessionId(pathParams);
  @@ -463,8 +472,7 @@
           if (entry!=null)
           {
               String servletPathSpec=(String)entry.getKey();            
  -            servletHttpRequest.setServletPaths(pathInContext,
  -                                               PathMap.pathMatch(servletPathSpec,
  +            servletHttpRequest.setServletPaths(PathMap.pathMatch(servletPathSpec,
                                                                    pathInContext),
                                                  PathMap.pathInfo(servletPathSpec,
                                                                   pathInContext),
  @@ -519,7 +527,9 @@
               Code.debug("ServletHandler: ",pathInContext);
   
               // Do we already have servlet facades?
  -            request = (ServletHttpRequest) httpRequest.getFacade();
  +            HttpMessage facade = httpRequest.getFacade();
  +            if (facade!=null)
  +                request 
=((ServletHttpRequest.Facade)facade).getServletHttpRequest();
               if (request==null)
               {
                   Map.Entry entry=getHolderEntry(pathInContext);
  @@ -576,7 +586,7 @@
               
               if (th instanceof HttpException)
                   throw (HttpException)th;
  -            if (th instanceof IOException)
  +            if (th.getClass().equals(IOException.class))
                   throw (IOException)th;
               
               Code.warning("Servlet Exception for "+httpRequest.getURI(),th);
  @@ -1074,20 +1084,12 @@
               if ("javax.servlet.context.tempdir".equals(name))
               {
                   // Initialize temporary directory
  -                //
  -                // I'm afraid that this is very much black magic.
  -                // but if you can think of better....
  -
  -                Object t = _httpContext 
.getAttribute("javax.servlet.context.tempdir");
  +                Object t = 
_httpContext.getAttribute("javax.servlet.context.tempdir");
   
                   if (t instanceof File)
                       return (File)t;
  -
  -                File tmp_dir=_httpContext.getTempDirectory();
  -                _httpContext
  -                    .setAttribute("javax.servlet.context.tempdir",
  -                                  tmp_dir);
  -                return tmp_dir;
  +                
  +                return _httpContext.getTempDirectory();
               }
   
               return _httpContext.getAttribute(name);
  
  
  
  1.3       +2 -3      
contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletHolder.java
  
  Index: ServletHolder.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletHolder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServletHolder.java        10 Feb 2002 17:57:44 -0000      1.2
  +++ ServletHolder.java        20 Feb 2002 05:33:44 -0000      1.3
  @@ -1,6 +1,6 @@
   // ===========================================================================
   // Copyright (c) 1996 Mort Bay Consulting Pty. Ltd. All rights reserved.
  -// $Id: ServletHolder.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: ServletHolder.java,v 1.3 2002/02/20 05:33:44 janb Exp $
   // ---------------------------------------------------------------------------
   
   package org.mortbay.jetty.servlet;
  @@ -32,8 +32,7 @@
    * This class will organise the loading of the servlet when needed or
    * requested.
    *
  - * @see org.mortbay.jetty.ServletHandler
  - * @version $Id: ServletHolder.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  + * @version $Id: ServletHolder.java,v 1.3 2002/02/20 05:33:44 janb Exp $
    * @author Greg Wilkins
    */
   public class ServletHolder extends Holder
  
  
  
  1.3       +0 -0      
contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletHttpContext.java
  
  Index: ServletHttpContext.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletHttpContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServletHttpContext.java   10 Feb 2002 17:57:44 -0000      1.2
  +++ ServletHttpContext.java   20 Feb 2002 05:33:44 -0000      1.3
  @@ -1,6 +1,6 @@
   // ========================================================================
   // Copyright (c) 2001 Mort Bay Consulting (Australia) Pty. Ltd.
  -// $Id: ServletHttpContext.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: ServletHttpContext.java,v 1.3 2002/02/20 05:33:44 janb Exp $
   // ========================================================================
   
   package org.mortbay.jetty.servlet;
  @@ -14,7 +14,7 @@
   /** ServletHttpContext.
    * Extends HttpContext with conveniance methods for adding servlets.
    * Enforces a single ServletHandler per context.
  - * @version $Id: ServletHttpContext.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  + * @version $Id: ServletHttpContext.java,v 1.3 2002/02/20 05:33:44 janb Exp $
    * @author Greg Wilkins (gregw)
    */
   public class ServletHttpContext extends HttpContext
  
  
  
  1.3       +100 -16   
contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletHttpRequest.java
  
  Index: ServletHttpRequest.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletHttpRequest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServletHttpRequest.java   10 Feb 2002 17:57:44 -0000      1.2
  +++ ServletHttpRequest.java   20 Feb 2002 05:33:44 -0000      1.3
  @@ -1,6 +1,6 @@
   // ========================================================================
   // Copyright (c) 2000 Mort Bay Consulting (Australia) Pty. Ltd.
  -// $Id: ServletHttpRequest.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: ServletHttpRequest.java,v 1.3 2002/02/20 05:33:44 janb Exp $
   // ========================================================================
   
   
  @@ -8,6 +8,9 @@
   
   import java.io.BufferedReader;
   import java.io.File;
  +import java.io.IOException;
  +import java.io.InputStream;
  +import java.io.OutputStream;
   import java.io.InputStreamReader;
   import java.io.UnsupportedEncodingException;
   import java.net.InetAddress;
  @@ -16,6 +19,7 @@
   import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Collections;
  +import java.util.Date;
   import java.util.Enumeration;
   import java.util.HashMap;
   import java.util.HashSet;
  @@ -32,6 +36,7 @@
   import javax.servlet.http.HttpSession;
   import javax.servlet.http.HttpUtils;
   import javax.servlet.http.HttpServletRequestWrapper;
  +import org.mortbay.http.ChunkableInputStream;
   import org.mortbay.http.HttpContext;
   import org.mortbay.http.HttpConnection;
   import org.mortbay.http.HttpFields;
  @@ -56,7 +61,7 @@
    * be operated on by multiple threads, then higher level
    * synchronizations may be required.
    * 
  - * @version $Id: ServletHttpRequest.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  + * @version $Id: ServletHttpRequest.java,v 1.3 2002/02/20 05:33:44 janb Exp $
    * @author Greg Wilkins (gregw)
    */
   public class ServletHttpRequest
  @@ -92,13 +97,17 @@
       private ServletHolder _servletHolder;
       private String _pathInContext;
       private ServletRequest _wrapper;
  +    private HttpMessage _facade = new Facade();
       
       /* ------------------------------------------------------------ */
       /** Constructor. 
        */
  -    ServletHttpRequest(ServletHandler servletHandler,HttpRequest request)
  +    ServletHttpRequest(ServletHandler servletHandler,
  +                       String pathInContext,
  +                       HttpRequest request)
       {
           _servletHandler=servletHandler;
  +        _pathInContext=pathInContext;
           _contextPath=_servletHandler.getHttpContext().getContextPath();
           if (_contextPath.length()<=1)
               _contextPath="";
  @@ -107,6 +116,12 @@
       }
   
       /* ------------------------------------------------------------ */
  +    HttpMessage getFacade()
  +    {
  +        return _facade;
  +    }
  +    
  +    /* ------------------------------------------------------------ */
       ServletHandler getServletHandler()
       {
           return _servletHandler;
  @@ -119,6 +134,16 @@
       }
   
       /* ------------------------------------------------------------ */
  +    /** Set a ServletRequest Wrapper.
  +     * This call is used by the Dispatcher and the FilterHandler to
  +     * store a user generated wrapper for this request. The wrapper is
  +     * recovered by getWrapper for use by the next filter and/or
  +     * servlet.
  +     *
  +     * Note that the ServletHttpRequest is always the facade object of
  +     * the HttpRequest, even if a ServletRequest object is set here.
  +     * @param wrapper 
  +     */
       void setWrapper(ServletRequest wrapper)
       {
           if (wrapper == this)
  @@ -146,12 +171,10 @@
        * @param servletPath 
        * @param pathInfo 
        */
  -    void setServletPaths(String pathInContext,
  -                         String servletPath,
  +    void setServletPaths(String servletPath,
                            String pathInfo,
                            ServletHolder holder)
       {
  -        _pathInContext=pathInContext;
           _servletPath=servletPath;
           _pathInfo=pathInfo;
           _servletHolder=holder;
  @@ -338,6 +361,8 @@
       /* ------------------------------------------------------------ */
       public String getPathInfo()
       {
  +        if (_servletPath==null)
  +            return null; 
           return _pathInfo;
       }
       
  @@ -462,20 +487,22 @@
       /* ------------------------------------------------------------ */
       public String getRequestURI()
       {
  -        return
  -            
URI.addPaths(getContextPath(),URI.addPaths(getServletPath(),getPathInfo()));
  +        return _httpRequest.getEncodedPath();
       }
       
       /* ------------------------------------------------------------ */
       public StringBuffer getRequestURL()
       {
  -        // XXX should move impl to here!!!
  -        return HttpUtils.getRequestURL(this);
  +        StringBuffer buf = _httpRequest.getRootURL();
  +        buf.append(getRequestURI());
  +        return buf;
       }
       
       /* ------------------------------------------------------------ */
       public String getServletPath()
       {
  +        if (_servletPath==null)
  +            return _pathInContext;
           return _servletPath;
       }
       
  @@ -551,7 +578,7 @@
       /* -------------------------------------------------------------- */
       public Enumeration getAttributeNames()
       {
  -        return Collections.enumeration(_httpRequest.getAttributeNames());
  +        return _httpRequest.getAttributeNames();
       }
       
       /* -------------------------------------------------------------- */
  @@ -601,13 +628,13 @@
       /* -------------------------------------------------------------- */
       public int getContentLength()
       {
  -        return _httpRequest.getIntField(HttpFields.__ContentLength);
  +        return _httpRequest.getContentLength();
       }
       
       /* -------------------------------------------------------------- */
       public String getContentType()
       {
  -        return _httpRequest.getField(HttpFields.__ContentType);
  +        return _httpRequest.getContentType();
       }
       
       /* -------------------------------------------------------------- */
  @@ -616,7 +643,7 @@
           if (_inputState!=0 && _inputState!=1)
               throw new IllegalStateException();
           if (_in==null)
  -            _in = new ServletIn(_httpRequest.getInputStream());  
  +            _in = new 
ServletIn((ChunkableInputStream)_httpRequest.getInputStream());  
           _inputState=1;
           _reader=null;
           return _in;
  @@ -626,7 +653,6 @@
       /**
        * This method is not recommended as it forces the generation of a
        * non-optimal data structure.
  -     * @return 
        */
       public Map getParameterMap()
       {
  @@ -760,6 +786,64 @@
   
   
       /* ------------------------------------------------------------ */
  +    /* ------------------------------------------------------------ */
  +    /** HttpMessage Facade.
  +     * This facade allows the ServletHttpRequest to be treated as a
  +     * HttpMessage by HttpHandlers.
  +     */
  +    public class Facade implements HttpMessage
  +    {
  +        public ServletHttpRequest getServletHttpRequest()
  +        {return ServletHttpRequest.this;}
  +        
  +        public InputStream getInputStream() throws IOException
  +        {return getWrapper().getInputStream();}
  +        public OutputStream getOutputStream()
  +        {throw new UnsupportedOperationException();}
  +        
  +        public boolean containsField(String name)
  +        {return getHeader(name)!=null;}
  +        public Enumeration getFieldNames()
  +        {return ((HttpServletRequest)getWrapper()).getHeaderNames();}
  +        public Enumeration getFieldValues(String name)
  +        {return ((HttpServletRequest)getWrapper()).getHeaders(name);}
  +        public Enumeration getFieldValues(String name, String separators)
  +        {throw new UnsupportedOperationException();}
  +        
  +        public String getField(String name)
  +        {return ((HttpServletRequest)getWrapper()).getHeader(name);}
  +        public int getIntField(String name)
  +        {return ((HttpServletRequest)getWrapper()).getIntHeader(name);}
  +        public long getDateField(String name)
  +        {return ((HttpServletRequest)getWrapper()).getDateHeader(name);}
  +        
  +        public String setField(String name, String value){throw new 
UnsupportedOperationException();}
  +        public void setField(String name, List values){throw new 
UnsupportedOperationException();}
  +        public void setIntField(String name, int value){throw new 
UnsupportedOperationException();}
  +        public void setDateField(String name, long date){throw new 
UnsupportedOperationException();}
  +        
  +        public void addField(String name, String value){throw new 
UnsupportedOperationException();}
  +        public void addIntField(String name, int value){throw new 
UnsupportedOperationException();}
  +        public void addDateField(String name, long date){throw new 
UnsupportedOperationException();}
  +        
  +        public String removeField(String name){throw new 
UnsupportedOperationException();}
  +        
  +        public String getContentType(){return getWrapper().getContentType();}
  +        public void setContentType(String type){throw new 
UnsupportedOperationException();}
  +        public int getContentLength(){return getWrapper().getContentLength();}
  +        public void setContentLength(int len){throw new 
UnsupportedOperationException();}
  +        public String getCharacterEncoding(){return 
getWrapper().getCharacterEncoding();}
  +        public void setCharacterEncoding(String encoding){throw new 
UnsupportedOperationException();}
  +        
  +        public Object getAttribute(String name){return 
getWrapper().getAttribute(name);}
  +        public Object setAttribute(String name, Object attribute)
  +        {Object 
old=getAttribute(name);getWrapper().setAttribute(name,attribute);return old;}
  +        public Enumeration getAttributeNames(){return 
getWrapper().getAttributeNames();}
  +        public void removeAttribute(String 
name){getWrapper().removeAttribute(name);}
  +    }
  +
  +    
  +    /* ------------------------------------------------------------ */
       /** Unwrap a ServletRequest.
        *
        * @see javax.servlet.ServletRequestWrapper
  @@ -784,7 +868,7 @@
   
           return (ServletHttpRequest)request;
       }
  -    
  +
   }
   
   
  
  
  
  1.3       +95 -13    
contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletHttpResponse.java
  
  Index: ServletHttpResponse.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletHttpResponse.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServletHttpResponse.java  10 Feb 2002 17:57:44 -0000      1.2
  +++ ServletHttpResponse.java  20 Feb 2002 05:33:44 -0000      1.3
  @@ -1,14 +1,18 @@
   // ========================================================================
   // Copyright (c) 2000 Mort Bay Consulting (Australia) Pty. Ltd.
  -// $Id: ServletHttpResponse.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: ServletHttpResponse.java,v 1.3 2002/02/20 05:33:44 janb Exp $
   // ========================================================================
   
   package org.mortbay.jetty.servlet;
   
  +import java.io.InputStream;
  +import java.io.OutputStream;
   import java.io.IOException;
   import java.io.PrintWriter;
   import java.util.Date;
  +import java.util.Enumeration;
   import java.util.HashMap;
  +import java.util.List;
   import java.util.Locale;
   import java.util.Map;
   import javax.servlet.ServletOutputStream;
  @@ -24,6 +28,7 @@
   import org.mortbay.http.HttpResponse;
   import org.mortbay.http.handler.NullHandler;
   import org.mortbay.util.StringUtil;
  +import org.mortbay.util.WriterOutputStream;
   import org.mortbay.util.URI;
   import org.mortbay.util.Code;
   import org.mortbay.util.IO;
  @@ -37,7 +42,7 @@
    * be operated on by multiple threads, then higher level
    * synchronizations may be required.
    *
  - * @version $Id: ServletHttpResponse.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  + * @version $Id: ServletHttpResponse.java,v 1.3 2002/02/20 05:33:44 janb Exp $
    * @author Greg Wilkins (gregw)
    */
   public class ServletHttpResponse implements HttpServletResponse
  @@ -62,7 +67,8 @@
       private HttpSession _session=null;
       private boolean _noSession=false;
       private Locale _locale=null;
  -    private ServletResponse _wrapper;    
  +    private ServletResponse _wrapper;  
  +    private HttpMessage _facade = new Facade();  
   
       private static Map __charSetMap = new HashMap();
       static
  @@ -119,6 +125,12 @@
       }
   
       /* ------------------------------------------------------------ */
  +    HttpMessage getFacade()
  +    {
  +        return _facade;
  +    }
  +    
  +    /* ------------------------------------------------------------ */
       void setWrapper(ServletResponse wrapper)
       {
           if (wrapper == this)
  @@ -160,13 +172,7 @@
               _out=null;
           }
           else
  -        {
               _outputState=s;
  -            if (_writer!=null)
  -                _writer.flush();
  -            if (_out!=null)
  -                _out.flush();
  -        }
       }
       
       
  @@ -198,7 +204,7 @@
       /* ------------------------------------------------------------ */
       public void setBufferSize(int size)
       {
  -        ChunkableOutputStream out = _httpResponse.getOutputStream();
  +        ChunkableOutputStream out = 
(ChunkableOutputStream)_httpResponse.getOutputStream();
           if (out.isWritten()  || _writer!=null && _writer.isWritten())
               throw new IllegalStateException("Output written");
           out.setBufferCapacity(size);
  @@ -207,7 +213,7 @@
       /* ------------------------------------------------------------ */
       public int getBufferSize()
       {
  -        return _httpResponse.getOutputStream().getBufferCapacity();
  +        return 
((ChunkableOutputStream)_httpResponse.getOutputStream()).getBufferCapacity();
       }
       
       /* ------------------------------------------------------------ */
  @@ -228,7 +234,7 @@
       {
           if (isCommitted())
               throw new IllegalStateException("committed");
  -        _httpResponse.getOutputStream().resetBuffer();
  +        ((ChunkableOutputStream)_httpResponse.getOutputStream()).resetBuffer();
           if (_writer!=null)
               _writer.reset();
       }
  @@ -455,7 +461,7 @@
       /* ------------------------------------------------------------ */
       public void addDateHeader(String name, long value) 
       {
  -        try{_httpResponse.addDateField(name,new Date(value));}
  +        try{_httpResponse.addDateField(name,value);}
           catch(IllegalStateException e){Code.ignore(e);}
       }
   
  @@ -526,6 +532,11 @@
                                      
           if (_outputState!=NO_OUT && _outputState!=WRITER_OUT)
               throw new IllegalStateException();
  +
  +        // If we are switching modes, flush output to try avoid overlaps.
  +        if (_out!=null)
  +            _out.flush();
  +        
           /* if there is no writer yet */
           if (_writer==null)
           {
  @@ -573,6 +584,77 @@
           return _httpResponse.toString();
       }
   
  +    /* ------------------------------------------------------------ */
  +    /* ------------------------------------------------------------ */
  +    /** HttpMessage Facade.
  +     * This facade allows the ServletHttpResponse to be treated as a
  +     * HttpMessage by HttpHandlers.
  +     */
  +    public class Facade implements HttpMessage
  +    {
  +        public ServletHttpResponse getServletHttpResponse()
  +        {return ServletHttpResponse.this;}
  +        
  +        public InputStream getInputStream() throws IOException
  +        {throw new UnsupportedOperationException();}
  +        public OutputStream getOutputStream() throws IOException
  +        {
  +            try{return getWrapper().getOutputStream();}
  +            catch(IllegalStateException e)
  +            {
  +                Code.ignore(e);
  +                return new WriterOutputStream(getWrapper().getWriter(),
  +                                              getCharacterEncoding());
  +            }
  +        }
  +        public boolean containsField(String name)
  +        {throw new UnsupportedOperationException();}
  +        public Enumeration getFieldNames()
  +        {throw new UnsupportedOperationException();}
  +        public Enumeration getFieldValues(String name)
  +        {throw new UnsupportedOperationException();}
  +        public Enumeration getFieldValues(String name, String separators)
  +        {throw new UnsupportedOperationException();}
  +        
  +        public String getField(String name)
  +        {throw new UnsupportedOperationException();}
  +        public int getIntField(String name)
  +        {throw new UnsupportedOperationException();}
  +        public long getDateField(String name)
  +        {throw new UnsupportedOperationException();}
  +
  +        
  +        public String setField(String name, String value)
  +        {((HttpServletResponse)getWrapper()).setHeader(name,value);return null;}
  +        public void setField(String name, List values){throw new 
UnsupportedOperationException();}
  +        public void setIntField(String name, int value)
  +        {((HttpServletResponse)getWrapper()).setIntHeader(name,value);}
  +        public void setDateField(String name, long date)
  +        {((HttpServletResponse)getWrapper()).setDateHeader(name,date);}
  +        
  +        public void addField(String name, String value)
  +        {((HttpServletResponse)getWrapper()).addHeader(name,value);}
  +        public void addIntField(String name, int value)
  +        {((HttpServletResponse)getWrapper()).addIntHeader(name,value);}
  +        public void addDateField(String name, long date)
  +        {((HttpServletResponse)getWrapper()).addDateHeader(name,date);}
  +        
  +        public String removeField(String name){throw new 
UnsupportedOperationException();}
  +        
  +        public String getContentType(){throw new UnsupportedOperationException();}
  +        public void setContentType(String type){getWrapper().setContentType(type);}
  +        public int getContentLength(){throw new UnsupportedOperationException();}
  +        public void setContentLength(int len){getWrapper().setContentLength(len);}
  +        public String getCharacterEncoding(){return 
getWrapper().getCharacterEncoding();}
  +        public void setCharacterEncoding(String encoding){throw new 
UnsupportedOperationException();}
  +        
  +        public Object getAttribute(String name){throw new 
UnsupportedOperationException();}
  +        public Object setAttribute(String name, Object attribute){throw new 
UnsupportedOperationException();}
  +        public Enumeration getAttributeNames(){throw new 
UnsupportedOperationException();}
  +        public void removeAttribute(String name){throw new 
UnsupportedOperationException();}
  +    }
  +
  +    
       /* ------------------------------------------------------------ */
       /** Unwrap a ServletResponse.
        *
  
  
  
  1.3       +0 -0      contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletIn.java
  
  Index: ServletIn.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletIn.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServletIn.java    10 Feb 2002 17:57:44 -0000      1.2
  +++ ServletIn.java    20 Feb 2002 05:33:44 -0000      1.3
  @@ -1,6 +1,6 @@
   // ========================================================================
   // Copyright (c) 2000 Mort Bay Consulting (Australia) Pty. Ltd.
  -// $Id: ServletIn.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: ServletIn.java,v 1.3 2002/02/20 05:33:44 janb Exp $
   // ========================================================================
   
   package org.mortbay.jetty.servlet;
  
  
  
  1.3       +0 -0      contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletOut.java
  
  Index: ServletOut.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletOut.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServletOut.java   10 Feb 2002 17:57:44 -0000      1.2
  +++ ServletOut.java   20 Feb 2002 05:33:44 -0000      1.3
  @@ -1,6 +1,6 @@
   // ========================================================================
   // Copyright (c) 2000 Mort Bay Consulting (Australia) Pty. Ltd.
  -// $Id: ServletOut.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: ServletOut.java,v 1.3 2002/02/20 05:33:44 janb Exp $
   // ========================================================================
   
   package org.mortbay.jetty.servlet;
  
  
  
  1.3       +0 -0      contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletSSL.java
  
  Index: ServletSSL.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletSSL.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServletSSL.java   10 Feb 2002 17:57:44 -0000      1.2
  +++ ServletSSL.java   20 Feb 2002 05:33:44 -0000      1.3
  @@ -1,6 +1,6 @@
   // ========================================================================
   // Copyright (c) 2001 Mort Bay Consulting (Australia) Pty. Ltd.
  -// $Id: ServletSSL.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: ServletSSL.java,v 1.3 2002/02/20 05:33:44 janb Exp $
   // ========================================================================
   
   package org.mortbay.jetty.servlet;
  @@ -12,7 +12,7 @@
    *
    * <p> Used by the SSL listener classes.
    *
  - * @version $Id: ServletSSL.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  + * @version $Id: ServletSSL.java,v 1.3 2002/02/20 05:33:44 janb Exp $
    * @author Brett Sealey
    */
   public class ServletSSL
  
  
  
  1.3       +0 -0      
contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletWriter.java
  
  Index: ServletWriter.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/ServletWriter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServletWriter.java        10 Feb 2002 17:57:44 -0000      1.2
  +++ ServletWriter.java        20 Feb 2002 05:33:44 -0000      1.3
  @@ -1,6 +1,6 @@
   // ========================================================================
   // Copyright (c) 2000 Mort Bay Consulting (Australia) Pty. Ltd.
  -// $Id: ServletWriter.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: ServletWriter.java,v 1.3 2002/02/20 05:33:44 janb Exp $
   // ========================================================================
   
   package org.mortbay.jetty.servlet;
  @@ -21,7 +21,7 @@
    * This writer can be disabled.
    * It is crying out for optimization.
    *
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    * @author Greg Wilkins (gregw)
    */
   class ServletWriter extends PrintWriter
  
  
  
  1.3       +0 -0      
contrib/jetty/src/main/org/mortbay/jetty/servlet/SessionContext.java
  
  Index: SessionContext.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/SessionContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SessionContext.java       10 Feb 2002 17:57:44 -0000      1.2
  +++ SessionContext.java       20 Feb 2002 05:33:44 -0000      1.3
  @@ -1,6 +1,6 @@
   // ===========================================================================
   // Copyright (c) 1996 Mort Bay Consulting Pty. Ltd. All rights reserved.
  -// $Id: SessionContext.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: SessionContext.java,v 1.3 2002/02/20 05:33:44 janb Exp $
   // ---------------------------------------------------------------------------
   
   package org.mortbay.jetty.servlet;
  @@ -12,7 +12,7 @@
   /* ------------------------------------------------------------ */
   /** 
    * Null returning implementation of HttpSessionContext
  - * @version $Id: SessionContext.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  + * @version $Id: SessionContext.java,v 1.3 2002/02/20 05:33:44 janb Exp $
    * @author Greg Wilkins (gregw)
    */
   public class SessionContext implements HttpSessionContext
  
  
  
  1.3       +0 -0      
contrib/jetty/src/main/org/mortbay/jetty/servlet/SessionManager.java
  
  Index: SessionManager.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/SessionManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SessionManager.java       10 Feb 2002 17:57:44 -0000      1.2
  +++ SessionManager.java       20 Feb 2002 05:33:44 -0000      1.3
  @@ -1,6 +1,6 @@
   // ===========================================================================
   // Copyright (c) 1996 Mort Bay Consulting Pty. Ltd. All rights reserved.
  -// $Id: SessionManager.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: SessionManager.java,v 1.3 2002/02/20 05:33:44 janb Exp $
   // ---------------------------------------------------------------------------
   
   package org.mortbay.jetty.servlet;
  @@ -13,7 +13,7 @@
   /* --------------------------------------------------------------------- */
   /**
    *
  - * @version $Id: SessionManager.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  + * @version $Id: SessionManager.java,v 1.3 2002/02/20 05:33:44 janb Exp $
    * @author Greg Wilkins
    */
   public interface SessionManager extends LifeCycle
  
  
  
  1.3       +42 -125   
contrib/jetty/src/main/org/mortbay/jetty/servlet/WebApplicationContext.java
  
  Index: WebApplicationContext.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/servlet/WebApplicationContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WebApplicationContext.java        10 Feb 2002 17:57:44 -0000      1.2
  +++ WebApplicationContext.java        20 Feb 2002 05:33:44 -0000      1.3
  @@ -1,6 +1,6 @@
   // ========================================================================
   // Copyright (c) 2000 Mort Bay Consulting (Australia) Pty. Ltd.
  -// $Id: WebApplicationContext.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  +// $Id: WebApplicationContext.java,v 1.3 2002/02/20 05:33:44 janb Exp $
   // ========================================================================
   
   package org.mortbay.jetty.servlet;
  @@ -69,7 +69,11 @@
    * after the servlet handler within the context.
    * </UL>
    *
  - * @version $Id: WebApplicationContext.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
  + * If a file named web-jetty.xml or jetty-web.xml is found in the
  + * WEB-INF directory it is applied to the context using the
  + * XmlConfiguration format.
  + *
  + * @version $Id: WebApplicationContext.java,v 1.3 2002/02/20 05:33:44 janb Exp $
    * @author Greg Wilkins (gregw)
    */
   public class WebApplicationContext extends ServletHttpContext
  @@ -86,34 +90,14 @@
       private ResourceHandler _resourceHandler;
       private Map _tagLibMap=new HashMap(3);
       private String _deploymentDescriptor;
  -    private String _defaultsDescriptor;
  +    private String _defaultsDescriptor="org/mortbay/jetty/servlet/webdefault.xml";
       private String _war;
       private boolean _extract;
  -    private XmlParser _xmlParser;
       private ArrayList _contextListeners;
       private ArrayList _contextAttributeListeners;
       private Set _warnings;
       
       /* ------------------------------------------------------------ */
  -    /** Constructor.
  -     * This constructor should be used if the XmlParser needs to be
  -     * customized before initialization of the web application.
  -     * The XmlParser can be customized with the addition of observers
  -     * for specific tag types (eg ejb-ref).
  -     * @param httpServer The HttpServer for this context
  -     * @param contextPathSpec The context path spec. Which must be of
  -     * the form / or /path/* 
  -     * @deprecated                      
  -     */
  -    protected WebApplicationContext(HttpServer httpServer,
  -                                 String contextPathSpec)
  -    {
  -        super(httpServer,contextPathSpec);
  -        _xmlParser= new XmlParser();
  -        Code.warning("DEPRECATED CONSTRUCTOR");
  -    }
  -
  -    /* ------------------------------------------------------------ */
       /** Constructor. 
        * @param httpServer The HttpServer for this context
        * @param contextPathSpec The context path spec. Which must be of
  @@ -124,67 +108,15 @@
        * Normally this is passed the file $JETTY_HOME/etc/webdefault.xml
        * @exception IOException 
        */
  -    WebApplicationContext(HttpServer httpServer,
  -                          String contextPathSpec,
  -                          String webApp,
  -                          String defaults)
  -        throws IOException
  -    {
  -        super(httpServer,contextPathSpec);
  -        _xmlParser= new XmlParser();
  -        initialize(webApp,defaults,false);
  -    }
  -    
  -    /* ------------------------------------------------------------ */
  -    /** Constructor. 
  -     * @param httpServer The HttpServer for this context
  -     * @param contextPathSpec The context path spec. Which must be of
  -     * the form / or /path/*
  -     * @param webApp The Web application directory or WAR file.
  -     * @param defaults The defaults xml filename or URL which is
  -     * loaded before any in the web app. Must respect the web.dtd.
  -     * Normally this is passed the file $JETTY_HOME/etc/webdefault.xml
  -     * @param extractWar If true, WAR files are extracted to a
  -     * temporary directory.
  -     * @exception IOException 
  -     */
       public WebApplicationContext(HttpServer httpServer,
                                    String contextPathSpec,
  -                                 String webApp,
  -                                 String defaults,
  -                                 boolean extractWar)
  +                                 String webApp)
           throws IOException
       {
           super(httpServer,contextPathSpec);
  -        _xmlParser= new XmlParser();
  -        initialize(webApp,defaults,extractWar);
  -    }
  -    
  -    /* ------------------------------------------------------------ */
  -    /** Initialize.
  -     * This method can be called directly if the null constructor was
  -     * used. This style of construction allows the XmlParser to be
  -     * configured with observers before initialization.
  -     * @param webApp The Web application directory or WAR file.
  -     * @param defaults The defaults xml filename or URL which is
  -     * loaded before any in the web app. Must respect the web.dtd.
  -     * Normally this is passed the file $JETTY_HOME/etc/webdefault.xml
  -     * @param extractWar If true, WAR files are extracted to a
  -     * temporary directory.
  -     * @exception IOException 
  -     */
  -    public void initialize(String webApp,
  -                           String defaults,
  -                           boolean extractWar)
  -        throws IOException
  -    {
           _war=webApp;
  -        _defaultsDescriptor=defaults;
  -        _extract=extractWar;
  -        _webApp=null;
  -        resolveWebApp();
       }
  -
  +    
   
       /* ------------------------------------------------------------ */
       private void resolveWebApp()
  @@ -238,7 +170,7 @@
           throws Exception
       {
           // Get parser
  -        XmlParser xmlParser=_xmlParser==null?(new XmlParser()):_xmlParser;
  +        XmlParser xmlParser=new XmlParser();
           
           Resource 
dtd22=Resource.newSystemResource("/javax/servlet/resources/web-app_2_2.dtd");
           Resource 
dtd23=Resource.newSystemResource("/javax/servlet/resources/web-app_2_3.dtd");
  @@ -246,7 +178,7 @@
           xmlParser.redirectEntity("-//Sun Microsystems, Inc.//DTD Web Application 
2.2//EN",dtd22);
           xmlParser.redirectEntity("web.dtd",dtd23);
           xmlParser.redirectEntity("web-app_2_3.dtd",dtd23);
  -        xmlParser.redirectEntity("-//Sun Microsystems, Inc.//DTD Web Application 
2.3//EN",dtd22);
  +        xmlParser.redirectEntity("-//Sun Microsystems, Inc.//DTD Web Application 
2.3//EN",dtd23);
   
           // Find the webapp
           resolveWebApp();
  @@ -320,7 +252,10 @@
           {
               if (_defaultsDescriptor!=null && _defaultsDescriptor.length()>0)
               {
  -                Resource dftResource= Resource.newResource(_defaultsDescriptor);
  +                Resource dftResource= 
Resource.newSystemResource(_defaultsDescriptor);
  +                if (dftResource==null)
  +                    dftResource= Resource.newResource(_defaultsDescriptor);
  +                
                   _defaultsDescriptor=dftResource.toString();
                   XmlParser.Node defaultConfig =
                       xmlParser.parse(dftResource.getURL().toString());
  @@ -381,6 +316,8 @@
   
               // do jetty.xml file
               Resource jetty = _webInf.addPath("web-jetty.xml");
  +            if (!jetty.exists())
  +                jetty = _webInf.addPath("jetty-web.xml");
               if (jetty.exists())
               {
                   try
  @@ -496,44 +433,6 @@
       }
   
       /* ------------------------------------------------------------ */
  -    /** Get the complete file classpath of webapplication.
  -     * This method makes a best effort to return a complete file
  -     * classpath for the context.  The default implementation returns
  -     * <PRE>
  -     *  ((ContextLoader)getClassLoader()).getFileClassPath()+
  -     *       System.getProperty("path.separator")+
  -     *       System.getProperty("java.class.path");
  -     * </PRE>
  -     * The default implementation requires the classloader to be
  -     * initialized before it is called. It will not include any
  -     * classpaths used by a non-system parent classloader.
  -     * <P>
  -     * The main user of this method is the start() method.  If a JSP
  -     * servlet is detected, the string returned from this method is
  -     * used as the default value for the "classpath" init parameter.
  -     * <P>
  -     * Derivations may replace this method with a more accurate or
  -     * specialized version.
  -     * @return Path of files and directories for loading classes.
  -     * @exception IllegalStateException HttpContext.initClassLoader
  -     * has not been called.
  -     */
  -    public String getFileClassPath()
  -        throws IllegalStateException
  -    {
  -        ClassLoader loader = getClassLoader();
  -        if (loader==null)
  -            throw new IllegalStateException("Context classloader not initialized");
  -        String fileClassPath =
  -            ((loader instanceof ContextLoader)
  -             ? ((ContextLoader)loader).getFileClassPath()
  -             : getClassPath())+
  -            System.getProperty("path.separator")+
  -            System.getProperty("java.class.path");
  -        return fileClassPath;
  -    }
  -    
  -    /* ------------------------------------------------------------ */
       public synchronized void addEventListener(EventListener listener)
           throws IllegalArgumentException
       {
  @@ -620,12 +519,6 @@
       }
       
       /* ------------------------------------------------------------ */
  -    public XmlParser getXmlParser()
  -    {
  -        return _xmlParser;
  -    }
  -
  -    /* ------------------------------------------------------------ */
       public String getDisplayName()
       {
           return _name;
  @@ -639,6 +532,13 @@
       
       
       /* ------------------------------------------------------------ */
  +    /** Set the defaults web.xml file.
  +     * The default web.xml is used to configure all webapplications
  +     * before the WEB-INF/web.xml file is applied.  By default the
  +     * org/mortbay/jetty/servlet/webdefault.xml resource from the
  +     * org.mortbay.jetty.jar is used.
  +     * @param defaults File, Resource, URL or null.
  +     */
       public void setDefaultsDescriptor(String defaults)
       {
           if (isStarted())
  @@ -653,6 +553,9 @@
       }
       
       /* ------------------------------------------------------------ */
  +    /** 
  +     * @param war Filename or URL of the web application directory or WAR file. 
  +     */
       public void setWAR(String war)
       {
           if (isStarted())
  @@ -667,6 +570,10 @@
       }
       
       /* ------------------------------------------------------------ */
  +    /** 
  +     * @param extract If true, a WAR is extracted to a temporary
  +     * directory before being deployed. 
  +     */
       public void setExtractWAR(boolean extract)
       {
           if (isStarted())
  @@ -830,7 +737,10 @@
       
       /* ------------------------------------------------------------ */
       private void initServlet(XmlParser.Node node)
  -        throws ClassNotFoundException, UnavailableException
  +        throws ClassNotFoundException,
  +               UnavailableException,
  +               IOException,
  +               MalformedURLException
       {
           String name=node.getString("servlet-name",false,true);
           String className=node.getString("servlet-class",false,true);
  @@ -852,6 +762,13 @@
               name=className;
           
           ServletHolder holder = 
_servletHandler.newServletHolder(name,className,jspFile);
  +
  +        // handle JSP classpath
  +        if (jspFile!=null)
  +        {
  +            initClassLoader();
  +            holder.setInitParameter("classpath",getFileClassPath());
  +        }
           
           Iterator iter= node.iterator("init-param");
           while(iter.hasNext())
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to