tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@hyperreal.org
Subject cvs commit: jakarta-tomcat/src/webpages/WEB-INF web.xml
Date Thu, 28 Oct 1999 05:15:36 GMT
costin      99/10/27 22:15:36

  Modified:    src/share/org/apache/tomcat/core
                        BufferedServletOutputStream.java
                        ContextManager.java Request.java
                        RequestAdapter.java RequestAdapterImpl.java
                        RequestUtil.java Response.java ServletWrapper.java
               src/share/org/apache/tomcat/server ConnectionHandler.java
                        ServerRequest.java ServerResponse.java
                        ServletInputStreamImpl.java
               src/share/org/apache/tomcat/service
                        Ajp11ConnectionHandler.java
                        Ajp22ConnectionHandler.java
               src/share/org/apache/tomcat/service/connector
                        Ajp23ConnectionHandler.java ConnectorRequest.java
                        ConnectorResponse.java DoorConnectionHandler.java
               src/share/org/apache/tomcat/service/http
                        HttpConnectionHandler.java HttpResponse.java
                        HttpServletOS.java
               src/tests/share/tests/file WelcomeFileTest.java
               src/tests/share/tests/request post.properties
               src/webpages/WEB-INF web.xml
  Added:       src/share/org/apache/tomcat/core ResponseAdapter.java
  Removed:     src/share/org/apache/tomcat/core ResponseImpl.java
  Log:
  A lot of changes related with the new Request/Response interfaces.
  - RequestImpl/ResponseImpl no longer exist ( code moved in Request/Response)
  - Request uses RequestAdapter to get request info.
  - All existing adapters use/implement RequestAdapter
  - It should be possible to remove all remaining deps from core to server
  - The new model use "hints" ( like session Id or context path) provided
  by server adapter. I haven't "hooked" in most of the beans, I'll do it
  as soon as we have adapters that support the hints.
  
  More changes for Response adapter over the weekend.
  
  Please do a clean build, and let me know if it doesn't work ( all tests
  are passing on my machine)
  
  Revision  Changes    Path
  1.2       +5 -5      jakarta-tomcat/src/share/org/apache/tomcat/core/BufferedServletOutputStream.java
  
  Index: BufferedServletOutputStream.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/BufferedServletOutputStream.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BufferedServletOutputStream.java	1999/10/09 00:30:00	1.1
  +++ BufferedServletOutputStream.java	1999/10/28 05:15:23	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/BufferedServletOutputStream.java,v 1.1 1999/10/09 00:30:00 duncan Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/09 00:30:00 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/BufferedServletOutputStream.java,v 1.2 1999/10/28 05:15:23 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/28 05:15:23 $
    *
    * ====================================================================
    * 
  @@ -101,7 +101,7 @@
       protected int totalCount = 0;
       protected boolean committed = false;
       protected boolean closed = false;
  -    ResponseImpl response;
  +    Response response;
       
       protected BufferedServletOutputStream() {
   	//	System.out.println("new BOS " + closed);
  @@ -117,7 +117,7 @@
   	response.writeHeaders();
       }
   
  -    public void setResponse( ResponseImpl response ) {
  +    public void setResponse( Response response ) {
   	this.response=response;
       }
   
  
  
  
  1.4       +4 -4      jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java
  
  Index: ContextManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ContextManager.java	1999/10/24 17:34:01	1.3
  +++ ContextManager.java	1999/10/28 05:15:24	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v 1.3 1999/10/24 17:34:01 costin Exp $
  - * $Revision: 1.3 $
  - * $Date: 1999/10/24 17:34:01 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v 1.4 1999/10/28 05:15:24 costin Exp $
  + * $Revision: 1.4 $
  + * $Date: 1999/10/28 05:15:24 $
    *
    * ====================================================================
    *
  @@ -404,7 +404,7 @@
       /** Common for all connectors, needs to be shared in order to avoid
   	code duplication
       */
  -    public void service( Request rrequest, ResponseImpl rresponse ) {
  +    public void service( Request rrequest, Response rresponse ) {
   	try {
   	    rrequest.setResponse(rresponse);
   	    rresponse.setRequest(rrequest);
  
  
  
  1.6       +148 -98   jakarta-tomcat/src/share/org/apache/tomcat/core/Request.java
  
  Index: Request.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Request.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Request.java	1999/10/25 18:56:22	1.5
  +++ Request.java	1999/10/28 05:15:24	1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Request.java,v 1.5 1999/10/25 18:56:22 costin Exp $
  - * $Revision: 1.5 $
  - * $Date: 1999/10/25 18:56:22 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Request.java,v 1.6 1999/10/28 05:15:24 costin Exp $
  + * $Revision: 1.6 $
  + * $Date: 1999/10/28 05:15:24 $
    *
    * ====================================================================
    *
  @@ -81,44 +81,39 @@
    * @author Harish Prabandham
    */
   public class Request  {
  -    // RequestAdapterImpl
  -    protected String scheme = Constants.Request.HTTP;
  -    protected String method;
  +    // XXX used by forward to override, need a better
  +    // mechanism
       protected String requestURI;
  -    protected String protocol;
  -    protected MimeHeaders headers = new MimeHeaders();
  -    protected String serverName = "";
  -    protected int serverPort;
  -    protected String remoteAddr;
  -    protected String remoteHost;
  -    protected ServletInputStream in;
  -    // End RequestAdapterImpl
  -
  -
  -    //  RequestAdapterImpl Hints
  +    protected String queryString;
  + 
  +   //  RequestAdapterImpl Hints
  +    String serverName;
       protected Vector cookies = new Vector();
   
       protected String contextPath;
       protected String lookupPath;
       protected String servletPath;
       protected String pathInfo;
  -    protected String queryString;
       
       protected Hashtable parameters = new Hashtable();
       protected String reqSessionId;
       protected int contentLength = -1;
  -    protected String contentType = "";
  +    protected String contentType = null;
       protected String charEncoding = null;
       protected String authType;
       protected String remoteUser;
   
       // Request 
  +    protected RequestAdapter reqA;
       protected Response response;
       protected HttpServletRequestFacade requestFacade;
       protected Context context;
       protected Hashtable attributes = new Hashtable();
       protected ServerSession serverSession;
  +
       protected boolean didReadFormData;
  +    protected boolean didParameters;
  +    protected boolean didCookies;
       // end "Request" variables    
   
       protected StringManager sm =
  @@ -127,68 +122,95 @@
       public Request() {
           requestFacade = new HttpServletRequestFacade(this);
       }
  -
  +    
  +    public void setRequestAdapter( RequestAdapter reqA) {
  +	this.reqA=reqA;
  +    }
  +    
       // Begin Adapter
       public String getScheme() {
  -        return scheme;
  +        return reqA.getScheme();
       }
       
       public String getMethod() {
  -        return method;
  +        return reqA.getMethod();
       }
       
       public String getRequestURI() {
  -        return requestURI;
  +        if( requestURI!=null) return requestURI;
  +	return reqA.getRequestURI();
  +    }
  +
  +    // XXX used by forward
  +    public String getQueryString() {
  +	if( queryString != null ) return queryString;
  +        return reqA.getQueryString();
       }
       
       public String getProtocol() {
  -        return protocol;
  +        return reqA.getProtocol();
       }
       
       public String getHeader(String name) {
  -        return headers.getHeader(name);
  +        return reqA.getHeader(name);
       }
   
       public Enumeration getHeaderNames() {
  -        return headers.names();
  +        return reqA.getHeaderNames();
       }
       
       public ServletInputStream getInputStream()
  -    throws IOException {
  -    	if (in == null) {
  -            String msg = sm.getString("serverRequest.inputStream.npe");
  -
  -    	    throw new IOException(msg);
  -    	}
  -
  -    	return in;    
  +	throws IOException {
  +	return reqA.getInputStream();
       }
   
  +    // XXX server IP and/or Host:
       public String getServerName() {
  +	if(serverName!=null) return serverName;
  +	serverName=reqA.getServerName();
  +	if(serverName!=null) return serverName;
  +
  +	String hostHeader = this.getHeader("host");
  +	if (hostHeader != null) {
  +	    int i = hostHeader.indexOf(':');
  +	    if (i > -1) {
  +		hostHeader = hostHeader.substring(0,i);
  +	    }
  +	    serverName=hostHeader;
  +	    return serverName;
  +	}
  +	// default to localhost - and warn
  +	System.out.println("No server name, defaulting to localhost");
  +	serverName="localhost";
   	return serverName;
       }
   
       public int getServerPort() {
  -        return serverPort;
  +        return reqA.getServerPort();
       }
       
       public String getRemoteAddr() {
  -        return remoteAddr;
  +        return reqA.getRemoteAddr();
       }
       
       public String getRemoteHost() {
  -	return remoteHost;
  +	return reqA.getRemoteHost();
       }    
       
  -    // End Adapter
  +    // End Adapter "required" fields
   
  -    // Adapter hints
       public String getLookupPath() {
   	return lookupPath;
       }
       
   
       public String[] getParameterValues(String name) {
  +	if(!didParameters) {
  +	    String qString=getQueryString();
  +	    if(qString!=null) {
  +		processFormData(qString);
  +	    }
  +	}
   	if (!didReadFormData) {
   	    readFormData();
   	}
  @@ -197,6 +219,9 @@
       }
       
       public Enumeration getParameterNames() {
  +	if(!didParameters) {
  +	    processFormData(getQueryString());
  +	}
   	if (!didReadFormData) {
   	    readFormData();
   	}
  @@ -210,15 +235,30 @@
       }
       
       public String getCharacterEncoding() {
  -        return charEncoding;
  +        if(charEncoding!=null) return charEncoding;
  +	charEncoding=reqA.getCharacterEncoding();
  +	if(charEncoding!=null) return charEncoding;
  +	
  +        charEncoding = getCharsetFromContentType(getContentType());
  +	return charEncoding;
       }
   
       public int getContentLength() {
  -        return contentLength;
  +        if( contentLength > -1 ) return contentLength;
  +	contentLength = reqA.getContentLength();
  +	if( contentLength > -1 ) return contentLength;
  +	contentLength = getIntHeader("content-length");
  +	return contentLength;
       }
       
       public String getContentType() {
  -    	return contentType;   
  +	if(contentType != null) return contentType;   
  +	contentType= reqA.getContentType();
  +	if(contentType != null) return contentType;
  +	contentType = getHeader("content-type");
  +	if(contentType != null) return contentType;
  +	// can be null!! - 
  +	return contentType;
       }
       
       
  @@ -226,10 +266,6 @@
           return pathInfo;
       }
       
  -    public String getQueryString() {
  -        return queryString;
  -    }
  -
       public String getRemoteUser() {
           return remoteUser;
       }
  @@ -257,12 +293,13 @@
       public void setResponse(Response response) {
   	this.response = response;
       }
  -
  +    
       // Called after a Context is found, adjust all other paths.
       // XXX XXX XXX
       public void setContext(Context context) {
   	this.context = context;
   	contextPath = context.getPath();
  +	String requestURI = getRequestURI();
   	lookupPath = requestURI.substring(contextPath.length(),
               requestURI.length());
   
  @@ -272,7 +309,7 @@
   	if (qindex > -1) {
   	    lookupPath = lookupPath.substring(0, qindex);
   	}
  -
  +	
   	if (lookupPath.length() < 1) {
   	    lookupPath = "/";
   	}
  @@ -281,6 +318,13 @@
   
       public Cookie[] getCookies() {
   	// XXX need to use Cookie[], Vector is not needed
  +	if( ! didCookies ) {
  +	    // XXX need a better test
  +	    // XXX need to use adapter for hings
  +	    didCookies=true;
  +	    processCookies();
  +	}
  +	
   	Cookie[] cookieArray = new Cookie[cookies.size()];
   	
   	for (int i = 0; i < cookies.size(); i ++) {
  @@ -340,45 +384,46 @@
       }
   
       // -------------------- Setters
  -    public void setURI(String requestURI) {
  -        this.requestURI = requestURI;
  -    }
  -
  -
  -    public void setHeaders( MimeHeaders h ) {
  -	headers=h;
  -    }
  -
  -    public void setServletInputStream( ServletInputStream in ) {
  -	this.in=in;
  -    }
  -
  -    public void setServerPort( int port ) {
  -	serverPort=port;
  -    }
  -    
  -    public void setRemoteAddress(String addr) {
  -	this.remoteAddr = addr;
  -    }
  -
  -    public void setRemoteHost( String host ) {
  -	this.remoteHost=host;
  -    }
  -
  -    public void setMethod( String meth ) {
  -	this.method=meth;
  -    }
  -
  -    public void setProtocol( String protocol ) {
  -	this.protocol=protocol;
  -    }
  +//     public void setURI(String requestURI) {
  +//         this.requestURI = requestURI;
  +//     }
  +
  +
  +//     public void setHeaders( MimeHeaders h ) {
  +// 	headers=h;
  +//     }
  +
  +//     public void setServletInputStream( ServletInputStream in ) {
  +// 	this.in=in;
  +//     }
  +
  +//     public void setServerPort( int port ) {
  +// 	serverPort=port;
  +//     }
  +    
  +//     public void setRemoteAddress(String addr) {
  +// 	this.remoteAddr = addr;
  +//     }
  +
  +//     public void setRemoteHost( String host ) {
  +// 	this.remoteHost=host;
  +//     }
  +
  +//     public void setMethod( String meth ) {
  +// 	this.method=meth;
  +//     }
  +
  +//     public void setProtocol( String protocol ) {
  +// 	this.protocol=protocol;
  +//     }
   
       public void setRequestURI( String r ) {
  -	this.requestURI=r;
  + 	this.requestURI=r;
       }
   
       public void setParameters( Hashtable h ) {
   	this.parameters=h;
  +	// XXX Should we override query parameters ??
       }
           
       public void setContentLength( int  len ) {
  @@ -404,13 +449,16 @@
       public void setPathInfo(String pathInfo) {
           this.pathInfo = pathInfo;
       }
  +
  +    /** Set query string - will be called by forward
  +     */
       public void setQueryString(String queryString) {
  -        this.queryString = queryString;
  +	this.queryString = queryString;
       }
       
  -    public void setScheme(String scheme) {
  -        this.scheme = scheme;
  -    }
  +//     public void setScheme(String scheme) {
  +//         this.scheme = scheme;
  +//     }
       
       public void setRequestedSessionId(String reqSessionId) {
   	this.reqSessionId = reqSessionId;
  @@ -428,7 +476,8 @@
       // XXX
       // the server name should be pulled from a server object of some
       // sort, not just set and got.
  -    
  +
  +    /** Virtual host */
       public void setServerName(String serverName) {
   	this.serverName = serverName;
       }
  @@ -453,16 +502,16 @@
   
       // -------------------- Facade for MimeHeaders
       public long getDateHeader(String name) {
  -        return headers.getDateHeader(name);
  +	return reqA.getMimeHeaders().getDateHeader(name);
       }
       
       public Enumeration getHeaders(String name) {
  -        Vector v = this.headers.getHeadersVector(name);
  +	Vector v = reqA.getMimeHeaders().getHeadersVector(name);
   	return v.elements();
       }
       
       public int getIntHeader(String name)  {
  -        return headers.getIntHeader(name);
  +        return reqA.getMimeHeaders().getIntHeader(name);
       }
       
       // -------------------- Utils - facade for RequestUtil
  @@ -474,6 +523,9 @@
       
       private void readFormData() {
   	didReadFormData = true;
  +	if(!didParameters) {
  +	    processFormData(getQueryString());
  +	}
   
   	Hashtable postParameters=RequestUtil.readFormData( this );
   	if(postParameters!=null)
  @@ -490,6 +542,7 @@
       // well together. FIX
       
       public void processFormData(String data) {
  +	didParameters=true;
   	RequestUtil.processFormData( data, parameters );
       }
   
  @@ -524,26 +577,23 @@
   
       public void recycle() {
   	response = null;
  -	scheme = Constants.Request.HTTP;
   	context = null;
           attributes.clear();
           parameters.clear();
           cookies.removeAllElements();
  -        method = null;
  -	protocol = null;
  -        requestURI = null;
  -        queryString = null;
  +	//        requestURI = null;
  +	//        queryString = null;
           contentLength = -1;
  -        contentType = "";
  +        contentType = null;
           charEncoding = null;
           authType = null;
           remoteUser = null;
           reqSessionId = null;
   	serverSession = null;
  +	didParameters = false;
   	didReadFormData = false;
  +	didCookies = false;
  +	if( reqA!=null) reqA.recycle();// XXX avoid double recycle
   	//	moreRequests = false;
  -	in = null;
  -    	headers.clear();
  -	serverName = "";
       }
   }
  
  
  
  1.2       +21 -9     jakarta-tomcat/src/share/org/apache/tomcat/core/RequestAdapter.java
  
  Index: RequestAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestAdapter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RequestAdapter.java	1999/10/24 17:21:20	1.1
  +++ RequestAdapter.java	1999/10/28 05:15:24	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestAdapter.java,v 1.1 1999/10/24 17:21:20 costin Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/24 17:21:20 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestAdapter.java,v 1.2 1999/10/28 05:15:24 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/28 05:15:24 $
    *
    * ====================================================================
    *
  @@ -93,17 +93,32 @@
       public String getScheme();
       
       public String getMethod();
  -    
  +
       public String getRequestURI();
   
  +    public String getQueryString();
  +
       public String getProtocol();
       
  +    // XXX temporary - to keep everything working
  +    public MimeHeaders getMimeHeaders();
  +    
       public  Enumeration getHeaderNames();
   
       public  String getHeader(String name);
  -    
  +
  +    /** You can either provide an implementation of ServletInputStream or
  +	return BufferedServletInputStream( RequsetAdapter ), and implement
  +	doRead();
  +     */
       public  ServletInputStream getInputStream() throws IOException;
  -    
  +
  +    /** Fill in the buffer. This method is probably easier to implement than
  +	previous.
  +	This method should only be called from SerlvetInputStream implementations.
  +	No need to implement it if your adapter implements ServletInputStream.
  +     */
  +    public  int doRead( byte b[], int off, int len ) throws IOException;
   
       // Required - connection info 
       public String getServerName();
  @@ -138,8 +153,6 @@
       // What's after Servlet name, before "?"
       public String getPathInfo();
   
  -    public String getQueryString();
  -
       // Parameters - if the server can parse parameters faster
       // Note: there is a tricky requirement in Servlet API
       // regarding POST parameters ( you can't read the body until you are
  @@ -170,6 +183,5 @@
       
       public String getContentType();
   
  -    // You're no longer needed, go away
       public  void recycle(); 
   }
  
  
  
  1.3       +20 -12    jakarta-tomcat/src/share/org/apache/tomcat/core/RequestAdapterImpl.java
  
  Index: RequestAdapterImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestAdapterImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RequestAdapterImpl.java	1999/10/25 18:56:22	1.2
  +++ RequestAdapterImpl.java	1999/10/28 05:15:24	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestAdapterImpl.java,v 1.2 1999/10/25 18:56:22 costin Exp $
  - * $Revision: 1.2 $
  - * $Date: 1999/10/25 18:56:22 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestAdapterImpl.java,v 1.3 1999/10/28 05:15:24 costin Exp $
  + * $Revision: 1.3 $
  + * $Date: 1999/10/28 05:15:24 $
    *
    * ====================================================================
    *
  @@ -78,12 +78,13 @@
       protected String scheme;
       protected String method;
       protected String requestURI;
  +    protected String queryString;
       protected String protocol;
       protected MimeHeaders headers;
  -    ServletInputStream in;
  +    protected ServletInputStream in;
       
  -    String serverName;
  -    int serverPort;
  +    protected String serverName;
  +    protected int serverPort;
       protected String remoteAddr;
       protected String remoteHost;
   
  @@ -95,8 +96,7 @@
       protected String lookupPath;
       protected String servletPath;
       protected String pathInfo;
  -    protected String queryString;
  -    
  +
       protected Hashtable parameters;
       protected String reqSessionId;
       protected int contentLength;
  @@ -131,10 +131,18 @@
           return requestURI;
       }
       
  +    public String getQueryString() {
  +	return queryString;
  +    }
  +
       public String getProtocol() {
           return protocol;
       }
       
  +    public MimeHeaders getMimeHeaders() {
  +	return headers;
  +    }
  +    
       public String getHeader(String name) {
           return headers.getHeader(name);
       }
  @@ -163,6 +171,10 @@
       public String getRemoteHost() {
   	return remoteHost;
       }    
  +
  +    public  int doRead( byte b[], int off, int len ) throws IOException {
  +	return -1; // not implemented - implement getInputStream 
  +    }
       
       // -------------------- "cooked" info --------------------
       // Hints = return null if you don't know,
  @@ -194,10 +206,6 @@
   
       // What's after Servlet name, before "?"
       public String getPathInfo() {
  -	return null;
  -    }
  -
  -    public String getQueryString() {
   	return null;
       }
   
  
  
  
  1.2       +4 -3      jakarta-tomcat/src/share/org/apache/tomcat/core/RequestUtil.java
  
  Index: RequestUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestUtil.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RequestUtil.java	1999/10/24 16:53:19	1.1
  +++ RequestUtil.java	1999/10/28 05:15:25	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestUtil.java,v 1.1 1999/10/24 16:53:19 costin Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/24 16:53:19 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestUtil.java,v 1.2 1999/10/28 05:15:25 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/28 05:15:25 $
    *
    * ====================================================================
    *
  @@ -192,6 +192,7 @@
       public static void processFormData(String data, Hashtable parameters) {
           // XXX
           // there's got to be a faster way of doing this.
  +	if( data==null ) return; // no parameters
           StringTokenizer tok = new StringTokenizer(data, "&", false);
           while (tok.hasMoreTokens()) {
               String pair = tok.nextToken();
  
  
  
  1.2       +252 -32   jakarta-tomcat/src/share/org/apache/tomcat/core/Response.java
  
  Index: Response.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Response.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Response.java	1999/10/09 00:30:16	1.1
  +++ Response.java	1999/10/28 05:15:25	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Response.java,v 1.1 1999/10/09 00:30:16 duncan Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/09 00:30:16 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Response.java,v 1.2 1999/10/28 05:15:25 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/28 05:15:25 $
    *
    * ====================================================================
    *
  @@ -69,7 +69,7 @@
   import java.util.*;
   import javax.servlet.*;
   import javax.servlet.http.*;
  -
  +import org.apache.tomcat.util.*;
   /**
    * 
    * @author James Duncan Davidson [duncan@eng.sun.com]
  @@ -77,9 +77,10 @@
    * @author James Todd [gonzo@eng.sun.com]
    * @author Harish Prabandham
    */
  +public class Response {
  +    protected StringManager sm =
  +        StringManager.getManager(Constants.Package);
   
  -public abstract class Response {
  -    
       protected Request request;
       protected HttpServletResponseFacade responseFacade;
       protected Vector userCookies = new Vector();
  @@ -92,6 +93,17 @@
       protected int contentLength = -1;
       protected int status = 200; 
       private Locale locale = new Locale(Constants.Locale.Default, "");
  +
  +    protected MimeHeaders headers = new MimeHeaders();
  +    protected BufferedServletOutputStream out;
  +    protected PrintWriter writer;
  +
  +    protected boolean usingStream = false;
  +    protected boolean usingWriter = false;
  +    protected boolean started = false;
  +    protected boolean committed = false;
  +    protected boolean omitHeaders = false;
  +    protected String serverHeader = null;
       
       public Response() {
           responseFacade = new HttpServletResponseFacade(this);
  @@ -107,27 +119,255 @@
   	this.request = request;
       }
   
  -    public void reset() throws IllegalStateException {
  -	userCookies.removeAllElements();  // keep system (session) cookies
  +    public boolean isStarted() {
  +	return started;
  +    }
  +
  +    public boolean isCommitted() {
  +	return committed;
  +    }
  +
  +    public String getServerHeader() {
  +        return serverHeader;
  +    }
  +
  +    public void setServerHeader(String serverHeader) {
  +        this.serverHeader = serverHeader;
  +    }
  +
  +    public void setOmitHeaders(boolean omitHeaders) {
  +	this.omitHeaders = omitHeaders;
  +    }
  +    
  +    public void setBufferedServeletOutputStream(
  +        BufferedServletOutputStream out) {
  +	this.out=out;
  +    }
  +    
  +    public void recycle() {
  +	userCookies.removeAllElements();
  +	systemCookies.removeAllElements();
   	contentType = Constants.ContentType.Default;
           locale = new Locale(Constants.Locale.Default, "");
   	characterEncoding = System.getProperty("file.encoding",
  -            Constants.CharacterEncoding.Default);
  +					       Constants.CharacterEncoding.Default);
   	contentLength = -1;
   	status = 200;
  +	headers.clear();
  +	usingWriter = false;
  +	usingStream = false;
  +	writer=null;
  +	out = null;
  +	started = false;
  +	committed = false;
  +	omitHeaders=false;
  +    }
  +    
  +    public void finish() throws IOException {
  +	try {
  +	    if (usingWriter && (writer != null)) {
  +	        writer.flush();
  +	    }
  +	    out.reallyFlush();
  +	} catch (SocketException e) {
  +	    return;  // munch
  +	}
  +    }
  + 
  +    public boolean containsHeader(String name) {
  +	return headers.containsHeader(name);
       }
   
  -    public void recycle() {
  -	userCookies.removeAllElements();
  -	systemCookies.removeAllElements();
  +    // XXX
  +    // mark whether or not we are being used as a stream our writer
  +    
  +    public ServletOutputStream getOutputStream() {
  +	started = true;
  +
  +	if (usingWriter) {
  +	    String msg = sm.getString("serverResponse.outputStream.ise");
  +
  +	    throw new IllegalStateException(msg);
  +	}
  +
  +	usingStream = true;
  +
  +	return out;
  +    }
  +
  +    public PrintWriter getWriter() throws IOException {
  +	started = true;
  +
  +	if (usingStream) {
  +	    String msg = sm.getString("serverResponse.writer.ise");
  +
  +	    throw new IllegalStateException(msg);
  +	}
  +
  +	usingWriter = true;
  +
  +	if (writer == null) {
  +	    String encoding = getCharacterEncoding();
  +
  +	    if ((encoding == null) || "Default".equals(encoding) )
  +	        writer = new PrintWriter(new OutputStreamWriter(out));
  +	    else
  +		try {
  +		    writer = new PrintWriter(new OutputStreamWriter(out, encoding));
  +		} catch (java.io.UnsupportedEncodingException ex) {
  +		    // if we don't do that, the runtime exception will propagate
  +		    // and we'll try to send an error page - but surprise, we
  +		    // still can't get the Writer to send the error page...
  +		    writer = new PrintWriter( new OutputStreamWriter(out));
  +
  +		    // Deal with strange encodings - webmaster should see a message
  +		    // and install encoding classes - n new, unknown language was discovered,
  +		    // and they read our site!
  +		    System.out.println("Unsuported encoding: " + encoding );
  +		}
  +	}
  +
  +	out.setUsingWriter (usingWriter);
  +	
  +	return writer;
  +    }
  +    
  +    public void setDateHeader(String name, long date) {
  +	headers.putDateHeader(name, date);
  +    }
  +
  +    public void addDateHeader(String name, long date) {
  +        headers.addDateHeader(name, date);
  +    }
  +    
  +    public void setHeader(String name, String value) {
  +	headers.putHeader(name, value);
  +    }
  +
  +    public void addHeader(String name, String value) {
  +        headers.addHeader(name, value);
  +    }
  +    
  +    public void setIntHeader(String name, int value) {
  +	headers.putIntHeader(name, value);
  +    }
  +
  +    public void addIntHeader(String name, int value) {
  +        headers.addIntHeader(name, value);
  +    }
  +    
  +    public int getBufferSize() {
  +	return out.getBufferSize();
  +    }
  +    
  +    public void setBufferSize(int size) throws IllegalStateException {
  +
  +	// Force the PrintWriter to flush the data to the OutputStream.
  +	if (usingWriter == true) writer.flush();
  +	
  +	if (out.isContentWritten() == true) {
  +	    String msg = sm.getString("servletOutputStreamImpl.setbuffer.ise");
  +	    throw new IllegalStateException (msg); 
  +	}
  +	out.setBufferSize(size);
  +    }
  +    
  +    /*
  +     * Methodname "isCommitted" already taken by Response class.
  +     */
  +    public boolean isBufferCommitted() {
  +	return out.isCommitted();
  +    }
  +    
  +    public void reset() throws IllegalStateException {
  +	// Force the PrintWriter to flush its data to the output
  +        // stream before resetting the output stream
  +        //
  +	userCookies.removeAllElements();  // keep system (session) cookies
   	contentType = Constants.ContentType.Default;
           locale = new Locale(Constants.Locale.Default, "");
   	characterEncoding = System.getProperty("file.encoding",
               Constants.CharacterEncoding.Default);
   	contentLength = -1;
   	status = 200;
  +
  +	if (usingWriter == true) 
  +	    writer.flush();
  +	
  +	// Reset the stream
  +	out.reset();
  +
  +        // Clear the cookies and such
  +
  +        // Clear the headers
  +        headers.clear();
  +    }
  +    
  +    public void flushBuffer() throws IOException {
  +	if (usingWriter == true)
  +	    writer.flush();
  +	
  +	out.reallyFlush();
  +    }
  +
  +    
  +    /** Set server-specific headers */
  +    protected void fixHeaders() throws IOException {
  +	//	System.out.println( "Fixing headers" );
  +	headers.putIntHeader("Status", status);
  +        headers.putHeader("Content-Type", contentType);
  +
  +	// Generated by Server!!!
  +	//headers.putDateHeader("Date",System.currentTimeMillis());
  +        //headers.putHeader("Server",getServerHeader());
  +
  +        if (contentLength != -1) {
  +            headers.putIntHeader("Content-Length", contentLength);
  +        }
  +	
  +        // write cookies
  +        Enumeration cookieEnum = null;
  +        cookieEnum = systemCookies.elements();
  +        while (cookieEnum.hasMoreElements()) {
  +            Cookie c  = (Cookie)cookieEnum.nextElement();
  +            headers.putHeader( CookieTools.getCookieHeaderName(c),
  +			       CookieTools.getCookieHeaderValue(c));
  +	    if( c.getVersion() == 1 ) {
  +		// add a version 0 header too.
  +		// XXX what if the user set both headers??
  +		Cookie c0 = (Cookie)c.clone();
  +		c0.setVersion(0);            
  +		headers.putHeader( CookieTools.getCookieHeaderName(c0),
  +				   CookieTools.getCookieHeaderValue(c0));
  +	    }
  +        }
  +	// XXX duplicated code, ugly
  +        cookieEnum = userCookies.elements();
  +        while (cookieEnum.hasMoreElements()) {
  +            Cookie c  = (Cookie)cookieEnum.nextElement();
  +            headers.putHeader( CookieTools.getCookieHeaderName(c),
  +			       CookieTools.getCookieHeaderValue(c));
  +	    if( c.getVersion() == 1 ) {
  +		// add a version 0 header too.
  +		// XXX what if the user set both headers??
  +		Cookie c0 = (Cookie)c.clone();
  +		c0.setVersion(0);            
  +		headers.putHeader( CookieTools.getCookieHeaderName(c0),
  +				   CookieTools.getCookieHeaderValue(c0));
  +	    }
  +        }
  +	// XXX
  +        // do something with content encoding here
  +    }
  +
  +    // XXX should be abstract
  +    public void endResponse() throws IOException {
       }
   
  +    // XXX should be abstract
  +    public void writeHeaders() throws IOException {
  +    }
  +    
       public void addCookie(Cookie cookie) {
   	userCookies.addElement(cookie);
       }
  @@ -136,8 +376,6 @@
   	systemCookies.addElement(cookie);
       }
   
  -    public abstract boolean containsHeader(String name);
  -
       public Locale getLocale() {
           return locale;
       }
  @@ -179,11 +417,6 @@
   	return characterEncoding;
       }
   
  -    public abstract boolean isStarted();
  -    public abstract boolean isCommitted();
  -    public abstract ServletOutputStream getOutputStream();
  -    public abstract PrintWriter getWriter() throws IOException;
  -
       public void setContentType(String contentType) {
           this.contentType = contentType;
           setCharacterEncodingFromContentType(contentType);
  @@ -359,17 +592,4 @@
   	    out.close();
   	}
       }
  -    
  -    public abstract void setDateHeader(String name, long date);    
  -    public abstract void setHeader(String name, String value);
  -    public abstract void setIntHeader(String name, int value);
  -    public abstract void addDateHeader(String name, long date);    
  -    public abstract void addHeader(String name, String value);
  -    public abstract void addIntHeader(String name, int value);
  -
  -    public abstract int getBufferSize();
  -    public abstract void setBufferSize(int size) throws IllegalStateException;
  -    public abstract boolean isBufferCommitted();
  -    // reset() implemented above
  -    public abstract void flushBuffer() throws IOException;
   }
  
  
  
  1.4       +4 -4      jakarta-tomcat/src/share/org/apache/tomcat/core/ServletWrapper.java
  
  Index: ServletWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ServletWrapper.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ServletWrapper.java	1999/10/22 21:52:10	1.3
  +++ ServletWrapper.java	1999/10/28 05:15:26	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ServletWrapper.java,v 1.3 1999/10/22 21:52:10 costin Exp $
  - * $Revision: 1.3 $
  - * $Date: 1999/10/22 21:52:10 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ServletWrapper.java,v 1.4 1999/10/28 05:15:26 costin Exp $
  + * $Revision: 1.4 $
  + * $Date: 1999/10/28 05:15:26 $
    *
    * ====================================================================
    *
  @@ -225,7 +225,7 @@
                   Constants.JSP.Directive.Compile.Name + "=" +
                   Constants.JSP.Directive.Compile.Value;
   
  -            request.setURI(getContext().getPath() + requestURI);
  +            request.setRequestURI(getContext().getPath() + requestURI);
               request.setContext(getContext());
               request.getSession(true);
   
  
  
  
  1.1                  jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseAdapter.java
  
  Index: ResponseAdapter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseAdapter.java,v 1.1 1999/10/28 05:15:25 costin Exp $
   * $Revision: 1.1 $
   * $Date: 1999/10/28 05:15:25 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.tomcat.core;
  
  import org.apache.tomcat.util.*;
  import java.io.*;
  import java.util.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  /**
   * Low-level representation of a Response in a server adapter.
   * 
   * @author costin@eng.sun.com
   */
  public interface ResponseAdapter {
  
      public void setStatus( int status, String message);
      
      public void addHeader( String name, String value );
  
      // XXX This one or multiple addHeader?
      // Probably not a big deal - but an adapter may have
      // an optimized version for this one ( on round-trip only )
      public void addMimeHeaders(MimeHeaders headers);
  
      /** Signal that we're done with a particular request, the
  	server can go on and read more requests or close the socket
      */
      public void endResponse();
  
      /** Either implement ServletOutputStream or return BufferedServletOutputStream(this)
  	and implement doWrite();
       */
      public ServletOutputStream getServletOutputStream() throws IOException;
      
      /** Write a chunk of bytes. Should be called only from ServletOutputStream implementations,
  	No need to implement it if your adapter implements ServletOutputStream.
       */
      public void doWrite( byte buffer[], int pos, int count) throws IOException ;
  }
  
  
  
  1.2       +12 -8     jakarta-tomcat/src/share/org/apache/tomcat/server/ConnectionHandler.java
  
  Index: ConnectionHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/ConnectionHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConnectionHandler.java	1999/10/09 00:20:47	1.1
  +++ ConnectionHandler.java	1999/10/28 05:15:28	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/ConnectionHandler.java,v 1.1 1999/10/09 00:20:47 duncan Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/09 00:20:47 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/ConnectionHandler.java,v 1.2 1999/10/28 05:15:28 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/28 05:15:28 $
    *
    * ====================================================================
    *
  @@ -82,7 +82,8 @@
       protected StringManager sm =
           StringManager.getManager(Constants.Package);
       protected EndpointManager manager;
  -    protected ServerRequest request = new ServerRequest();
  +    protected Request request = new Request();
  +    protected HttpRequestAdapter reqA= new HttpRequestAdapter();
       protected ServerResponse response = new ServerResponse();
       protected Endpoint endpoint;
       protected Socket socket;
  @@ -109,6 +110,7 @@
           
       void recycle() {
           request.recycle();
  +	reqA.recycle();
           response.recycle();
           endpoint = null;
           socket = null;
  @@ -124,18 +126,20 @@
           
           try {
   	    int count = 1;
  -
  -            request.setSocket(socket);
  +	    // XXX should be in init or main ?
  +	    request.setRequestAdapter( reqA );
  +	    
  +            reqA.setSocket(socket);
               response.setSocket(socket);
   
  -            while(request.hasMoreRequests()) {
  +            while(reqA.hasMoreRequests()) {
   
   	        // XXX
                   //    bind response to request, and vice versa
   
   	        request.setResponse(response);
   	        response.setRequest(request);
  -		request.readNextRequest();
  +		reqA.readNextRequest(response);
   
   		// XXX
                   //    don't do headers if request protocol is http/0.9
  
  
  
  1.5       +10 -140   jakarta-tomcat/src/share/org/apache/tomcat/server/ServerRequest.java
  
  Index: ServerRequest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/ServerRequest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ServerRequest.java	1999/10/25 22:48:59	1.4
  +++ ServerRequest.java	1999/10/28 05:15:28	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/ServerRequest.java,v 1.4 1999/10/25 22:48:59 costin Exp $
  - * $Revision: 1.4 $
  - * $Date: 1999/10/25 22:48:59 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/ServerRequest.java,v 1.5 1999/10/28 05:15:28 costin Exp $
  + * $Revision: 1.5 $
  + * $Date: 1999/10/28 05:15:28 $
    *
    * ====================================================================
    *
  @@ -72,169 +72,39 @@
   import javax.servlet.*;
   import javax.servlet.http.*;
   
  +
   /**
  + * @deprecated Tomcat standalone doesn't use it, and nobody else should ( costin )
    *
    * @author James Duncan Davidson [duncan@eng.sun.com]
    * @author James Todd [gonzo@eng.sun.com]
    * @author Jason Hunter [jch@eng.sun.com]
    * @author Harish Prabandham
    */
  -
   public class ServerRequest extends Request {
   
       private StringManager sm =
           StringManager.getManager(Constants.Package);
  -    private Socket socket;
  -    private boolean moreRequests = false;
   
       public ServerRequest() {
           super();
  +	this.reqA=new HttpRequestAdapter();
       }
   
       void setSocket(Socket socket) {
  -        this.socket = socket;
  -    	moreRequests = true;
  +	((HttpRequestAdapter)reqA).setSocket(socket);
       }
   
       public Socket getSocket() {
  -        return this.socket;
  +        return ((HttpRequestAdapter)reqA).getSocket();
       }
   
       boolean hasMoreRequests() {
  -        return moreRequests;
  +        return ((HttpRequestAdapter)reqA).hasMoreRequests();
       }
       
       void readNextRequest() throws IOException {
  -	InputStream sin = socket.getInputStream();
  -	ServletInputStreamImpl sis = new ServletInputStreamImpl(this, sin);
  -	this.in=sis;
  -	
  -	processRequestLine(sis.readLine());
  -
  -	// XXX
  -	//    return if an error was detected in processing the
  -	//    request line
  -
  -        if (response.getStatus() >=
  -	    HttpServletResponse.SC_BAD_REQUEST) {
  -            return;
  -	}
  -
  -	// for 0.9, we don't have headers!
  -	if(protocol!=null)
  -	    headers.read(sis);
  -	processCookies();
  -
  -	contentLength = headers.getIntHeader("content-length");
  -	contentType = headers.getHeader("content-type");
  -        charEncoding = getCharsetFromContentType(contentType);
  -
  -	// XXX
  -	// detect for real whether or not we have more requests
  -	// coming
  -
  -	moreRequests = false;	
  +	((HttpRequestAdapter)reqA).readNextRequest(response);
       }    
       
  -    public int getServerPort() {
  -        return socket.getLocalPort();
  -    }
  -    
  -    public String getRemoteAddr() {
  -        return socket.getInetAddress().getHostAddress();
  -    }
  -    
  -    public String getRemoteHost() {
  -	return socket.getInetAddress().getHostName();
  -    }    
  -    
  -    public void processRequestLine(String line) {
  -        String buffer = line.trim();
  -	int firstDelim = buffer.indexOf(' ');
  -	int lastDelim = buffer.lastIndexOf(' ');
  -	// default - set it to HTTP/0.9 or null if we can parse the request
  -	//protocol = "HTTP/1.0";
  -
  -	if (firstDelim == -1 && lastDelim == -1) {
  -	    if (buffer.trim().length() > 0) {
  -	        firstDelim = buffer.trim().length();
  -		lastDelim = buffer.trim().length();
  -	    }
  -	}
  -
  -	if (firstDelim != lastDelim) {
  -	    String s = buffer.substring(firstDelim, lastDelim);
  -
  -	    if (s.trim().length() == 0) {
  -	        firstDelim = lastDelim;
  -	    }
  -	}
  -
  -	if (firstDelim != lastDelim) {
  -	    method = buffer.substring(0, firstDelim).trim();
  -	    protocol = buffer.substring(lastDelim + 1).trim();
  -	    requestURI = buffer.substring(firstDelim + 1, lastDelim).trim();
  -	} else if (firstDelim != -1 && lastDelim != -1) {
  -	    method = buffer.substring(0, firstDelim).trim();
  -	    protocol = null;
  -	    if (lastDelim < buffer.length()) {
  -	        requestURI = buffer.substring(lastDelim + 1).trim();
  -	    }
  -	}
  -
  -	if (protocol != null &&
  -	    ! protocol.toLowerCase().startsWith("http/")) {
  -	    requestURI += " " + protocol;
  -	    protocol = null;
  -	}
  -
  -        int requestErrorCode = 0; 
  -
  -	// see if request looks right
  -
  -	try {
  -	    int len = line.length();
  -
  -	    if (len < 2) {
  -	        requestErrorCode = HttpServletResponse.SC_BAD_REQUEST;
  -	    } else if (/* line.charAt(len - 2) != '\r' || Correct, but will break C clients */
  -                line.charAt(len - 1) != '\n') {
  -	        requestErrorCode =
  -		    HttpServletResponse.SC_REQUEST_URI_TOO_LONG;
  -		// XXX
  -		// For simplicity we assume there's an HTTP/1.0 on the end
  -		// We should check to be sure.
  -		protocol = "HTTP/1.0";
  -	    }
  -	} catch (StringIndexOutOfBoundsException siobe) {
  -	}
  -
  -	// see if uri is well formed
  -
  -        if (requestErrorCode == 0 &&
  -	    (requestURI == null || requestURI.indexOf(' ') > -1 ||
  -	        requestURI.indexOf('/') != 0)) {
  -	    requestErrorCode = HttpServletResponse.SC_BAD_REQUEST;
  -	}
  -
  -	if (requestErrorCode != 0) {
  -            try {
  -	        response.sendError(requestErrorCode);
  -	    } catch (IOException ioe) {
  -            }
  -
  -	    return;
  -	}
  -
  -        // get query string and
  -        // parse out the request line parameters if possible
  -        
  -        if (requestURI.indexOf("?") > -1) {
  -            queryString = requestURI.substring(
  -                requestURI.indexOf("?") + 1, requestURI.length());
  -            processFormData(queryString);
  -	    requestURI = requestURI.substring(0, requestURI.indexOf("?"));
  -        }
  -    }
  -
   }
  
  
  
  1.2       +4 -4      jakarta-tomcat/src/share/org/apache/tomcat/server/ServerResponse.java
  
  Index: ServerResponse.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/ServerResponse.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServerResponse.java	1999/10/09 00:20:48	1.1
  +++ ServerResponse.java	1999/10/28 05:15:28	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/ServerResponse.java,v 1.1 1999/10/09 00:20:48 duncan Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/09 00:20:48 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/ServerResponse.java,v 1.2 1999/10/28 05:15:28 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/28 05:15:28 $
    *
    * ====================================================================
    *
  @@ -81,7 +81,7 @@
    * @author Harish Prabandham
    */
   
  -public class ServerResponse extends ResponseImpl {
  +public class ServerResponse extends Response {
       protected StringManager sm =
           StringManager.getManager(Constants.Package);
       
  
  
  
  1.2       +6 -6      jakarta-tomcat/src/share/org/apache/tomcat/server/ServletInputStreamImpl.java
  
  Index: ServletInputStreamImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/ServletInputStreamImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServletInputStreamImpl.java	1999/10/09 00:20:48	1.1
  +++ ServletInputStreamImpl.java	1999/10/28 05:15:29	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/ServletInputStreamImpl.java,v 1.1 1999/10/09 00:20:48 duncan Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/09 00:20:48 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/server/ServletInputStreamImpl.java,v 1.2 1999/10/28 05:15:29 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/28 05:15:29 $
    *
    * ====================================================================
    *
  @@ -77,13 +77,13 @@
   
   class ServletInputStreamImpl extends BufferedServletInputStream {
   
  -    private ServerRequest request;
  +    //    private ServerRequest request;
       private InputStream in;
   
       
  -    ServletInputStreamImpl(ServerRequest request, InputStream in) {
  +    ServletInputStreamImpl(InputStream in) {
   	super();
  -	this.request = request;
  +	//	this.request = request;
   	this.in = in;
       }
       public int doRead() throws IOException {
  
  
  
  1.4       +24 -26    jakarta-tomcat/src/share/org/apache/tomcat/service/Ajp11ConnectionHandler.java
  
  Index: Ajp11ConnectionHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/Ajp11ConnectionHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Ajp11ConnectionHandler.java	1999/10/24 17:34:03	1.3
  +++ Ajp11ConnectionHandler.java	1999/10/28 05:15:30	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/Ajp11ConnectionHandler.java,v 1.3 1999/10/24 17:34:03 costin Exp $
  - * $Revision: 1.3 $
  - * $Date: 1999/10/24 17:34:03 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/Ajp11ConnectionHandler.java,v 1.4 1999/10/28 05:15:30 costin Exp $
  + * $Revision: 1.4 $
  + * $Date: 1999/10/28 05:15:30 $
    *
    * ====================================================================
    *
  @@ -106,23 +106,20 @@
           try {
   	    Socket socket=connection.getSocket();
   	    socket.setSoLinger( true, 100);
  -
  -	    AJPRequest request = new AJPRequest(socket); // todo: clean ConnectionHandler, make it abstract
  +	    //XXX recycle
  +	    Request request=new Request();
  +	    
  +	    AJPRequestAdapter reqA = new AJPRequestAdapter(socket); // todo: clean ConnectionHandler, make it abstract
  +	    request.setRequestAdapter( reqA );
  +	    
   	    AJPResponse response = new AJPResponse();
               response.setOutputStream(socket.getOutputStream());
   	    int count = 1;
   
   	    request.setResponse(response);
   	    response.setRequest(request);
  -
  -	    request.readNextRequest();
   
  -	    if (response.getStatus() >= 400) {
  -		response.finish();
  -		
  -		socket.close();
  -		return;
  -	    } 
  +	    reqA.readNextRequest();
   
   	    // resolve the server that we are for
   
  @@ -146,11 +143,11 @@
       }
   }
   
  -class AJPRequest extends Request {
  +class AJPRequestAdapter extends RequestAdapterImpl {
       StringManager sm = StringManager.getManager("org.apache.tomcat.service");
       Socket socket;
       
  -    public AJPRequest(Socket so) {
  +    public AJPRequestAdapter(Socket so) {
   	this.socket=so;
       }
       
  @@ -168,15 +165,16 @@
   	protocol=(String)env_vars.get("SERVER_PROTOCOL");
   	requestURI=(String)env_vars.get("REQUEST_URI");
   	queryString=(String)env_vars.get("QUERY_STRING");
  -	if ((queryString != null ) && ! "".equals(queryString)) {
  -            processFormData(queryString);
  -        }
  -	// todo: fix it!
  -	if (requestURI.indexOf("?") > -1) {
  -	    //            queryString = requestURI.substring(
  -	    //			       requestURI.indexOf("?") + 1, requestURI.length());
  -            //processFormData(queryString);
  -	    requestURI = requestURI.substring(0, requestURI.indexOf("?"));
  +	
  +	// lazy
  + 	// if ((queryString != null ) && ! "".equals(queryString)) {
  +	//             processFormData(queryString);
  +	//         }
  +
  +	// AJP11 will send CGI vars, and REQUEST_URI includes query string 
  +	int idQ= requestURI.indexOf("?");
  +	if ( idQ > -1) {
  +	    requestURI = requestURI.substring(0, idQ);
           }
   	// 	System.out.println("Request: " + requestURI );
   	// 	System.out.println("Query: " + queryString );
  @@ -193,11 +191,11 @@
   	// XXX: bug, fix it
   	remoteHost=(String)env_vars.get("REMOTE_ADDR");
   
  -	processCookies();
  +	// lazy	processCookies();
   	
   	contentLength = headers.getIntHeader("content-length");
   	contentType = headers.getHeader("content-type");
  -	charEncoding = getCharsetFromContentType(contentType);
  +	// lazy	charEncoding = getCharsetFromContentType(contentType);
   	    
   	// XXX
   	// detect for real whether or not we have more requests
  
  
  
  1.3       +17 -35    jakarta-tomcat/src/share/org/apache/tomcat/service/Ajp22ConnectionHandler.java
  
  Index: Ajp22ConnectionHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/Ajp22ConnectionHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Ajp22ConnectionHandler.java	1999/10/24 17:34:03	1.2
  +++ Ajp22ConnectionHandler.java	1999/10/28 05:15:30	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/Ajp22ConnectionHandler.java,v 1.2 1999/10/24 17:34:03 costin Exp $
  - * $Revision: 1.2 $
  - * $Date: 1999/10/24 17:34:03 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/Ajp22ConnectionHandler.java,v 1.3 1999/10/28 05:15:30 costin Exp $
  + * $Revision: 1.3 $
  + * $Date: 1999/10/28 05:15:30 $
    *
    * ====================================================================
    *
  @@ -100,9 +100,6 @@
       //    "Shortcuts" to be added here ( Vhost and context set by Apache, etc)
       // XXX handleEndpoint( Endpoint x )
       public void processConnection(TcpConnection connection) {
  -	Ajp22Response rresponse=null;
  -	Ajp22Request  rrequest=null;
  -    
   	Socket socket;
   
   	try {
  @@ -111,29 +108,19 @@
   	    
   	    socket=connection.getSocket();
   	    
  -	    if( ! recycle_is_broken ) {
  -		msg=new MessageConnector(socket);
  -		rresponse = new Ajp22Response(msg);
  -		//		rresponse.setProtocol( this );
  -		rrequest = new Ajp22Request(msg);
  -		rrequest.setResponse(rresponse);
  -		rresponse.setRequest(rrequest);
  -	    }
  +	    msg=new MessageConnector(socket);
  +	    Ajp22Response rresponse = new Ajp22Response(msg);
  +	    //		rresponse.setProtocol( this );
  +	    Request rrequest = new Request();
  +	    Ajp22Request reqA = new Ajp22Request(msg);
  +	    rrequest.setRequestAdapter( reqA );
  +	    rrequest.setResponse(rresponse);
  +	    rresponse.setRequest(rrequest);
   	    boolean moreRequests=true;
               while( moreRequests ) { // XXX how to exit ? // request.hasMoreRequests()) {
  -		if(recycle_is_broken) {
  -		    // create new objects for GC until reuse is fixed
  -		    msg=new MessageConnector(socket);
  -		    rresponse = new Ajp22Response(msg);
  -		    //		    rresponse.setProtocol( this );
  -		    rrequest = new Ajp22Request(msg);
  -		    rrequest.setResponse(rresponse);
  -		    rresponse.setRequest(rrequest);
  -		}
  -		
   		// XXX this should be implemented here!
   		try {
  -		    int err=rrequest.readNextRequest();
  +		    int err=reqA.readNextRequest();
   		    if( err<0 ) {
   			moreRequests=false;
   			break;
  @@ -285,7 +272,7 @@
   }
   
   
  -class Ajp22Request extends Request {
  +class Ajp22Request extends RequestAdapterImpl {
       MessageConnector proto;
       Hashtable env_vars;
   
  @@ -358,11 +345,8 @@
   	
   	setInternalVars();
   
  -	processCookies();
  -	
   	contentLength = headers.getIntHeader("content-length");
   	contentType = headers.getHeader("content-type");
  -	charEncoding = getCharsetFromContentType(contentType);
   	return 0;
       }    
   
  @@ -384,12 +368,10 @@
   
       private void setInternalVars() {
   	method= (String)env_vars.get("REQUEST_METHOD");
  +
   	protocol=(String)env_vars.get("SERVER_PROTOCOL");
   	requestURI=(String)env_vars.get("REQUEST_URI");
   	queryString=(String)env_vars.get("QUERY_STRING");
  -	if ((queryString != null ) && ! "".equals(queryString)) {
  -            processFormData(queryString);
  -        }
   	if(requestURI==null) requestURI="xxx"; //XXX
   	// XXX: fix it!
   	if (requestURI.indexOf("?") > -1) {
  @@ -412,14 +394,14 @@
   		hostHeader = hostHeader.substring(0,i);
   	    }
   	    
  -	    this.setServerName(hostHeader);
  +	    serverName=hostHeader;
   	} else {
   	    // XXX
   	    // this is crap having to do this lookup -- we
   	    // need a better solution
   	    //    InetAddress localAddress = socket.getLocalAddress();
   	    //rrequest.setServerName(localAddress.getHostName());
  -	    this.setServerName("localhost");
  +	    serverName="localhost";
   	}
   
   		
  @@ -427,7 +409,7 @@
   }
   
   
  -class Ajp22Response extends ResponseImpl implements Ajp22Constants {
  +class Ajp22Response extends Response implements Ajp22Constants {
       MessageConnector proto;
       Ajp22ServletOS rout;
   
  
  
  
  1.2       +7 -5      jakarta-tomcat/src/share/org/apache/tomcat/service/connector/Ajp23ConnectionHandler.java
  
  Index: Ajp23ConnectionHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/connector/Ajp23ConnectionHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Ajp23ConnectionHandler.java	1999/10/09 00:20:48	1.1
  +++ Ajp23ConnectionHandler.java	1999/10/28 05:15:31	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/connector/Ajp23ConnectionHandler.java,v 1.1 1999/10/09 00:20:48 duncan Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/09 00:20:48 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/connector/Ajp23ConnectionHandler.java,v 1.2 1999/10/28 05:15:31 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/28 05:15:31 $
    *
    * ====================================================================
    *
  @@ -105,7 +105,9 @@
   	    socket=connection.getSocket();
   	    TcpConnector con=new TcpConnector( socket );
   	    ConnectorResponse rresponse=new ConnectorResponse(con);
  -	    ConnectorRequest  rrequest=new ConnectorRequest(con);
  +	    Request  rrequest=new Request();
  +	    ConnectorRequest  reqA=new ConnectorRequest(con);
  +	    rrequest.setRequestAdapter( reqA ); 
   
   	    boolean moreRequests=true;
               while( moreRequests ) { // XXX how to exit ? // request.hasMoreRequests()) {
  @@ -121,7 +123,7 @@
   		int type=msg.getInt();
   		//		msg.dump("Received: ");
   		
  -		err=rrequest.decodeRequest(msg);
  +		err=reqA.decodeRequest(msg);
   
   		contextM.service( rrequest, rresponse);
   
  
  
  
  1.3       +15 -30    jakarta-tomcat/src/share/org/apache/tomcat/service/connector/ConnectorRequest.java
  
  Index: ConnectorRequest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/connector/ConnectorRequest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConnectorRequest.java	1999/10/24 17:34:04	1.2
  +++ ConnectorRequest.java	1999/10/28 05:15:31	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/connector/ConnectorRequest.java,v 1.2 1999/10/24 17:34:04 costin Exp $
  - * $Revision: 1.2 $
  - * $Date: 1999/10/24 17:34:04 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/connector/ConnectorRequest.java,v 1.3 1999/10/28 05:15:31 costin Exp $
  + * $Revision: 1.3 $
  + * $Date: 1999/10/28 05:15:31 $
    *
    * ====================================================================
    *
  @@ -73,7 +73,7 @@
   import javax.servlet.*;
   import javax.servlet.http.*;
   
  -public class ConnectorRequest extends Request {
  +public class ConnectorRequest extends RequestAdapterImpl {
       MsgConnector con;
       Hashtable env_vars;
       
  @@ -119,33 +119,20 @@
   	protocol=(String)env_vars.get("SERVER_PROTOCOL");
   	requestURI=(String)env_vars.get("REQUEST_URI");
   	queryString=(String)env_vars.get("QUERY_STRING");
  -	if ((queryString != null ) && ! "".equals(queryString)) {
  -            processFormData(queryString);
  -        }
  -	if(requestURI==null) requestURI="xxx"; //XXX
  -	// XXX: fix it!
  -	if (requestURI.indexOf("?") > -1) {
  -	    requestURI = requestURI.substring(0, requestURI.indexOf("?"));
  +	// lazy 	if ((queryString != null ) && ! "".equals(queryString)) {
  +	//             processFormData(queryString);
  +	//         }
  +	if(requestURI==null) throw new IOException( "Protocol error - request is null");
  +	
  +	// XXX: make this in Apache side!
  +	// In CGI,  REQUEST_URI includes query string 
  +	int idQ= requestURI.indexOf("?");
  +	if ( idQ > -1) {
  +	    requestURI = requestURI.substring(0, idQ);
           }
  -	String hostHeader = this.getHeader("host");
  -		
  -	if (hostHeader != null) {
  -	    int i = hostHeader.indexOf(':');
  -	    if (i > -1) {
  -		hostHeader = hostHeader.substring(0,i);
  -	    }
  -	    this.setServerName(hostHeader);
  -	} else {
  -	    // XXX
  -	    // this is crap having to do this lookup -- we
  -	    // need a better solution
  -	    //    InetAddress localAddress = socket.getLocalAddress();
  -	    //rrequest.setServerName(localAddress.getHostName());
  -	    this.setServerName("localhost");
  -	}
  +
   	contentLength = headers.getIntHeader("content-length");
   	contentType = headers.getHeader("content-type");
  -	charEncoding = getCharsetFromContentType(contentType);
   
           String sport=(String)env_vars.get("SERVER_PORT");
   	if(sport==null) sport="80";
  @@ -156,8 +143,6 @@
   	// XXX: bug, fix it
   	remoteHost=(String)env_vars.get("REMOTE_ADDR");
   	
  -	processCookies();
  -	 
   	return 0;
       }    
   
  
  
  
  1.2       +4 -4      jakarta-tomcat/src/share/org/apache/tomcat/service/connector/ConnectorResponse.java
  
  Index: ConnectorResponse.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/connector/ConnectorResponse.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConnectorResponse.java	1999/10/09 00:20:48	1.1
  +++ ConnectorResponse.java	1999/10/28 05:15:31	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/connector/ConnectorResponse.java,v 1.1 1999/10/09 00:20:48 duncan Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/09 00:20:48 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/connector/ConnectorResponse.java,v 1.2 1999/10/28 05:15:31 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/28 05:15:31 $
    *
    * ====================================================================
    *
  @@ -74,7 +74,7 @@
   import javax.servlet.http.*;
   
   
  -public class ConnectorResponse extends ResponseImpl  {
  +public class ConnectorResponse extends Response {
       public static final int SEND_HEADERS=2;
       public static final int END_RESPONSE=5;
   
  
  
  
  1.2       +6 -4      jakarta-tomcat/src/share/org/apache/tomcat/service/connector/DoorConnectionHandler.java
  
  Index: DoorConnectionHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/connector/DoorConnectionHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DoorConnectionHandler.java	1999/10/09 00:20:48	1.1
  +++ DoorConnectionHandler.java	1999/10/28 05:15:31	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/connector/DoorConnectionHandler.java,v 1.1 1999/10/09 00:20:48 duncan Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/09 00:20:48 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/connector/DoorConnectionHandler.java,v 1.2 1999/10/28 05:15:31 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/28 05:15:31 $
    *
    * ====================================================================
    *
  @@ -126,8 +126,10 @@
       public void call( MsgBuffer buf ) {
   	try {
   	    MsgConnector con=new DoorConnector();
  +	    Request rrequest=new Request();
   	    ConnectorResponse rresponse=new ConnectorResponse(con);
  -	    ConnectorRequest  rrequest=new ConnectorRequest(con);
  +	    ConnectorRequest  reqA=new ConnectorRequest(con);
  +	    rrequest.setRequestAdapter( reqA );
   
   
   	    contextM.service( rrequest, rresponse );
  
  
  
  1.3       +10 -6     jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpConnectionHandler.java
  
  Index: HttpConnectionHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpConnectionHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HttpConnectionHandler.java	1999/10/22 21:52:17	1.2
  +++ HttpConnectionHandler.java	1999/10/28 05:15:32	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpConnectionHandler.java,v 1.2 1999/10/22 21:52:17 costin Exp $
  - * $Revision: 1.2 $
  - * $Date: 1999/10/22 21:52:17 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpConnectionHandler.java,v 1.3 1999/10/28 05:15:32 costin Exp $
  + * $Revision: 1.3 $
  + * $Date: 1999/10/28 05:15:32 $
    *
    * ====================================================================
    *
  @@ -70,7 +70,7 @@
   import java.util.*;
   import org.apache.tomcat.core.*;
   import org.apache.tomcat.util.*;
  -//import org.apache.tomcat.server.*;
  +import org.apache.tomcat.server.HttpRequestAdapter;
   import javax.servlet.*;
   import javax.servlet.http.*;
   
  @@ -107,14 +107,18 @@
   	    socket=connection.getSocket();
   	    InputStream in=socket.getInputStream();
   	    OutputStream out=socket.getOutputStream();
  -	    HttpRequest request=new HttpRequest();
  +	    Request request=new Request();
  +	    HttpRequestAdapter reqA=new HttpRequestAdapter();
   	    HttpResponse response=new HttpResponse();
   	    response.setRequest(request);
   	    request.setResponse( response );
  +	    request.setRequestAdapter( reqA );
   	    
  +	    reqA.setSocket( socket );
  +	    
   	    response.setOutputStream( out );
   
  -	    request.readRequest( in );
  +	    reqA.readNextRequest(response );
   
   	    contextM.service( request, response );
   
  
  
  
  1.3       +4 -4      jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpResponse.java
  
  Index: HttpResponse.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpResponse.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HttpResponse.java	1999/10/19 23:38:32	1.2
  +++ HttpResponse.java	1999/10/28 05:15:33	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpResponse.java,v 1.2 1999/10/19 23:38:32 costin Exp $
  - * $Revision: 1.2 $
  - * $Date: 1999/10/19 23:38:32 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpResponse.java,v 1.3 1999/10/28 05:15:33 costin Exp $
  + * $Revision: 1.3 $
  + * $Date: 1999/10/28 05:15:33 $
    *
    * ====================================================================
    *
  @@ -74,7 +74,7 @@
   import javax.servlet.http.*;
   
   
  -public class HttpResponse extends ResponseImpl  {
  +public class HttpResponse extends Response {
       OutputStream os;
   
       public HttpResponse() {
  
  
  
  1.2       +6 -6      jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpServletOS.java
  
  Index: HttpServletOS.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpServletOS.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpServletOS.java	1999/10/09 00:20:51	1.1
  +++ HttpServletOS.java	1999/10/28 05:15:33	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpServletOS.java,v 1.1 1999/10/09 00:20:51 duncan Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/09 00:20:51 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpServletOS.java,v 1.2 1999/10/28 05:15:33 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/28 05:15:33 $
    *
    * ====================================================================
    *
  @@ -75,13 +75,13 @@
   
   public class HttpServletOS extends BufferedServletOutputStream  { 
       OutputStream out;
  -    ResponseImpl response;
  +    Response response;
       
       // XXX clean up
       public HttpServletOS() {
       }
   
  -    public HttpServletOS(ResponseImpl response, OutputStream out) {
  +    public HttpServletOS(Response response, OutputStream out) {
   	setOutputStream( out);
   	setResponse( response) ;
       }
  @@ -90,7 +90,7 @@
   	this.out=out;
       }
   
  -    public void setResponse( ResponseImpl response ) {
  +    public void setResponse( Response response ) {
   	this.response=response;
       }
   
  
  
  
  1.3       +2 -1      jakarta-tomcat/src/tests/share/tests/file/WelcomeFileTest.java
  
  Index: WelcomeFileTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/tests/share/tests/file/WelcomeFileTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WelcomeFileTest.java	1999/10/14 23:48:55	1.2
  +++ WelcomeFileTest.java	1999/10/28 05:15:34	1.3
  @@ -1,4 +1,4 @@
  -/* $Id: WelcomeFileTest.java,v 1.2 1999/10/14 23:48:55 akv Exp $
  +/* $Id: WelcomeFileTest.java,v 1.3 1999/10/28 05:15:34 costin Exp $
    */
   
   /**
  @@ -93,6 +93,7 @@
   	} catch (Exception e) {
     	    testResult.setStatus(false);
     	    testResult.setMessage("Exception: " + e);
  +	    e.printStackTrace();
     	    return testResult; 
     	}
       }
  
  
  
  1.4       +2 -2      jakarta-tomcat/src/tests/share/tests/request/post.properties
  
  Index: post.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/tests/share/tests/request/post.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- post.properties	1999/10/25 22:49:10	1.3
  +++ post.properties	1999/10/28 05:15:35	1.4
  @@ -62,7 +62,7 @@
   test.7.host:Localhost
   test.7.connection:close
   test.7.content:
  -test.7.response:HTTP/1.0 404 Not Fouund
  +test.7.response:HTTP/1.0 404
   #test.7.response:HTTP/1.0 403 Forbidden
   test.7.magnitude:true
   
  @@ -71,7 +71,7 @@
   test.8.host:Localhost
   test.8.connection:close
   test.8.content:
  -test.8.response:HTTP/1.0 404 Not Fouund
  +test.8.response:HTTP/1.0 404
   #test.8.response:HTTP/1.0 403 Forbidden
   test.8.magnitude:true
   
  
  
  
  1.3       +17 -0     jakarta-tomcat/src/webpages/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/webpages/WEB-INF/web.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- web.xml	1999/10/14 04:09:37	1.2
  +++ web.xml	1999/10/28 05:15:35	1.3
  @@ -5,4 +5,21 @@
       "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
   
   <web-app>
  +    <servlet>
  +        <servlet-name>
  +            zv
  +        </servlet-name>
  +        <servlet-class>
  +            ZipView
  +        </servlet-class>
  +        <init-param>
  +            <param-name>
  +                docdir
  +            </param-name>
  +            <param-value>
  +                /home/costin/doc/zip
  +            </param-value>
  +        </init-param>
  +    </servlet>
  +
   </web-app>
  
  
  

Mime
View raw message