costin 01/08/06 08:45:26 Modified: src/share/org/apache/tomcat/core Request.java Response.java Log: Few fixes in Request, Response: make sure all fields are "protected" ( some were package ), so it can be extended. Added "deprecated" on some of the really old methods, and make sure we use getters instead of the fields ( methods could be overriden ). This is part of the final review of the APIs, preparing for ( hopefully ) final beta. Revision Changes Path 1.106 +31 -14 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.105 retrieving revision 1.106 diff -u -r1.105 -r1.106 --- Request.java 2001/08/03 02:47:58 1.105 +++ Request.java 2001/08/06 15:45:25 1.106 @@ -184,7 +184,7 @@ // auth infor protected String authType; - boolean notAuthenticated=true; + protected boolean notAuthenticated=true; protected String remoteUser; protected Principal principal; // active roles for the current user @@ -206,19 +206,19 @@ // Handler protected Handler handler = null; - Container container; + protected Container container; protected Cookies scookies; // sub-request support - Request top; - Request parent; - Request child; + protected Request top; + protected Request parent; + protected Request child; protected UDecoder urlDecoder; // Error handling support - Exception errorException; + protected Exception errorException; private Object notes[]=new Object[ContextManager.MAX_NOTES]; @@ -323,7 +323,7 @@ } public MessageBytes queryString() { - return queryMB; + return query(); } public MessageBytes servletPath() { @@ -355,6 +355,7 @@ public void setServerPort(int serverPort ) { this.serverPort=serverPort; } + public MessageBytes remoteAddr() { return remoteAddrMB; } @@ -438,6 +439,10 @@ // -------------------- encoding/type -------------------- public String getCharacterEncoding() { + return getCharEncoding(); + } + + public String getCharEncoding() { if(charEncoding!=null) return charEncoding; Object result=null; @@ -477,13 +482,15 @@ public int getContentLength() { if( contentLength > -1 ) return contentLength; - MessageBytes clB=headers.getValue("content-length"); + MessageBytes clB=getMimeHeaders().getValue("content-length"); contentLength = (clB==null || clB.isNull() ) ? -1 : clB.getInt(); available=contentLength; return contentLength; } + /** @deprecated + */ public String getContentType() { contentType(); if( contentTypeMB==null || @@ -491,16 +498,20 @@ return contentTypeMB.toString(); } + /** @deprecated + */ public void setContentType( String type ) { contentTypeMB.setString( type ); } public MessageBytes contentType() { if( contentTypeMB == null ) - contentTypeMB=headers.getValue( "content-type" ); + contentTypeMB=getMimeHeaders().getValue( "content-type" ); return contentTypeMB; } + /** @deprecated + */ public void setContentType( MessageBytes mb ) { contentTypeMB=mb; } @@ -831,16 +842,22 @@ } // -------------------- Facade for MimeHeaders + /** @deprecated + */ public Enumeration getHeaders(String name) { return getMimeHeaders().values(name); } + /** @deprecated + */ public String getHeader(String name) { - return headers.getHeader(name); + return getMimeHeaders().getHeader(name); } + /** @deprecated + */ public Enumeration getHeaderNames() { - return headers.names(); + return getMimeHeaders().names(); } // -------------------- Computed fields -------------------- @@ -929,9 +946,9 @@ sb.append( "R( "); if( context!=null) { sb.append( context.getPath() ); - if( ! servletPathMB.isNull() ) - sb.append( " + " + servletPathMB.toString() + " + " + - pathInfoMB.toString()); + if( ! servletPath().isNull() ) + sb.append( " + " + servletPath().toString() + " + " + + pathInfo().toString()); } else { sb.append(requestURI().toString()); } 1.53 +3 -3 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.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- Response.java 2001/05/26 17:53:29 1.52 +++ Response.java 2001/08/06 15:45:25 1.53 @@ -109,16 +109,16 @@ // holds request error exception // set this just once during request processing - Exception errorException=null; + protected Exception errorException=null; // holds request error URI - String errorURI=null; + protected String errorURI=null; // content type set by user, not including encoding protected String contentType = DEFAULT_CONTENT_TYPE; protected String contentLanguage = null; protected String characterEncoding = DEFAULT_CHAR_ENCODING; protected int contentLength = -1; - private Locale locale = DEFAULT_LOCALE; + protected Locale locale = DEFAULT_LOCALE; // -------------------- Constructor --------------------