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/share/org/apache/tomcat/service/http HttpConnectionHandler.java
Date Fri, 22 Oct 1999 21:52:20 GMT
costin      99/10/22 14:52:19

  Modified:    src/share/org/apache/tomcat/core
                        HttpServletRequestFacade.java Request.java
                        RequestImpl.java ServerSessionManager.java
                        ServletWrapper.java
               src/share/org/apache/tomcat/service/http
                        HttpConnectionHandler.java
  Log:
  First chunk of changes in Request.
  - Moved all code from Request to RequestImpl.
  - Made Request an Interface
  - minor change in getCookies() ( now return a Cookie[] instead of Vector,
  to make the signature closer to HttpServlerRequest)
  
  This is not the final step - Request is still too big to try to
  implement it right now, and we might have some hidden deps.
  
  Revision  Changes    Path
  1.2       +12 -11    jakarta-tomcat/src/share/org/apache/tomcat/core/HttpServletRequestFacade.java
  
  Index: HttpServletRequestFacade.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/HttpServletRequestFacade.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpServletRequestFacade.java	1999/10/09 00:30:05	1.1
  +++ HttpServletRequestFacade.java	1999/10/22 21:52:06	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/HttpServletRequestFacade.java,v
1.1 1999/10/09 00:30:05 duncan Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/09 00:30:05 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/HttpServletRequestFacade.java,v
1.2 1999/10/22 21:52:06 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/22 21:52:06 $
    *
    * ====================================================================
    *
  @@ -131,14 +131,15 @@
       }
   
       public Cookie[] getCookies() {
  -	Vector cookies = request.getCookies();
  -	Cookie[] cookieArray = new Cookie[cookies.size()];
  -
  -	for (int i = 0; i < cookies.size(); i ++) {
  -	    cookieArray[i] = (Cookie)cookies.elementAt(i);    
  -	}
  -
  -        return cookieArray;
  +	return request.getCookies();
  +	// 	Vector cookies = request.getCookies();
  +	// 	Cookie[] cookieArray = new Cookie[cookies.size()];
  +	
  +	// 	for (int i = 0; i < cookies.size(); i ++) {
  +	// 	    cookieArray[i] = (Cookie)cookies.elementAt(i);    
  +	// 	}
  +	
  +	//         return cookieArray;
       }
   
       public long getDateHeader(String name) {
  
  
  
  1.2       +138 -342  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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Request.java	1999/10/09 00:30:15	1.1
  +++ Request.java	1999/10/22 21:52:07	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Request.java,v 1.1
1999/10/09 00:30:15 duncan Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/09 00:30:15 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Request.java,v 1.2
1999/10/22 21:52:07 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/22 21:52:07 $
    *
    * ====================================================================
    *
  @@ -70,6 +70,11 @@
   import javax.servlet.*;
   import javax.servlet.http.*;
   
  +/* XXX
  +   - add comments
  +   - more clean-up
  +   - make it minimal!
  +*/
   
   /**
    * Server neutral form of the request from a client. Subclasses can
  @@ -81,344 +86,135 @@
    * @author Harish Prabandham
    */
   
  -public abstract class Request {
  +public interface Request {
  +    // Core parts of the request
  +    public String getMethod();
  +    
  +    public String getRequestURI();
  +
  +    public String getProtocol();
  +    
  +    public String getQueryString();
  +
  +    public String getScheme();
  +    
  +    public String getServerName();
  +    
  +    public int getServerPort();
  +
  +    public String getRemoteAddr();
  +    
  +    public String getRemoteHost();
  +
  +    public  ServletInputStream getInputStream() throws IOException;
  +    
  +    public  BufferedReader getReader() throws IOException;
  +
  +    
  +    // Attributes - we can have the attribute stuff in a
  +    // separate class
  +    public Object getAttribute(String name);
  +
  +    public void setAttribute(String name, Object value);
  +
  +    public void removeAttribute(String name);
  +
  +    public Enumeration getAttributeNames();
  +
  +
  +    // Parameters
  +    public String[] getParameterValues(String name);
  +
  +    public Enumeration getParameterNames();
  +
  +    
  +    /** Return the parsed Cookies
  +     */
  +    public Cookie[] getCookies();
  +    // Original:    public Vector getCookies();
  +
  +    // Context
  +    // after it is found, allow as to recalculate all other "gets"
  +    public void setContext(Context context); 
  +    
  +    public String getLookupPath();
  +
  +    public Context getContext();
  +
  +    public String getPathInfo();
  +    
  +    public void setPathInfo(String pathInfo);
  +
  +    public String getServletPath();
  +
  +
  +    // Session
  +    public ApplicationSession getSession();
  +
  +    public ApplicationSession getSession(boolean create);
  +    
  +    public String getRequestedSessionId();
  +
  +    public ServerSession getServerSession(boolean create);
  +    
  +
  +    // Authentication
  +    public String getAuthType();
  +    
  +    public void setAuthType(String authType);
  +
  +
  +    // Headers and special Headers
  +    public String getCharacterEncoding();
  +
  +    public int getContentLength();
  +    
  +    public String getContentType();
  +
  +    public String getRemoteUser();
  +
  +    public  long getDateHeader(String name);
  +    
  +    public  String getHeader(String name);
  +
  +    public  Enumeration getHeaders(String name);
  +    
  +    public  int getIntHeader(String name);
  +    
  +    public  Enumeration getHeaderNames();
  +    
  +
  +    // Setters - should go away
  +//     public void setCharacterEncoding(String charEncoding);
  +    
  +    public void setQueryString(String queryString);// used in ForwardRequest
  +    
  +//     public void setScheme(String scheme);
  +    
  +
  +//     // ????
  +    public void setRequestedSessionId(String reqSessionId);// used by ServerSessionManager
  +    
  +//     // ????
  +    public void setServerSession(ServerSession serverSession);// Used by Context.handleRequest
?
  +    
  +    public void setServletPath(String servletPath);// Used by Context.handleRequest ?
  +    
  +//     // Internal 
  +//     // Does Request needs to know the Response?
  +    public void setResponse(Response response);// XXX used only in ServletWrapper - shouldn't
  +    public  void setURI(String requestURI); // XXX used in ServletWrapper, need to clean
up 
  +
  +    // not needed, but it may be usefull
  +    public HttpServletRequestFacade getFacade();
  +
  +
  +    // Removed methods:
  +    
  +    // Should go to RequestUtil
  +    //public  void readFormData();
  +    //public Hashtable mergeParameters(Hashtable one, Hashtable two);
   
  -    protected Response response;
  -    protected HttpServletRequestFacade requestFacade;
  -    protected String scheme = Constants.Request.HTTP;
  -    protected Context context;
  -    protected Hashtable attributes = new Hashtable();
  -    protected Hashtable parameters = new Hashtable();
  -    protected Vector cookies = new Vector();
  -    protected String protocol;
  -
  -    protected String requestURI;
  -    protected String contextPath;
  -    protected String lookupPath;
  -    protected String servletPath;
  -    protected String pathInfo;
  -    protected String queryString;
  -    
  -    protected String method;
  -    protected int contentLength = -1;
  -    protected String contentType = "";
  -    protected String charEncoding = null;
  -    protected String authType;
  -    protected String remoteUser;
  -    protected String reqSessionId;
  -    protected ServerSession serverSession;
  -    protected boolean didReadFormData;
  -    
  -    public Request() {
  -        requestFacade = new HttpServletRequestFacade(this);
  -    }
  -
  -    public HttpServletRequestFacade getFacade() {
  -	return requestFacade;
  -    }
  -
  -    void setURI(String requestURI) {
  -        this.requestURI = requestURI;
  -    }
  -
  -    void setContext(Context context) {
  -	this.context = context;
  -	contextPath = context.getPath();
  -	lookupPath = requestURI.substring(contextPath.length(),
  -            requestURI.length());
  -
  -	// check for ? string on lookuppath
  -	int qindex = lookupPath.indexOf("?");
  -
  -	if (qindex > -1) {
  -	    lookupPath = lookupPath.substring(0, qindex);
  -	}
  -
  -	if (lookupPath.length() < 1) {
  -	    lookupPath = "/";
  -	}
  -    }
  -
  -    public String getLookupPath() {
  -	return lookupPath;
  -    }
  -    
  -    public Context getContext() {
  -	return context;
  -    }
  -
  -    // XXX - changed from package protected to public so
  -    //       that we can call this from ConnectionHandler.java
  -
  -    public void setResponse(Response response) {
  -	this.response = response;
  -    }
  -    
  -    protected void recycle() {
  -	response = null;
  -	scheme = Constants.Request.HTTP;
  -	context = null;
  -        attributes.clear();
  -        parameters.clear();
  -        cookies.removeAllElements();
  -        method = null;
  -	protocol = null;
  -        requestURI = null;
  -        queryString = null;
  -        contentLength = -1;
  -        contentType = "";
  -        charEncoding = null;
  -        authType = null;
  -        remoteUser = null;
  -        reqSessionId = null;
  -	serverSession = null;
  -	didReadFormData = false;
  -    }
  -    
  -    public Object getAttribute(String name) {
  -        return attributes.get(name);
  -    }
  -
  -    public void setAttribute(String name, Object value) {
  -        attributes.put(name, value);
  -    }
  -
  -    public void removeAttribute(String name) {
  -	attributes.remove(name);
  -    }
  -    
  -    public Enumeration getAttributeNames() {
  -        return attributes.keys();
  -    }
  -    
  -    public String[] getParameterValues(String name) {
  -	if (!didReadFormData) {
  -	    readFormData();
  -	}
  -
  -        return (String[])parameters.get(name);
  -    }
  -    
  -    public Enumeration getParameterNames() {
  -	if (!didReadFormData) {
  -	    readFormData();
  -	}
  -
  -        return parameters.keys();
  -    }
  -    
  -    private void readFormData() {
  -	didReadFormData = true;
  -
  -	if (contentType != null &&
  -            contentType.equals("application/x-www-form-urlencoded")) {
  -
  -	    try {
  -		ServletInputStream is=getInputStream();
  -                Hashtable postParameters =
  -		    HttpUtils.parsePostData(contentLength, is);
  -		parameters = mergeParameters(parameters, postParameters);
  -	    }
  -	    catch (IOException e) {
  -		// nothing
  -	    }
  -        }
  -    }
  -
  -    private Hashtable mergeParameters(Hashtable one, Hashtable two) {
  -	// Try some shortcuts
  -	if (one.size() == 0) {
  -	    return two;
  -	}
  -
  -	if (two.size() == 0) {
  -	    return one;
  -	}
  -
  -	Hashtable combined = (Hashtable) one.clone();
  -
  -        Enumeration e = two.keys();
  -
  -	while (e.hasMoreElements()) {
  -	    String name = (String) e.nextElement();
  -	    String[] oneValue = (String[]) one.get(name);
  -	    String[] twoValue = (String[]) two.get(name);
  -	    String[] combinedValue;
  -
  -	    if (oneValue == null) {
  -		combinedValue = twoValue;
  -	    }
  -
  -	    else {
  -		combinedValue = new String[oneValue.length + twoValue.length];
  -
  -	        System.arraycopy(oneValue, 0, combinedValue, 0,
  -                    oneValue.length);
  -	        System.arraycopy(twoValue, 0, combinedValue,
  -                    oneValue.length, twoValue.length);
  -	    }
  -
  -	    combined.put(name, combinedValue);
  -	}
  -
  -	return combined;
  -    }
  -
  -    public ApplicationSession getSession() {
  -        return getSession(true);
  -    }
  -
  -    ServerSession getServerSession(boolean create) {
  -	if (context == null) {
  -	    System.out.println("CONTEXT WAS NEVER SET");
  -	    return null;
  -	}
  -
  -	if (serverSession == null && create) {
  -            serverSession =
  -		ServerSessionManager.getManager()
  -		    .getServerSession(this, response, create);
  -            serverSession.accessed();
  -	}
  -
  -	return serverSession;
  -    }
  -    
  -    public ApplicationSession getSession(boolean create) {
  -	getServerSession(create);
  -	ApplicationSession appSession = null;
  -	if (serverSession != null) {
  -	    appSession = serverSession.getApplicationSession(context, create);
  -	}
  -
  -	return appSession;
  -
  -	//  if (reqSessionId != null) {
  -//  	    //Session session = context.getSession(reqSessionId);
  -//  	    //if (session == null) {
  -//  	    //session = context.createSession(reqSessionId);
  -//  	    //}
  -//  	    //return session;
  -//  	    System.out.println("DANGER, SESSIONS ARE NOT WORKING");
  -//  	} else {
  -//  	    if (create) {
  -//  		Session session = serverSession.createSession(response);
  -//  		return session;
  -//  	    } else {
  -//  		return null;
  -//  	    }
  -//  	}
  -    }
  -
  -    public String getRequestURI() {
  -        return requestURI;
  -    }
  -    
  -    public String getAuthType() {
  -    	return authType;    
  -    }
  -    
  -    public void setAuthType(String authType) {
  -        this.authType = authType;
  -    }
  -
  -    public String getCharacterEncoding() {
  -        return charEncoding;
  -    }
  -
  -    public void setCharacterEncoding(String charEncoding) {
  -	this.charEncoding = charEncoding;
  -    }
  -    
  -    public int getContentLength() {
  -        return contentLength;
  -    }
  -    
  -    public String getContentType() {
  -    	return contentType;   
  -    }
  -    
  -    Vector getCookies() {
  -        return cookies;
  -    }
  -    
  -    public abstract long getDateHeader(String name);
  -    
  -    public abstract String getHeader(String name);
  -
  -    public abstract Enumeration getHeaders(String name);
  -    
  -    public abstract int getIntHeader(String name);
  -    
  -    public abstract Enumeration getHeaderNames();
  -    
  -    public abstract ServletInputStream getInputStream()
  -    throws IOException;
  -    
  -    public abstract BufferedReader getReader()
  -    throws IOException;
  -        
  -    public String getMethod() {
  -        return method;
  -    }
  -    
  -    public String getPathInfo() {
  -        return pathInfo;
  -    }
  -    
  -    public void setPathInfo(String pathInfo) {
  -        this.pathInfo = pathInfo;
  -    }
  -    
  -    public String getProtocol() {
  -        return protocol;
  -    }
  -    
  -    public String getQueryString() {
  -        return queryString;
  -    }
  -
  -    public void setQueryString(String queryString) {
  -        this.queryString = queryString;
  -    }
  -    
  -    public String getRemoteUser() {
  -        return remoteUser;
  -    }
  -    
  -    public String getScheme() {
  -        return scheme;
  -    }
  -    
  -    public void setScheme(String scheme) {
  -        this.scheme = scheme;
  -    }
  -    
  -    public abstract String getServerName();
  -    
  -    public abstract int getServerPort();
  -
  -    public abstract String getRemoteAddr();
  -    
  -    public abstract String getRemoteHost();
  -
  -    void setRequestedSessionId(String reqSessionId) {
  -	this.reqSessionId = reqSessionId;
  -    }
  -    
  -    public String getRequestedSessionId() {
  -        return reqSessionId;
  -    }
  -
  -    void setServerSession(ServerSession serverSession) {
  -	this.serverSession = serverSession;
  -    }
  -    
  -    void setServletPath(String servletPath) {
  -	this.servletPath = servletPath;
  -    }
  -    
  -    public String getServletPath() {
  -        return servletPath;
  -    }
  +    // Connector-specific, maybe in a separate interface
  +    public  void recycle(); // used in strange places - ServletWrapper
   }
  
  
  
  1.2       +323 -12   jakarta-tomcat/src/share/org/apache/tomcat/core/RequestImpl.java
  
  Index: RequestImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RequestImpl.java	1999/10/09 00:30:16	1.1
  +++ RequestImpl.java	1999/10/22 21:52:08	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestImpl.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/RequestImpl.java,v
1.2 1999/10/22 21:52:08 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/22 21:52:08 $
    *
    * ====================================================================
    *
  @@ -79,9 +79,35 @@
    * @author Jason Hunter [jch@eng.sun.com]
    * @author Harish Prabandham
    */
  -
  -public class RequestImpl extends Request {
  +public class RequestImpl implements Request {
       
  +    protected Response response;
  +    protected HttpServletRequestFacade requestFacade;
  +    protected String scheme = Constants.Request.HTTP;
  +    protected Context context;
  +    protected Hashtable attributes = new Hashtable();
  +    protected Hashtable parameters = new Hashtable();
  +    protected Vector cookies = new Vector();
  +    protected String protocol;
  +
  +    protected String requestURI;
  +    protected String contextPath;
  +    protected String lookupPath;
  +    protected String servletPath;
  +    protected String pathInfo;
  +    protected String queryString;
  +    
  +    protected String method;
  +    protected int contentLength = -1;
  +    protected String contentType = "";
  +    protected String charEncoding = null;
  +    protected String authType;
  +    protected String remoteUser;
  +    protected String reqSessionId;
  +    protected ServerSession serverSession;
  +    protected boolean didReadFormData;
  +    // end "Request" variables    
  +
       protected StringManager sm =
           StringManager.getManager(Constants.Package);
       protected ServletInputStream in;
  @@ -90,19 +116,308 @@
       protected int serverPort;
       protected String remoteAddr;
       protected String remoteHost;
  -    
  +
       public RequestImpl() {
  -        super();
  +        requestFacade = new HttpServletRequestFacade(this);
  +    }
  +
  +    public HttpServletRequestFacade getFacade() {
  +	return requestFacade;
  +    }
  +
  +    public void setURI(String requestURI) {
  +        this.requestURI = requestURI;
       }
   
  +    public void setContext(Context context) {
  +	this.context = context;
  +	contextPath = context.getPath();
  +	lookupPath = requestURI.substring(contextPath.length(),
  +            requestURI.length());
  +
  +	// check for ? string on lookuppath
  +	int qindex = lookupPath.indexOf("?");
  +
  +	if (qindex > -1) {
  +	    lookupPath = lookupPath.substring(0, qindex);
  +	}
  +
  +	if (lookupPath.length() < 1) {
  +	    lookupPath = "/";
  +	}
  +    }
  +
  +    public String getLookupPath() {
  +	return lookupPath;
  +    }
  +    
  +    public Context getContext() {
  +	return context;
  +    }
  +
  +    // XXX - changed from package protected to public so
  +    //       that we can call this from ConnectionHandler.java
  +
  +    public void setResponse(Response response) {
  +	this.response = response;
  +    }
  +    
       public void recycle() {
  -	super.recycle();
  +	response = null;
  +	scheme = Constants.Request.HTTP;
  +	context = null;
  +        attributes.clear();
  +        parameters.clear();
  +        cookies.removeAllElements();
  +        method = null;
  +	protocol = null;
  +        requestURI = null;
  +        queryString = null;
  +        contentLength = -1;
  +        contentType = "";
  +        charEncoding = null;
  +        authType = null;
  +        remoteUser = null;
  +        reqSessionId = null;
  +	serverSession = null;
  +	didReadFormData = false;
   	//	moreRequests = false;
   	in = null;
       	headers.clear();
   	serverName = "";
       }
  +    
  +    public Object getAttribute(String name) {
  +        return attributes.get(name);
  +    }
  +
  +    public void setAttribute(String name, Object value) {
  +        attributes.put(name, value);
  +    }
  +
  +    public void removeAttribute(String name) {
  +	attributes.remove(name);
  +    }
  +    
  +    public Enumeration getAttributeNames() {
  +        return attributes.keys();
  +    }
  +    
  +    public String[] getParameterValues(String name) {
  +	if (!didReadFormData) {
  +	    readFormData();
  +	}
  +
  +        return (String[])parameters.get(name);
  +    }
  +    
  +    public Enumeration getParameterNames() {
  +	if (!didReadFormData) {
  +	    readFormData();
  +	}
  +
  +        return parameters.keys();
  +    }
  +    
  +    private void readFormData() {
  +	didReadFormData = true;
  +
  +	if (contentType != null &&
  +            contentType.equals("application/x-www-form-urlencoded")) {
  +
  +	    try {
  +		ServletInputStream is=getInputStream();
  +                Hashtable postParameters =
  +		    HttpUtils.parsePostData(contentLength, is);
  +		parameters = mergeParameters(parameters, postParameters);
  +	    }
  +	    catch (IOException e) {
  +		// nothing
  +	    }
  +        }
  +    }
  +
  +    private Hashtable mergeParameters(Hashtable one, Hashtable two) {
  +	// Try some shortcuts
  +	if (one.size() == 0) {
  +	    return two;
  +	}
  +
  +	if (two.size() == 0) {
  +	    return one;
  +	}
  +
  +	Hashtable combined = (Hashtable) one.clone();
  +
  +        Enumeration e = two.keys();
  +
  +	while (e.hasMoreElements()) {
  +	    String name = (String) e.nextElement();
  +	    String[] oneValue = (String[]) one.get(name);
  +	    String[] twoValue = (String[]) two.get(name);
  +	    String[] combinedValue;
  +
  +	    if (oneValue == null) {
  +		combinedValue = twoValue;
  +	    }
  +
  +	    else {
  +		combinedValue = new String[oneValue.length + twoValue.length];
  +
  +	        System.arraycopy(oneValue, 0, combinedValue, 0,
  +                    oneValue.length);
  +	        System.arraycopy(twoValue, 0, combinedValue,
  +                    oneValue.length, twoValue.length);
  +	    }
  +
  +	    combined.put(name, combinedValue);
  +	}
  +
  +	return combined;
  +    }
  +
  +    public ApplicationSession getSession() {
  +        return getSession(true);
  +    }
  +
  +    public ServerSession getServerSession(boolean create) {
  +	if (context == null) {
  +	    System.out.println("CONTEXT WAS NEVER SET");
  +	    return null;
  +	}
  +
  +	if (serverSession == null && create) {
  +            serverSession =
  +		ServerSessionManager.getManager()
  +		    .getServerSession(this, response, create);
  +            serverSession.accessed();
  +	}
  +
  +	return serverSession;
  +    }
  +    
  +    public ApplicationSession getSession(boolean create) {
  +	getServerSession(create);
  +	ApplicationSession appSession = null;
  +	if (serverSession != null) {
  +	    appSession = serverSession.getApplicationSession(context, create);
  +	}
  +
  +	return appSession;
  +
  +	//  if (reqSessionId != null) {
  +//  	    //Session session = context.getSession(reqSessionId);
  +//  	    //if (session == null) {
  +//  	    //session = context.createSession(reqSessionId);
  +//  	    //}
  +//  	    //return session;
  +//  	    System.out.println("DANGER, SESSIONS ARE NOT WORKING");
  +//  	} else {
  +//  	    if (create) {
  +//  		Session session = serverSession.createSession(response);
  +//  		return session;
  +//  	    } else {
  +//  		return null;
  +//  	    }
  +//  	}
  +    }
  +
  +    public String getRequestURI() {
  +        return requestURI;
  +    }
  +    
  +    public String getAuthType() {
  +    	return authType;    
  +    }
  +    
  +    public void setAuthType(String authType) {
  +        this.authType = authType;
  +    }
  +
  +    public String getCharacterEncoding() {
  +        return charEncoding;
  +    }
  +
  +    public void setCharacterEncoding(String charEncoding) {
  +	this.charEncoding = charEncoding;
  +    }
  +    
  +    public int getContentLength() {
  +        return contentLength;
  +    }
  +    
  +    public String getContentType() {
  +    	return contentType;   
  +    }
  +    
  +    public Cookie[] getCookies() {
  +	Cookie[] cookieArray = new Cookie[cookies.size()];
  +	
  +	for (int i = 0; i < cookies.size(); i ++) {
  +	    cookieArray[i] = (Cookie)cookies.elementAt(i);    
  +	}
  +	
  +	return cookieArray;
  +	//        return cookies;
  +    }
  +    
  +    public String getMethod() {
  +        return method;
  +    }
  +    
  +    public String getPathInfo() {
  +        return pathInfo;
  +    }
  +    
  +    public void setPathInfo(String pathInfo) {
  +        this.pathInfo = pathInfo;
  +    }
  +    
  +    public String getProtocol() {
  +        return protocol;
  +    }
  +    
  +    public String getQueryString() {
  +        return queryString;
  +    }
   
  +    public void setQueryString(String queryString) {
  +        this.queryString = queryString;
  +    }
  +    
  +    public String getRemoteUser() {
  +        return remoteUser;
  +    }
  +    
  +    public String getScheme() {
  +        return scheme;
  +    }
  +    
  +    public void setScheme(String scheme) {
  +        this.scheme = scheme;
  +    }
  +    
  +    public void setRequestedSessionId(String reqSessionId) {
  +	this.reqSessionId = reqSessionId;
  +    }
  +    
  +    public String getRequestedSessionId() {
  +        return reqSessionId;
  +    }
  +
  +    public void setServerSession(ServerSession serverSession) {
  +	this.serverSession = serverSession;
  +    }
  +    
  +    public void setServletPath(String servletPath) {
  +	this.servletPath = servletPath;
  +    }
  +    
  +    public String getServletPath() {
  +        return servletPath;
  +    }
  +    
  +
       public long getDateHeader(String name) {
           return headers.getDateHeader(name);
       }
  @@ -343,10 +658,6 @@
   
       public void setRequestURI( String r ) {
   	this.requestURI=r;
  -    }
  -
  -    public void setQueryString( String q ) {
  -	this.queryString=q;
       }
   
       public void setParameters( Hashtable h ) {
  
  
  
  1.2       +9 -7      jakarta-tomcat/src/share/org/apache/tomcat/core/ServerSessionManager.java
  
  Index: ServerSessionManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ServerSessionManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServerSessionManager.java	1999/10/09 00:30:19	1.1
  +++ ServerSessionManager.java	1999/10/22 21:52:09	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ServerSessionManager.java,v
1.1 1999/10/09 00:30:19 duncan Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/09 00:30:19 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ServerSessionManager.java,v
1.2 1999/10/22 21:52:09 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/22 21:52:09 $
    *
    * ====================================================================
    *
  @@ -108,10 +108,12 @@
   	String sessionId = null;
   	ServerSession session = null;
   
  -	Enumeration enum = request.getCookies().elements();
  -
  -	while (enum.hasMoreElements()) {
  -	    Cookie cookie = (Cookie)enum.nextElement();
  +	//	Enumeration enum = request.getCookies().elements();
  +	Cookie cookies[]=request.getCookies(); // assert !=null
  +	
  +	//while (enum.hasMoreElements()) {
  +	for( int i=0; i<cookies.length; i++ ) {
  +	    Cookie cookie = cookies[i]; // (Cookie)enum.nextElement();
   
   	    if (cookie.getName().equals(
                   Constants.Cookie.SESSION_COOKIE_NAME)) {
  
  
  
  1.3       +7 -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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServletWrapper.java	1999/10/15 03:20:26	1.2
  +++ ServletWrapper.java	1999/10/22 21:52:10	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ServletWrapper.java,v
1.2 1999/10/15 03:20:26 harishp Exp $
  - * $Revision: 1.2 $
  - * $Date: 1999/10/15 03:20:26 $
  + * $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 $
    *
    * ====================================================================
    *
  @@ -209,7 +209,10 @@
           if (path != null &&
               servletClass == null &&
               servletClassName == null) {
  -            Request request = new ServerRequest();
  +	    // XXX XXX XXX
  +	    // core shouldn't depend on a particular connector!
  +	    // need to find out what this code does!
  +	    Request request = new ServerRequest();
               Response response = new ServerResponse();
   
               request.recycle();
  
  
  
  1.2       +4 -3      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpConnectionHandler.java	1999/10/09 00:20:49	1.1
  +++ HttpConnectionHandler.java	1999/10/22 21:52:17	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpConnectionHandler.java,v
1.1 1999/10/09 00:20:49 duncan Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/09 00:20:49 $
  + * $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 $
    *
    * ====================================================================
    *
  @@ -109,6 +109,7 @@
   	    OutputStream out=socket.getOutputStream();
   	    HttpRequest request=new HttpRequest();
   	    HttpResponse response=new HttpResponse();
  +	    response.setRequest(request);
   	    request.setResponse( response );
   	    
   	    response.setOutputStream( out );
  
  
  

Mime
View raw message