You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@locus.apache.org on 2000/05/02 01:25:46 UTC
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core ContextManager.java
costin 00/05/01 16:25:45
Modified: src/share/org/apache/tomcat/core ContextManager.java
Log:
Small change to the "notes" - the note is similar with attributes, but with
faster access time ( indexed array access versus String-keyed Hashtables).
We can also keep attributes visible from servlets separated from internal
attributes.
Revision Changes Path
1.76 +13 -6 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.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- ContextManager.java 2000/04/26 18:57:35 1.75
+++ ContextManager.java 2000/05/01 23:25:44 1.76
@@ -856,7 +856,7 @@
public static final int CONTAINER_NOTE=1;
public static final int REQUEST_NOTE=2;
- String noteDescription[][]=new String[3][MAX_NOTES];
+ String noteName[][]=new String[3][MAX_NOTES];
/** used to allow interceptors to set specific per/request, per/container
* and per/CM informations.
@@ -874,18 +874,25 @@
* all notes that it needs.
*
* Throws exception if too many notes are set ( shouldn't happen in normal use ).
- * @param description of the note
+ * @param noteType The note will be associated with the server, container or request.
+ * @param name the name of the note.
*/
- public synchronized int getNoteId( int noteType, String description )
+ public synchronized int getNoteId( int noteType, String name )
throws TomcatException
{
+ // find if we already have a note with this name ( this is in init(), not critical )
+ for( int i=0; i< noteId[noteType] ; i++ ) {
+ if( noteName[noteType][i].equals( name ) )
+ return i;
+ }
+
if( noteId[noteType] >= MAX_NOTES ) throw new TomcatException( "Too many notes ");
- noteDescription[noteType][ noteId[noteType] ]=description;
+ noteName[noteType][ noteId[noteType] ]=name;
return noteId[noteType]++;
}
- public String getNoteDescription( int noteType, int noteId ) {
- return noteDescription[noteType][noteId];
+ public String getNoteName( int noteType, int noteId ) {
+ return noteName[noteType][noteId];
}
// -------------------- Per-server notes --------------------
Set-Cookie Max-Age field and bug 246.
Posted by Peter Johnson <pe...@lutris.com>.
Costin,
Tomcat uses a method in CookieTools.java to build the header value of a
cookie.
public static String getCookieHeaderValue(Cookie cookie)
In that method I noticed that the "Max-Age" field is written as "MaxAge". Is
that correct? Also is that the reason for bug 246? Where version 1 ("Max-Age")
cookies are converted to version 0 ("Expires") cookies.
Peter.