cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java

2004-02-19 Thread larryi
larryi  2004/02/19 15:15:11

  Modified:src/share/org/apache/tomcat/core Request.java
  Log:
  Apply encoding to query string as well to retain prior behavior.  This will likely
  need to change slightly if we want to support configurability of this behavior.
  
  Revision  ChangesPath
  1.118 +5 -2  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.117
  retrieving revision 1.118
  diff -u -r1.117 -r1.118
  --- Request.java  22 Sep 2003 09:18:21 -  1.117
  +++ Request.java  19 Feb 2004 23:15:11 -  1.118
  @@ -449,10 +449,13 @@
   public void handleQueryParameters() {
// set the encoding for query parameters.
getCharacterEncoding();
  - if( charEncoding  != null ) 
  + if( charEncoding  != null ) {
params.setEncoding( getCharacterEncoding() );
  - else
  +params.setQueryStringEncoding( getCharacterEncoding() );
  +} else {
params.setEncoding( DEFAULT_CHARACTER_ENCODING );
  +params.setQueryStringEncoding( DEFAULT_CHARACTER_ENCODING );
  +}
params.handleQueryParameters();
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java

2003-01-10 Thread billbarker
billbarker2003/01/10 19:00:07

  Modified:src/share/org/apache/tomcat/core Request.java
  Log:
  Make certain that the session still belong to us before returning it.
  
  If the Servlet invalidates the session, and then later requests a new one, it is 
possible for the one we have to be valid because it is now being used by somebody 
else.  Thus we have to make certain that it still belongs to us before returning it.
  
  Real Fix for bug #15894
  Reported By: Christian Wicke [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.116 +2 -0  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.115
  retrieving revision 1.116
  diff -u -r1.115 -r1.116
  --- Request.java  27 Apr 2002 03:45:18 -  1.115
  +++ Request.java  11 Jan 2003 03:00:06 -  1.116
  @@ -714,6 +714,8 @@
   public ServerSession getSession(boolean create) {
if (serverSession!=null  !serverSession.isValid())
serverSession=null;
  + if (serverSession != null  !serverSession.getId().equals(sessionId) )
  + serverSession=null;
   
if( ! create || serverSession!=null )
return serverSession;
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java

2002-04-20 Thread billbarker

billbarker02/04/20 22:56:11

  Modified:src/share/org/apache/tomcat/core Request.java
  Log:
  Make get/setAttribute final here.
  
  The API is such that you should expect problems with overriding these.  Now it will 
fail at compile time if you try.
  
  Revision  ChangesPath
  1.114 +2 -2  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.113
  retrieving revision 1.114
  diff -u -r1.113 -r1.114
  --- Request.java  26 Feb 2002 03:26:55 -  1.113
  +++ Request.java  21 Apr 2002 05:56:10 -  1.114
  @@ -783,7 +783,7 @@
   
   //  Attributes
   
  -public Object getAttribute(String name) {
  +public final Object getAttribute(String name) {
   Object value=attributes.get(name);
if( value != null )
return value;
  @@ -816,7 +816,7 @@
return null;
   }
   
  -public void setAttribute(String name, Object value) {
  +public final void setAttribute(String name, Object value) {
int status=BaseInterceptor.DECLINED;
Context ctx=getContext();
if( ctx!=null ) {
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java

2002-02-25 Thread billbarker

billbarker02/02/25 19:26:55

  Modified:src/share/org/apache/tomcat/core Request.java
  Log:
  Fix NPE when using AccessLog without having a ROOT context defined.
  
  Now we won't attempt to authenticate if we haven't (successfully) done a ContextMap 
(in line with the servlet spec).
  
  Fix for bug #6604
  Reported by: John Swapceinski [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.113 +14 -11jakarta-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.112
  retrieving revision 1.113
  diff -u -r1.112 -r1.113
  --- Request.java  10 Sep 2001 06:43:01 -  1.112
  +++ Request.java  26 Feb 2002 03:26:55 -  1.113
  @@ -562,20 +562,23 @@
   
   public String getRemoteUser() {
if( notAuthenticated ) {
  - notAuthenticated=false;
  + Context ctx = getContext();
  + if( ctx != null ) {
  + notAuthenticated=false;
   
  - // Call all authentication callbacks. If any of them is able to
  - //  identify the user it will set the principal in req.
  - int status=0;
  - BaseInterceptor reqI[]= getContext().getContainer().
  - getInterceptors(Container.H_authenticate);
  - for( int i=0; i reqI.length; i++ ) {
  - status=reqI[i].authenticate( this, response );
  - if ( status != BaseInterceptor.DECLINED ) {
  - break;
  + // Call all authentication callbacks. If any of them is able to
  + //  identify the user it will set the principal in req.
  + int status=0;
  + BaseInterceptor reqI[]= ctx.getContainer().
  + getInterceptors(Container.H_authenticate);
  + for( int i=0; i reqI.length; i++ ) {
  + status=reqI[i].authenticate( this, response );
  + if ( status != BaseInterceptor.DECLINED ) {
  + break;
  + }
}
  + //context.log(Auth  + remoteUser );
}
  - //context.log(Auth  + remoteUser );
}
return remoteUser;
   }
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java

2001-08-31 Thread costin

costin  01/08/31 17:57:17

  Modified:src/share/org/apache/tomcat/core Request.java
  Log:
  Cosmetic - use the factory instead of new for MessageBytes.
  
  Revision  ChangesPath
  1.111 +12 -12jakarta-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.110
  retrieving revision 1.111
  diff -u -r1.110 -r1.111
  --- Request.java  2001/08/29 05:01:24 1.110
  +++ Request.java  2001/09/01 00:57:16 1.111
  @@ -145,23 +145,23 @@
   // MB are also used for headers - it allows lazy
   // byte-char conversion so we can add the encoding
   // that is known only after header parsing. Work in progress.
  -protected MessageBytes schemeMB=new MessageBytes();
  +protected MessageBytes schemeMB=MessageBytes.newInstance();
   
   // uri without any parsing performed
  -protected MessageBytes unparsedURIMB=new MessageBytes();
  +protected MessageBytes unparsedURIMB=MessageBytes.newInstance();
   
  -protected MessageBytes methodMB=new MessageBytes();
  -protected MessageBytes uriMB=new MessageBytes();
  -protected MessageBytes queryMB=new MessageBytes();
  -protected MessageBytes protoMB=new MessageBytes();
  +protected MessageBytes methodMB=MessageBytes.newInstance();
  +protected MessageBytes uriMB=MessageBytes.newInstance();
  +protected MessageBytes queryMB=MessageBytes.newInstance();
  +protected MessageBytes protoMB=MessageBytes.newInstance();
   // uri components
  -protected MessageBytes contextMB=new MessageBytes();
  -protected MessageBytes servletPathMB=new MessageBytes();
  -protected MessageBytes pathInfoMB=new MessageBytes();
  +protected MessageBytes contextMB=MessageBytes.newInstance();
  +protected MessageBytes servletPathMB=MessageBytes.newInstance();
  +protected MessageBytes pathInfoMB=MessageBytes.newInstance();
   
   // remote address/host
  -protected MessageBytes remoteAddrMB=new MessageBytes();
  -protected MessageBytes remoteHostMB=new MessageBytes();
  +protected MessageBytes remoteAddrMB=MessageBytes.newInstance();
  +protected MessageBytes remoteHostMB=MessageBytes.newInstance();
   
   // GS, used by the load balancing layer in the Web Servers
   // jvmRoute == the name of the JVM inside the plugin.
  @@ -181,7 +181,7 @@
   protected MessageBytes contentTypeMB=null;
   //protected String contentType = null;
   protected String charEncoding = null;
  -protected MessageBytes serverNameMB=new MessageBytes();
  +protected MessageBytes serverNameMB=MessageBytes.newInstance();
   
   // auth infor
   protected String authType;
  
  
  



cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java

2001-08-08 Thread keith

keith   01/08/08 10:19:16

  Modified:src/share/org/apache/tomcat/core Request.java
  Log:
  Maintain compatibility with TC 3.2 modules.
  
  Revision  ChangesPath
  1.107 +21 -1 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.106
  retrieving revision 1.107
  diff -u -r1.106 -r1.107
  --- Request.java  2001/08/06 15:45:25 1.106
  +++ Request.java  2001/08/08 17:19:16 1.107
  @@ -309,9 +309,29 @@
   public MessageBytes method() {
return methodMB;
   }
  -
  +
  +/** @deprecated After Tomcat 3.2, use {@link #method()} instead */
  +public String getMethod() {
  + return methodMB.toString();
  +}
  +
  +/** @deprecated After Tomcat 3.2, use {@link #method()} instead */
  +public void setMethod(String method) {
  + methodMB.setString(method);
  +}
  +
   public MessageBytes requestURI() {
return uriMB;
  +}
  +
  +/** @deprecated After Tomcat 3.2, use {@link #requestURI()} instead */
  +public String getRequestURI() {
  + return uriMB.toString();
  +}
  +
  +/** @deprecated After Tomcat 3.2, use {@link #requestURI()} instead */
  +public void setRequestURI(String r) {
  + uriMB.setString(r);
   }
   
   public MessageBytes unparsedURI() {
  
  
  



cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java Response.java

2001-08-06 Thread costin

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  ChangesPath
  1.106 +31 -14jakarta-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
  

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java

2001-07-13 Thread larryi

larryi  01/07/13 21:26:43

  Modified:src/share/org/apache/tomcat/core Request.java
  Log:
  Update isUserInRole() to expect DECLINED as the indication that
  interceptors should continue to be called.
  
  Revision  ChangesPath
  1.104 +1 -1  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.103
  retrieving revision 1.104
  diff -u -r1.103 -r1.104
  --- Request.java  2001/06/24 22:40:35 1.103
  +++ Request.java  2001/07/14 04:26:42 1.104
  @@ -584,7 +584,7 @@
// Call all authorization callbacks. 
for( int i=0; i reqI.length; i++ ) {
status = reqI[i].authorize( this, response, checkRoles );
  - if ( status != 0 ) {
  + if ( status != BaseInterceptor.DECLINED ) {
break;
}
}
  
  
  



cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java

2001-06-24 Thread costin

costin  01/06/24 15:40:35

  Modified:src/share/org/apache/tomcat/core Request.java
  Log:
  Change from package level to protected few fields, other small
  fixes to allow it to be better wrapped.
  
  Revision  ChangesPath
  1.103 +4 -4  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.102
  retrieving revision 1.103
  diff -u -r1.102 -r1.103
  --- Request.java  2001/06/20 05:29:27 1.102
  +++ Request.java  2001/06/24 22:40:35 1.103
  @@ -208,14 +208,14 @@
   protected Handler handler = null;
   Container container;
   
  -Cookies scookies;
  +protected Cookies scookies;
   
   // sub-request support 
   Request top;
   Request parent;
   Request child;
   
  -UDecoder urlDecoder;
  +protected UDecoder urlDecoder;
   
   // Error handling support
   Exception errorException;
  @@ -383,7 +383,7 @@
return;
didReadFormData=true;
   
  - if( ! methodMB.equalsIgnoreCase(POST) )
  + if( ! method().equalsIgnoreCase(POST) )
return;
String contentType= getContentType();
if (contentType == null ||
  @@ -543,7 +543,7 @@
   
   public boolean isSecure() {
// The adapter is responsible for providing this information
  -return schemeMB.equalsIgnoreCase(HTTPS);
  +return scheme().equalsIgnoreCase(HTTPS);
   }
   
   public void setUserPrincipal( Principal p ) {
  
  
  



cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java

2001-06-19 Thread costin

costin  01/06/19 22:29:28

  Modified:src/share/org/apache/tomcat/core Request.java
  Log:
  Propagate the encoding ( set it on queryString before processing ).
  
  Make sure we set 8859_1, as requested by servlet api, to make sure MessageBytes
  behave as expected.
  
  ( few recent bugs were caused by the fact that valid 8859_1 chars where
  lost in UTF8 conversion )
  
  Revision  ChangesPath
  1.102 +6 -1  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.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- Request.java  2001/05/26 17:51:15 1.101
  +++ Request.java  2001/06/20 05:29:27 1.102
  @@ -418,7 +418,12 @@
   }
   
   public void handleQueryParameters() {
  - params.setEncoding( getCharacterEncoding() );
  + // set the encoding for query parameters.
  + getCharacterEncoding();
  + if( charEncoding  != null ) 
  + params.setEncoding( getCharacterEncoding() );
  + else
  + params.setEncoding( DEFAULT_CHARACTER_ENCODING );
params.handleQueryParameters();
   }
   
  
  
  



cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java

2001-05-26 Thread costin

costin  01/05/26 10:51:15

  Modified:src/share/org/apache/tomcat/core Request.java
  Log:
  Code for the changes in buf.
  
  Use standard name for the default encoding.
  
  Added unparsedURIMB - to store the original request URI, to be returned
  by getRequestURI().
  
  Internally we do process the URI, otherwise some mapping may not work
  ( same URI can be encoded in many ways - dependent on browser, charset, etc )
  
  Code for Parameters changes. Save the post buffer if it's small.
  
  Revision  ChangesPath
  1.101 +69 -18jakarta-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.100
  retrieving revision 1.101
  diff -u -r1.100 -r1.101
  --- Request.java  2001/04/21 18:36:07 1.100
  +++ Request.java  2001/05/26 17:51:15 1.101
  @@ -65,7 +65,7 @@
   import org.apache.tomcat.util.http.ContentType;
   import org.apache.tomcat.util.http.Cookies;
   
  -import org.apache.tomcat.util.buf.MessageBytes;
  +import org.apache.tomcat.util.buf.*;
   
   
   //import org.apache.tomcat.util.http.*;
  @@ -109,6 +109,9 @@
* @author Costin Manolache
*/
   public class Request {
  +// As specified in the servlet specs
  +public static final String DEFAULT_CHARACTER_ENCODING=ISO-8859-1;
  +
   public static final String SESSIONID_FROM_COOKIE=cookie;
   public static final String SESSIONID_FROM_URL=url;
   public static final int MAX_INCLUDE=10;
  @@ -143,6 +146,9 @@
   // that is known only after header parsing. Work in progress.
   protected MessageBytes schemeMB=new MessageBytes();
   
  +// uri without any parsing performed
  +protected MessageBytes unparsedURIMB=new MessageBytes();
  +
   protected MessageBytes methodMB=new MessageBytes();
   protected MessageBytes uriMB=new MessageBytes();
   protected MessageBytes queryMB=new MessageBytes();
  @@ -171,7 +177,8 @@
   // how much body we still have to read.
   protected int available = -1; 
   
  -protected String contentType = null;
  +protected MessageBytes contentTypeMB=null;
  +//protected String contentType = null;
   protected String charEncoding = null;
   protected MessageBytes serverNameMB=new MessageBytes();
   
  @@ -208,6 +215,8 @@
   Request parent;
   Request child;
   
  +UDecoder urlDecoder;
  +
   // Error handling support
   Exception errorException;
   
  @@ -218,7 +227,9 @@
   public Request() {
headers = new MimeHeaders();
scookies = new Cookies( headers );
  + urlDecoder=new UDecoder();
params.setQuery( queryMB );
  + params.setURLDecoder( urlDecoder );
params.setHeaders( headers );
initRequest();  
   }
  @@ -242,9 +253,14 @@
   public Context getContext() {
return context;
   }
  +
  +public UDecoder getURLDecoder() {
  + return urlDecoder;
  +}
   
  -int encodingInfo;
  -int attributeInfo;
  +// cached note ids 
  +private int encodingInfo;
  +private int attributeInfo;
   
   public void setContextManager( ContextManager cm ) {
contextM=cm;
  @@ -298,6 +314,10 @@
return uriMB;
   }
   
  +public MessageBytes unparsedURI() {
  + return unparsedURIMB;
  +}
  +
   public MessageBytes query() {
return queryMB;
   }
  @@ -373,20 +393,39 @@
   
int len=getContentLength();
int available=getAvailable();
  -
  + 
// read only available ( someone else may have read the content )
if( available  0 ) {
try {
  - byte[] formData = new byte[available];
  + byte[] formData=null;
  + if( available  CACHED_POST_LEN ) {
  + if( postData == null ) postData=new byte[CACHED_POST_LEN];
  + formData=postData;
  + } else {
  + formData = new byte[available];
  + }
readBody( formData, available );
  - params.processData( formData );
  + 
  + handleQueryParameters();
  +
  + params.processParameters( formData, 0, available );
} catch(IOException ex ) {
  + ex.printStackTrace();
// XXX should we throw exception or log ?
return;
}
}
   }
   
  +public void handleQueryParameters() {
  + params.setEncoding( getCharacterEncoding() );
  + params.handleQueryParameters();
  +}
  +
  +// Avoid re-allocating the buffer for each post
  +private static int CACHED_POST_LEN=8192;
  +private byte postData[]=null;
  +
   public Parameters parameters() {
return params;
   }
  @@ -414,14 +453,17 @@
}
}
  

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java

2001-03-08 Thread costin

costin  01/03/08 06:31:35

  Modified:src/share/org/apache/tomcat/core Request.java
  Log:
  Ops, wrong directory... Fix the last night's commit - sorry about it.
  
  ( the CVS should be closed during night time :-)
  
  Revision  ChangesPath
  1.97  +9 -3  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.96
  retrieving revision 1.97
  diff -u -r1.96 -r1.97
  --- Request.java  2001/03/08 07:23:02 1.96
  +++ Request.java  2001/03/08 14:31:34 1.97
  @@ -248,8 +248,14 @@
   
   public void setContextManager( ContextManager cm ) {
contextM=cm;
  - encodingInfo=cm.getNote( ContextManager.REQUEST_NOTE,"req.encoding" );
  - attributeInfo=cm.getNote( ContextManager.REQUEST_NOTE,"req.attribute" );
  + try {
  + encodingInfo=cm.getNoteId( ContextManager.REQUEST_NOTE,
  +"req.encoding" );
  + attributeInfo=cm.getNoteId( ContextManager.REQUEST_NOTE,
  + "req.attribute" );
  + } catch( TomcatException ex ) {
  + ex.printStackTrace();
  + }
   }
   
   public ContextManager getContextManager() {
  @@ -398,7 +404,7 @@
}
if( result != null ) {
charEncoding=(String)result;
  - return;
  + return charEncoding;
}

   charEncoding = ContentType.getCharsetFromContentType(getContentType());
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java

2001-02-26 Thread costin

costin  01/02/26 18:47:39

  Modified:src/share/org/apache/tomcat/core Request.java
  Log:
  2 more fields converted to MessageBytes ( Ajp13 is setting them
  on every request - they were implemented as callbacks in standalone
  so the change was not absolutely needed - and it got postponed ).
  
  Revision  ChangesPath
  1.92  +14 -20jakarta-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.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- Request.java  2001/02/20 03:17:56 1.91
  +++ Request.java  2001/02/27 02:47:39 1.92
  @@ -109,8 +109,8 @@
   //  properties 
   
   protected int serverPort;
  -protected String remoteAddr;
  -protected String remoteHost;
  +//protected String remoteAddr;
  +//protected String remoteHost;
   protected String localHost;
   
   protected int state;
  @@ -130,6 +130,10 @@
   protected MessageBytes servletPathMB=new MessageBytes();
   protected MessageBytes pathInfoMB=new MessageBytes();
   
  +// remote address/host
  +protected MessageBytes remoteAddrMB=new MessageBytes();
  +protected MessageBytes remoteHostMB=new MessageBytes();
  +
   // GS, used by the load balancing layer in the Web Servers
   // jvmRoute == the name of the JVM inside the plugin.
   protected String jvmRoute;
  @@ -139,7 +143,6 @@
   
   // Processed information ( redundant ! )
   protected Parameters params=new Parameters();
  -//protected Hashtable parametersH = new Hashtable();
   protected boolean didReadFormData=false;
   
   protected int contentLength = -1;
  @@ -177,9 +180,6 @@
   Container container;
   
   Cookies scookies;
  -//ServerCookie scookies[]=new ServerCookie[4];
  -// -1 = cookies not processed yet
  -//int cookieCount=-1;
   
   // sub-request support 
   Request top;
  @@ -300,21 +300,13 @@
   public void setServerPort(int serverPort ) {
this.serverPort=serverPort;
   }
  -
  -public String getRemoteAddr() {
  -return remoteAddr;
  -}
  -
  -public void setRemoteAddr( String remoteAddr ) {
  - this.remoteAddr=remoteAddr;
  -}
   
  -public String getRemoteHost() {
  - return remoteHost;
  +public MessageBytes remoteAddr() {
  + return remoteAddrMB;
   }
   
  -public void setRemoteHost(String remoteHost) {
  - this.remoteHost=remoteHost;
  +public MessageBytes remoteHost() {
  + return remoteHostMB;
   }
   
   public String getLocalHost() {
  @@ -873,6 +865,8 @@
queryMB.recycle();
methodMB.recycle();
protoMB.recycle();
  + remoteAddrMB.recycle();
  + remoteHostMB.recycle();
   
// XXX Do we need such defaults ?
   schemeMB.setString("http");
  @@ -880,7 +874,7 @@
   uriMB.setString("/");
   queryMB.setString("");
   protoMB.setString("HTTP/1.0");
  -remoteAddr="127.0.0.1";
  -remoteHost="localhost";
  +remoteAddrMB.setString("127.0.0.1");
  +remoteHostMB.setString("localhost");
   }
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java

2001-02-08 Thread costin

costin  01/02/08 23:47:49

  Modified:src/share/org/apache/tomcat/core Request.java
  Log:
  Wrong test for POST.
  
  Revision  ChangesPath
  1.90  +2 -2  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.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- Request.java  2001/02/07 07:01:23 1.89
  +++ Request.java  2001/02/09 07:47:48 1.90
  @@ -337,8 +337,8 @@
if( ! methodMB.equalsIgnoreCase("POST") )
return;
String contentType= getContentType();
  - if (contentType == null 
  -contentType.startsWith("application/x-www-form-urlencoded")) {
  + if (contentType == null ||
  +! contentType.startsWith("application/x-www-form-urlencoded")) {
return;
}
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java

2001-02-05 Thread costin

costin  01/02/05 22:29:19

  Modified:src/share/org/apache/tomcat/core Request.java
  Log:
  Corresponding changes in Request - the parameter representation and handling
   is now encapsulated in Parameters.
  
  The Request and RequestDispatcher will create and manipulate Parameters,
  by adding data ( handlePostParameters() is a special case that will
  "feed" all the post body to Parameters ). Parameters are not dealing with
  reading data or anything similar - just store and manipulate params.
  
  Revision  ChangesPath
  1.88  +30 -57jakarta-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.87
  retrieving revision 1.88
  diff -u -r1.87 -r1.88
  --- Request.java  2001/01/14 20:23:04 1.87
  +++ Request.java  2001/02/06 06:29:19 1.88
  @@ -135,9 +135,9 @@
   protected MimeHeaders headers;
   
   // Processed information ( redundant ! )
  -protected Hashtable parameters = new Hashtable();
  +protected Parameters params=new Parameters();
  +//protected Hashtable parametersH = new Hashtable();
   protected boolean didReadFormData;
  -protected boolean didParameters;
   
   protected int contentLength = -1;
   protected String contentType = null;
  @@ -192,6 +192,8 @@
   public Request() {
headers = new MimeHeaders();
scookies = new Cookies( headers );
  + params.setQuery( queryMB );
  + params.setHeaders( headers );
initRequest();  
   }
   
  @@ -319,26 +321,31 @@
   
   
   //  Parameters 
  -
  -// XXX optimize for common case ( single params )
  -public String getParameter(String name ) {
  - String[] values = getParameterValues(name);
  -if (values != null) {
  -return values[0];
  -} else {
  - return null;
  -}
  -}
   
  -public String[] getParameterValues(String name) {
  - handleParameters();
  -return (String[])parameters.get(name);
  +/** Read the body, if POST, and add the post parameters.
  + *  Before this method is called, only query-line parameters
  + *  are available.
  + */
  +public void handlePostParameters() {
  + int needData=params.needContent();
  +
  + if( needData  0 ) {
  + try {
  + byte[] formData = new byte[needData];
  + readBody( formData, needData );
  + params.processData( formData );
  + } catch(IOException ex ) {
  + // XXX should we throw exception or log ?
  + return;
  + }
  + }
   }
   
  -public Enumeration getParameterNames() {
  - handleParameters();
  -return parameters.keys();
  +public Parameters parameters() {
  + return params;
   }
  +
  +
   
   //  encoding/type 
   
  @@ -598,15 +605,6 @@
this.container=container;
   }
   
  -public void setParameters( Hashtable h ) {
  - if(h!=null)
  - this.parameters=h;
  -}
  -
  -public Hashtable getParameters() {
  - return parameters;
  -}
  -
   //  Attributes
   
   public Object getAttribute(String name) {
  @@ -693,35 +691,10 @@
   }
   
   //  Utils - facade for RequestUtil
  -private void handleParameters() {
  - if(!didParameters) {
  - String qString=queryString().toString();
  - if(qString!=null) {
  - didParameters=true;
  - Parameters.processFormData( qString, parameters );
  - }
  - }
  - if (!didReadFormData) {
  - didReadFormData = true;
  - int len=Parameters.formContentLength( getContentType(),
  -   getContentLength());
  - if( len  0 ) {
  - // based on HttpUtils, very ,very slow and bad
  - byte[] formData = new byte [contentLength];
  - try {
  - readBody( formData, contentLength );
  - } catch(IOException ex ) {
  - return;
  - }
   
  - Hashtable postParameters=Parameters.processFormData(formData);
  - parameters = Parameters.mergeParameters(parameters,
  - postParameters);
  - }
  - }
  -}
  -
  -private int readBody(byte body[], int len)
  +/** Read request data, filling a byte[]
  + */
  +public int readBody(byte body[], int len)
throws IOException
   {
int offset = 0;
  @@ -810,7 +783,8 @@
   public void initRequest() {
   context = null;
   attributes.clear();
  -

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java

2001-01-14 Thread larryi

larryi  01/01/14 12:23:08

  Modified:src/share/org/apache/tomcat/core Request.java
  Log:
  Bug Report #757
  User Principal incorrectly Maintained
  Submitted by: David Winterfeldt ([EMAIL PROTECTED])
  
  Revision  ChangesPath
  1.87  +1 -0  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.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- Request.java  2001/01/01 00:17:23 1.86
  +++ Request.java  2001/01/14 20:23:04 1.87
  @@ -816,6 +816,7 @@
   charEncoding = null;
   authType = null;
   remoteUser = null;
  + principal = null;
   reqSessionId = null;
   serverSession = null;
   didParameters = false;
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java

2000-12-26 Thread costin

costin  00/12/26 14:56:38

  Modified:src/share/org/apache/tomcat/core Request.java
  Log:
  - removed ACC and Counters - the code is not used and specific to accounting
  modules - a note can be used instead. We also want to implement that
  in module so we can extend it later.
  
  - 2 more Strings converted to MessageBytes ( we almost finished the conversion)
  
  - removed old code, re-grouped getter/setters next to each other.
  
  Revision  ChangesPath
  1.82  +40 -118   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.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- Request.java  2000/12/17 22:16:36 1.81
  +++ Request.java  2000/12/26 22:56:38 1.82
  @@ -80,16 +80,6 @@
* @author Hans Bergsten [[EMAIL PROTECTED]]
*/
   public class Request {
  -public static final int ACC_PRE_CMAP=0;
  -public static final int ACC_PRE_RMAP=1;
  -public static final int ACC_POST_MAP=2;
  -public static final int ACC_PRE_SERVICE=3;
  -public static final int ACC_POST_SERVICE=4;
  -public static final int ACC_IN_OUT=5;
  -public static final int ACC_OUT_COUNT=6;
  -
  -public static final int ACCOUNTS=7;
  -
   public static final String SESSIONID_FROM_COOKIE="cookie";
   public static final String SESSIONID_FROM_URL="url";
   public static final int MAX_INCLUDE=10;
  @@ -191,7 +181,7 @@
   
   private Object notes[]=new Object[ContextManager.MAX_NOTES];
   // Accounting
  -private Counters cntr=new Counters(ACCOUNTS);
  +private Counters cntr=new Counters(ContextManager.MAX_NOTES);
   
   //  Constructor 
   
  @@ -245,14 +235,12 @@
return response;
   }
   
  +//  
  +
   public MimeHeaders getMimeHeaders() {
return headers;
   }
   
  -public final Counters getCounters() {
  - return cntr;
  -}
  -
   //  Request data 
   
   public MessageBytes scheme() {
  @@ -270,15 +258,19 @@
   public MessageBytes queryString() {
return queryMB;
   }
  -
  -public String getProtocol() {
  -return protoMB.toString();
  +
  +public MessageBytes servletPath() {
  + return servletPathMB;
   }
   
  -public void setProtocol( String protocol ) {
  - protoMB.setString(protocol);
  +public MessageBytes pathInfo() {
  + return pathInfoMB;
   }
   
  +public MessageBytes protocol() {
  + return protoMB;
  +}
  +
   /** Return the buffer holding the server name, if
*  any. Use isNull() to check if there is no value
*  set.
  @@ -288,51 +280,27 @@
   public MessageBytes serverName() {
return serverNameMB;
   }
  -
  -// /** Return the server name. If none was set,
  -//  *  extract it from the host header.
  -//  *
  -//  */
  -// public String getServerName() {
  -// return serverName;
  -// }
  -
  -// /** Virtual host */
  -// public void setServerName(String serverName) {
  -//   this.serverName = serverName;
  -// }
  -
   
   public int getServerPort() {
   return serverPort;
   }
   
  -public String getRemoteAddr() {
  -return remoteAddr;
  -}
  -
  -public String getRemoteHost() {
  - return remoteHost;
  -}
  -
  -public void setPathInfo(String pathInfo) {
  -pathInfoMB.setString( pathInfo );
  -}
  -
  -// // What's between context path and servlet name ( /servlet )
  -// // A smart server may use arbitrary prefixes and rewriting
  -// public String getServletPrefix() {
  -//   return null;
  -// }
  -
   public void setServerPort(int serverPort ) {
this.serverPort=serverPort;
   }
   
  +public String getRemoteAddr() {
  +return remoteAddr;
  +}
  +
   public void setRemoteAddr( String remoteAddr ) {
this.remoteAddr=remoteAddr;
   }
   
  +public String getRemoteHost() {
  + return remoteHost;
  +}
  +
   public void setRemoteHost(String remoteHost) {
this.remoteHost=remoteHost;
   }
  @@ -368,16 +336,8 @@
   return parameters.keys();
   }
   
  -// 
  +//  encoding/type 
   
  -public void setAuthType(String authType) {
  -this.authType = authType;
  -}
  -
  -public String getAuthType() {
  - return authType;
  -}
  -
   public String getCharacterEncoding() {
   if(charEncoding!=null) return charEncoding;
   charEncoding = RequestUtil.getCharsetFromContentType( getContentType());
  @@ -414,12 +374,15 @@
 

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Request.java

2000-11-02 Thread costin

costin  00/11/02 13:39:13

  Modified:src/share/org/apache/tomcat/core Request.java
  Log:
  - Added request "state"
  
  - Replaced String with MessageBytes for request components ( uri, method,
  protocol, etc). ( needed for no-ascii charset support, performance )
  
  - replace getWrapper with getHandler ( Wrapper is part of facade )
  
  ( other classes are changed to accomodate the String-MessageByte
  conversion )
  
  Revision  ChangesPath
  1.70  +87 -39jakarta-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.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- Request.java  2000/10/08 21:28:56 1.69
  +++ Request.java  2000/11/02 21:39:12 1.70
  @@ -98,6 +98,16 @@
*/
   public static final String ATTRIB_REAL_REQUEST="org.apache.tomcat.request";
   
  +public static final int STATE_UNUSED=0;
  +
  +public static final int STATE_INVALID=-1;
  +
  +public static final int STATE_NEW=1;
  +
  +public static final int STATE_CONTEXT_MAPPED=2;
  +
  +public static final int STATE_MAPPED=3;
  +
   //  properties 
   
   protected int serverPort;
  @@ -105,6 +115,8 @@
   protected String remoteHost;
   protected String localHost;
   
  +protected int state;
  +
   // Request components represented as MB.
   // MB are also used for headers - it allows lazy
   // byte-char conversion so we can add the encoding
  @@ -129,6 +141,8 @@
   
   // Processed information ( redundant ! )
   protected Hashtable parameters = new Hashtable();
  +protected boolean didReadFormData;
  +protected boolean didParameters;
   
   protected int contentLength = -1;
   protected String contentType = null;
  @@ -150,10 +164,6 @@
   protected Context context;
   protected Object requestFacade;
   
  -protected boolean didReadFormData;
  -protected boolean didParameters;
  -// end "Request" variables
  -
   // Session
   protected String reqSessionId;
   protected String sessionIdSource;
  @@ -185,6 +195,14 @@
recycle(); // XXX need better placement-super()
   }
   
  +public final int getState() {
  + return state;
  +}
  +
  +final void setState( int state ) {
  + this.state=state;
  +}
  +
   /** Called by mapper interceptors after the context
is found or directly by server adapters when
this is known in advance
  @@ -231,42 +249,42 @@
   
   //  Request data 
   
  -public MessageBytes getSchemeMB() {
  - return schemeMB;
  -}
  +// public MessageBytes getSchemeMB() {
  +//   return schemeMB;
  +// }
   
  -public String getScheme() {
  -return schemeMB.toString();
  -}
  +// public String getScheme() {
  +// return schemeMB.toString();
  +// }
   
  -public void setScheme( String scheme ) {
  - schemeMB.setString(scheme);
  -}
  +// public void setScheme( String scheme ) {
  +//   schemeMB.setString(scheme);
  +// }
   
  -public String getMethod() {
  -return methodMB.toString();
  -}
  +// public String getMethod() {
  +// return methodMB.toString();
  +// }
   
  -public void setMethod( String method ) {
  - methodMB.setString(method);
  -}
  +// public void setMethod( String method ) {
  +//   methodMB.setString(method);
  +// }
   
  -public String getRequestURI() {
  - return uriMB.toString();
  +public MessageBytes scheme() {
  + return schemeMB;
   }
  -
  -public void setRequestURI( String r ) {
  - uriMB.setString(r);
  +
  +public MessageBytes method() {
  + return methodMB;
   }
  -
  -public String getQueryString() {
  -return queryMB.toString();
  +
  +public MessageBytes requestURI() {
  + return uriMB;
   }
   
  -public void setQueryString(String queryString) {
  - queryMB.setString(queryString);
  +public MessageBytes queryString() {
  + return queryMB;
   }
  -
  +
   public String getProtocol() {
   return protoMB.toString();
   }
  @@ -424,7 +442,7 @@
// Call all authentication callbacks. If any of them is able to
//  identify the user it will set the principal in req.
int status=0;
  - BaseInterceptor reqI[]= context.getContainer().
  + BaseInterceptor reqI[]= getContainer().
getInterceptors(Container.H_authenticate);
for( int i=0; i reqI.length; i++ ) {
status=reqI[i].authenticate( this, response );
  @@ -477,7 +495,7 @@
checkRoles[0]=role;
   
int