tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade HttpServletRequestFacade.java HttpServletResponseFacade.java Servlet22Manager.java ServletConfigImpl.java ServletContextFacade.java ServletWrapper.java
Date Sun, 24 Sep 2000 18:11:01 GMT
costin      00/09/24 11:11:01

  Modified:    src/facade22/org/apache/tomcat/facade
                        HttpServletRequestFacade.java
                        HttpServletResponseFacade.java
                        Servlet22Manager.java ServletConfigImpl.java
                        ServletContextFacade.java ServletWrapper.java
  Log:
  Update for the changes in core.
  
  Revision  Changes    Path
  1.2       +11 -5     jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletRequestFacade.java
  
  Index: HttpServletRequestFacade.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletRequestFacade.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpServletRequestFacade.java	2000/08/23 05:39:20	1.1
  +++ HttpServletRequestFacade.java	2000/09/24 18:10:55	1.2
  @@ -157,8 +157,13 @@
   	int count=request.getCookieCount();
   	Cookie[] cookieArray = new Cookie[ count ];
   
  +	// Convert from ServerCookie to Cookie.
  +	// The price is payed _only_ by servlets that call getCookie().
  +	// ( if you don't call it no allocation happens for cookies )
  +	// ( well, it happens, the code to reuse have to be written )
   	for (int i = 0; i < count; i ++) {
  -	    cookieArray[i] = request.getCookie( i );
  +	    ServerCookie sC=request.getCookie(i);
  +	    cookieArray[i] = new CookieFacade(sC);
   	}
   
   	return cookieArray;
  @@ -326,7 +331,8 @@
   	    if( path==null) return null;
   	}
   
  -	return request.getContext().getFacade().getRequestDispatcher(path);
  +	Context ctx=request.getContext();
  +	return ((ServletContext)ctx.getFacade()).getRequestDispatcher(path);
       }
   
       /** Adapter: first elelment
  @@ -338,7 +344,7 @@
       /** Delegate to RequestUtil
        */
       public Enumeration getLocales() {
  -        return RequestUtil.getLocales(this);
  +        return RequestUtil.getLocales(request);
       }
   
       /** Delegate to Context
  @@ -378,13 +384,13 @@
       // -------------------- Session --------------------
   
       public HttpSession getSession() {
  -        return request.getSession(true);
  +        return (HttpSession)request.getSession(true);
       }
   
       /** Create the Facade for session.
        */
       public HttpSession getSession(boolean create) {
  -	HttpSession realSession = request.getSession( create );
  +	HttpSession realSession = (HttpSession)request.getSession( create );
   	// No real session, return null
   	if( realSession == null ) {
   	    if( sessionFacade!= null) sessionFacade.recycle();
  
  
  
  1.4       +27 -7     jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java
  
  Index: HttpServletResponseFacade.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HttpServletResponseFacade.java	2000/08/29 03:44:19	1.3
  +++ HttpServletResponseFacade.java	2000/09/24 18:10:55	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
1.3 2000/08/29 03:44:19 costin Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/08/29 03:44:19 $
  + * $Header: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
1.4 2000/09/24 18:10:55 costin Exp $
  + * $Revision: 1.4 $
  + * $Date: 2000/09/24 18:10:55 $
    *
    * ====================================================================
    *
  @@ -66,12 +66,14 @@
   
   import org.apache.tomcat.util.*;
   import org.apache.tomcat.core.*;
  +import org.apache.tomcat.helper.*;
   import java.io.*;
   import java.net.*;
   import java.util.*;
   import java.lang.IllegalArgumentException;
   import javax.servlet.*;
   import javax.servlet.http.*;
  +import javax.servlet.http.Cookie;
   
   /**
    *
  @@ -110,7 +112,20 @@
       // -------------------- Public methods --------------------
   
       public void addCookie(Cookie cookie) {
  -        response.addCookie(cookie);
  +	
  +	addHeader( CookieTools.getCookieHeaderName(cookie),
  +			    CookieTools.getCookieHeaderValue(cookie));
  +	if( cookie.getVersion() == 1 ) {
  +	    // add a version 0 header too.
  +	    // XXX what if the user set both headers??
  +	    Cookie c0 = (Cookie)cookie.clone();
  +	    c0.setVersion(0);
  +	    addHeader( CookieTools.getCookieHeaderName(c0),
  +		       CookieTools.getCookieHeaderValue(c0));
  +	}
  +	// Is it needed ? ( result of refactoring, that's how the code
  +	// worked) 
  +	//response.addUserCookie(cookie);
       }
   
       public boolean containsHeader(String name) {
  @@ -333,9 +348,12 @@
   
   	// Are we in a valid session that is not using cookies?
   	Request request = response.getRequest();
  -	if (!request.getFacade().isRequestedSessionIdValid() )
  +	HttpServletRequestFacade reqF=(HttpServletRequestFacade)request.
  +	    getFacade();
  +	
  +	if (!reqF.isRequestedSessionIdValid() )
   	    return (false);
  -	if ( request.getFacade().isRequestedSessionIdFromCookie() )
  +	if ( reqF.isRequestedSessionIdFromCookie() )
   	    return (false);
   
   	// Is this a valid absolute URL?
  @@ -393,8 +411,10 @@
   	    url = new URL(location);
   	} catch (MalformedURLException e1) {
   	    Request request = response.getRequest();
  +	    HttpServletRequestFacade reqF=(HttpServletRequestFacade)request.
  +		getFacade();
   	    String requrl =
  -		HttpUtils.getRequestURL(request.getFacade()).toString();
  +		HttpUtils.getRequestURL(reqF).toString();
   	    try {
   		url = new URL(new URL(requrl), location);
   	    } catch (MalformedURLException e2) {
  
  
  
  1.3       +7 -7      jakarta-tomcat/src/facade22/org/apache/tomcat/facade/Servlet22Manager.java
  
  Index: Servlet22Manager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/Servlet22Manager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Servlet22Manager.java	2000/08/23 06:53:05	1.2
  +++ Servlet22Manager.java	2000/09/24 18:10:55	1.3
  @@ -107,18 +107,18 @@
   	return new ServletWrapper();
       }
   
  -    public ServletContext createServletContextFacade(Context ctx) {
  +    public Object createServletContextFacade(Context ctx) {
   	//if( ctx != this.ctx ) return null; // throw
   	return new ServletContextFacade(ctx.getContextManager() , ctx);
       }
   
  -    public HttpServletRequest createHttpServletRequestFacade(Request req) {
  +    public Object createHttpServletRequestFacade(Request req) {
   	Context reqCtx=req.getContext();
   	//	if( reqCtx != ctx && reqCtx != null ) return null; // throw
   	return new HttpServletRequestFacade(req);
       }
   
  -    public HttpServletResponse createHttpServletResponseFacade(Response res) {
  +    public Object createHttpServletResponseFacade(Response res) {
   	Context resCtx=res.getRequest().getContext();
   	//if( resCtx != ctx && resCtx != null ) return null; // throw
   	return new HttpServletResponseFacade(res);
  @@ -127,7 +127,7 @@
       public void recycle( Request rreq ) {
   	//if( rreq.getContext() != ctx ) return; // throw
   	
  -	HttpServletRequest req=rreq.getFacade();
  +	HttpServletRequest req=(HttpServletRequest)rreq.getFacade();
   	if( ! (req instanceof HttpServletRequestFacade))
   	    return;
   	
  @@ -138,14 +138,14 @@
   	if( rres== null )
   	    return;
   	
  -	HttpServletResponse res=rres.getFacade();
  +	HttpServletResponse res=(HttpServletResponse)rres.getFacade();
   	if( res!=null) ((HttpServletResponseFacade)res).recycle();
   	
   	// recycle output stream
   	// XXX XXX implement it
       }
   
  -    public Request getRealRequest( HttpServletRequest req ) {
  +    public Request getRealRequest( Object req ) {
   	Request rreq=((HttpServletRequestFacade)req).getRealRequest();
   	if( rreq==null ) {
   	    loghelper.log("XXX XXX null req " + ctx + " " + req , Logger.ERROR);
  @@ -164,7 +164,7 @@
   	return rreq;
       }
   
  -    public Context getRealContext( ServletContext sctx ) {
  +    public Context getRealContext( Object sctx ) {
   	Context realSctx=((ServletContextFacade)sctx).getRealContext();
   	//	if( realSctx != ctx ) return null;
   	return realSctx;
  
  
  
  1.2       +3 -3      jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletConfigImpl.java
  
  Index: ServletConfigImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletConfigImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServletConfigImpl.java	2000/08/23 05:39:20	1.1
  +++ ServletConfigImpl.java	2000/09/24 18:10:57	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletConfigImpl.java,v
1.1 2000/08/23 05:39:20 costin Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/08/23 05:39:20 $
  + * $Header: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletConfigImpl.java,v
1.2 2000/09/24 18:10:57 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/09/24 18:10:57 $
    *
    * ====================================================================
    *
  @@ -88,7 +88,7 @@
       // -------------------- public facade -------------------- 
       
       public ServletContext getServletContext() {
  -	return servletW.getContext().getFacade();
  +	return (ServletContext)servletW.getContext().getFacade();
       }
   
       public String getInitParameter(String name) {
  
  
  
  1.2       +1 -1      jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletContextFacade.java
  
  Index: ServletContextFacade.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletContextFacade.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServletContextFacade.java	2000/08/23 05:39:20	1.1
  +++ ServletContextFacade.java	2000/09/24 18:10:58	1.2
  @@ -97,7 +97,7 @@
       // -------------------- Public facade methods --------------------
       public ServletContext getContext(String path) {
           Context target=context.getContext(path);
  -	return target.getFacade();
  +	return (ServletContext)target.getFacade();
       }
   
       
  
  
  
  1.4       +2 -2      jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletWrapper.java
  
  Index: ServletWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletWrapper.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ServletWrapper.java	2000/09/10 21:41:04	1.3
  +++ ServletWrapper.java	2000/09/24 18:10:58	1.4
  @@ -396,8 +396,8 @@
   	// associated with contexts ( like the session thread)
   
   	// XXX
  -	HttpServletRequest reqF= req.getFacade();//new HttpServletRequestFacade( req );
  -	HttpServletResponse resF= res.getFacade();//new HttpServletResponseFacade( res );
  +	HttpServletRequest reqF= (HttpServletRequest)req.getFacade();
  +	HttpServletResponse resF= (HttpServletResponse)res.getFacade();
   	doService( reqF, resF );
   
       }
  
  
  

Mime
View raw message