cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina Session.java
kief01/04/08 00:55:46 Modified:catalina/src/share/org/apache/catalina Session.java Log: Refactoring to eliminate dependencies by StandardManager, ManagerBase, and StandardSession on one another: each should only depend on methods found in the interface definitions for Manager and Session. Added setValid and setNew to remove StandardSession's dependence on ManagerBase. Revision ChangesPath 1.3 +26 -10 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Session.java Index: Session.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Session.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Session.java 2000/10/18 18:15:49 1.2 +++ Session.java 2001/04/08 07:55:46 1.3 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Session.java,v 1.2 2000/10/18 18:15:49 craigmcc Exp $ - * $Revision: 1.2 $ - * $Date: 2000/10/18 18:15:49 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Session.java,v 1.3 2001/04/08 07:55:46 kief Exp $ + * $Revision: 1.3 $ + * $Date: 2001/04/08 07:55:46 $ * * * @@ -77,7 +77,7 @@ * between requests for a particular user of a web application. * * @author Craig R. McClanahan - * @version $Revision: 1.2 $ $Date: 2000/10/18 18:15:49 $ + * @version $Revision: 1.3 $ $Date: 2001/04/08 07:55:46 $ */ public interface Session { @@ -181,6 +181,14 @@ /** + * Set the codeisNew/code flag for this session. + * + * @param isNew The new value for the codeisNew/code flag + */ +public void setNew(boolean isNew); + + +/** * Return the authenticated Principal that is associated with this Session. * This provides an codeAuthenticator/code with a means to cache a * previously authenticated Principal, and avoid potentially expensive @@ -208,6 +216,20 @@ public HttpSession getSession(); +/** + * Set the codeisValid/code flag for this session. + * + * @param isValid The new value for the codeisValid/code flag + */ +public void setValid(boolean isValid); + + +/** + * Return the codeisValid/code flag for this session. + */ +public boolean isValid(); + + // - Public Methods @@ -224,12 +246,6 @@ * without triggering an exception if the session has already expired. */ public void expire(); - - -/** - * Return the codeisValid/code flag for this session. - */ -public boolean isValid(); /**
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session StandardSession.java
kief01/04/08 01:00:41 Modified:catalina/src/share/org/apache/catalina/session StandardSession.java Log: Refactoring to eliminate dependencies by StandardManager, ManagerBase, and StandardSession on one another: each should only depend on methods found in the interface definitions for Manager and Session. StandardSession should now function correctly with any correct implementation of the Manager interface. The only dependencies are for non-critical functionality relating to logging. Revision ChangesPath 1.16 +48 -50 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StandardSession.java Index: StandardSession.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StandardSession.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- StandardSession.java 2001/03/17 00:28:05 1.15 +++ StandardSession.java 2001/04/08 08:00:40 1.16 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StandardSession.java,v 1.15 2001/03/17 00:28:05 craigmcc Exp $ - * $Revision: 1.15 $ - * $Date: 2001/03/17 00:28:05 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StandardSession.java,v 1.16 2001/04/08 08:00:40 kief Exp $ + * $Revision: 1.16 $ + * $Date: 2001/04/08 08:00:40 $ * * * @@ -111,7 +111,7 @@ * @author Craig R. McClanahan * @author Sean Legassick * @author a href="mailto:[EMAIL PROTECTED]"Jon S. Stevens/a - * @version $Revision: 1.15 $ $Date: 2001/03/17 00:28:05 $ + * @version $Revision: 1.16 $ $Date: 2001/04/08 08:00:40 $ */ class StandardSession @@ -130,8 +130,8 @@ super(); this.manager = manager; -if (manager instanceof StandardManager) -this.debug = ((StandardManager) manager).getDebug(); +if (manager instanceof ManagerBase) +this.debug = ((ManagerBase) manager).getDebug(); } @@ -313,14 +313,13 @@ */ public void setId(String id) { - if ((this.id != null) (manager != null) - (manager instanceof ManagerBase)) - ((ManagerBase) manager).remove(this); + if ((this.id != null) (manager != null)) + manager.remove(this); this.id = id; - if ((manager != null) (manager instanceof ManagerBase)) - ((ManagerBase) manager).add(this); + if (manager != null) + manager.add(this); // Notify interested application event listeners StandardContext context = (StandardContext) manager.getContainer(); @@ -431,7 +430,18 @@ } +/** + * Set the codeisNew/code flag for this session. + * + * @param isNew The new value for the codeisNew/code flag + */ +public void setNew(boolean isNew) { + + this.isNew = isNew; +} + + /** * Return the authenticated Principal that is associated with this Session. * This provides an codeAuthenticator/code with a means to cache a @@ -472,6 +482,27 @@ } +/** + * Return the codeisValid/code flag for this session. + */ +public boolean isValid() { + + return (this.isValid); + +} + + +/** + * Set the codeisValid/code flag for this session. + * + * @param isValid The new value for the codeisValid/code flag + */ +public void setValid(boolean isValid) { + + this.isValid = isValid; +} + + // - Session Public Methods @@ -502,8 +533,8 @@ setValid(false); // Remove this session from our manager's active sessions - if ((manager != null) (manager instanceof ManagerBase)) - ((ManagerBase) manager).remove(this); + if (manager != null) + manager.remove(this); // Unbind any objects associated with this session String keys[] = keys(); @@ -592,16 +623,6 @@ /** - * Return the codeisValid/code flag for this session. - */ -public boolean isValid() { - - return (this.isValid); - -} - - -/** * Release all object references, and initialize instance variables, in * preparation for reuse of this object. */ @@ -663,29 +684,6 @@ /** - * Set the codeisNew/code flag for this session. - * - * @param isNew The new value for the codeisNew/code flag - */ -void setNew(boolean isNew) { - - this.isNew = isNew; - -} - - -/** - * Set the
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session ManagerBase.java
kief01/04/08 01:02:04 Modified:catalina/src/share/org/apache/catalina/session ManagerBase.java Log: Refactoring to eliminate dependencies by StandardManager, ManagerBase, and StandardSession on one another: each should only depend on methods found in the interface definitions for Manager and Session. Revision ChangesPath 1.6 +35 -35 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/ManagerBase.java Index: ManagerBase.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/ManagerBase.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ManagerBase.java 2001/03/14 02:17:22 1.5 +++ ManagerBase.java 2001/04/08 08:02:04 1.6 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/ManagerBase.java,v 1.5 2001/03/14 02:17:22 craigmcc Exp $ - * $Revision: 1.5 $ - * $Date: 2001/03/14 02:17:22 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/ManagerBase.java,v 1.6 2001/04/08 08:02:04 kief Exp $ + * $Revision: 1.6 $ + * $Date: 2001/04/08 08:02:04 $ * * * @@ -86,7 +86,7 @@ * be subclassed to create more sophisticated Manager implementations. * * @author Craig R. McClanahan - * @version $Revision: 1.5 $ $Date: 2001/03/14 02:17:22 $ + * @version $Revision: 1.6 $ $Date: 2001/04/08 08:02:04 $ */ public abstract class ManagerBase implements Manager { @@ -474,6 +474,20 @@ /** + * Add this Session to the set of active Sessions for this Manager. + * + * @param session Session to be added + */ +public void add(Session session) { + + synchronized (sessions) { + sessions.put(session.getId(), session); + } + +} + + +/** * Add a property change listener to this component. * * @param listener The listener to add @@ -498,11 +512,11 @@ public Session createSession() { // Recycle or create a Session instance - StandardSession session = null; + Session session = null; synchronized (recycled) { int size = recycled.size(); if (size 0) { - session = (StandardSession) recycled.get(size - 1); + session = (Session) recycled.get(size - 1); recycled.remove(size - 1); } } @@ -570,6 +584,20 @@ /** + * Remove this Session from the active Sessions for this Manager. + * + * @param session Session to be removed + */ +public void remove(Session session) { + + synchronized (sessions) { + sessions.remove(session.getId()); + } + +} + + +/** * Remove a property change listener from this component. * * @param listener The listener to remove @@ -618,20 +646,6 @@ /** - * Add this Session to the set of active Sessions for this Manager. - * - * @param session Session to be added - */ -void add(StandardSession session) { - - synchronized (sessions) { - sessions.put(session.getId(), session); - } - -} - - -/** * Log a message on the Logger associated with our Container (if any). * * @param message Message to be logged @@ -686,24 +700,10 @@ * * @param session Session to be recycled */ -void recycle(StandardSession session) { +void recycle(Session session) { synchronized (recycled) { recycled.add(session); - } - -} - - -/** - * Remove this Session from the active Sessions for this Manager. - * - * @param session Session to be removed - */ -void remove(StandardSession session) { - - synchronized (sessions) { - sessions.remove(session.getId()); } }
RE: 'Just say no to JSP' Re: [Fwd: Tomcat may reveal script source code by URL trickery]
With my team, I try to stress that JSPs can (and actually should) be used to implement both View and Control aspects of MVC and to address this we have adopted (hopefully) strong standards for how we do JSP development. There is more to it, but basically we conceptually separate JSPs into four basic roles: presentation control, presentation content, request filtering and pure business. We then enforce naming conventions and required strategies to development of JSPs in these roles. I don't claim this is ideal, but it seems to work very well. I use jsp only to show data (when possible). I do the control at a servlet. Chau, Gaston
database access problem
Hello Friends! I am in real difficult situation so i need some quick advice. I am making a search engine. I did all my testing on MS Acess. So far so good. But now when i switched to Oracle and SQL Server i am getting a very odd problem (same in oravle and SQL). here is my code. 1 try{ 2 ResultSet results = g.executeQuery(); // 3 while (results.next()) { 4 String u = results.getString("u"); 5 String t = results.getString("T"); 6 String s = (new Integer(results.getInt("S"))).toString(); 7 String k = results.getString("K");// Exception is thrown here at this line 8 String a = results.getString("P"); 9 String d = results.getString("D"); 10 String m = (new Integer(results.getInt("I"))).toString(); 11 String l = results.getString("L"); 12 String o = (new Integer(results.getInt("O"))).toString(); 13 String st = results.getTimestamp("St").toString(); 14} 15 }catch (SQLException sqle){ sqle.printStackTrace(); } where g = connection.prepareStatement("INSERT INTO HITLIST SELECT SITES.*,1 AS SCORE FROM SITES WHERE SITES.PAGETEXT LIKE '%pakistan%'"); Now on line # 7 i am getting the exception in SQL Server it is [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index in Oracle it is some jdbc exeption about invalid column number Now if i switch the wors with each other error again come on same line number not statement. I debugged using jbuilder and in the middle of execution all resultset.getDataType("columnName") become inavlid even those which are on lines above. So badically whole result set gets corrupted. Same code is running fine in MS Access. Any clue what can be the reason for this. Where else i can get help from. thanking you in advance. I u have any clue do email me. bye
cvs commit: jakarta-tomcat-4.0 RELEASE-NOTES-4.0-B4.txt
craigmcc01/04/08 14:27:43 Modified:.RELEASE-NOTES-4.0-B4.txt Log: Update for refactoring changes. Revision ChangesPath 1.3 +4 -1 jakarta-tomcat-4.0/RELEASE-NOTES-4.0-B4.txt Index: RELEASE-NOTES-4.0-B4.txt === RCS file: /home/cvs/jakarta-tomcat-4.0/RELEASE-NOTES-4.0-B4.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- RELEASE-NOTES-4.0-B4.txt 2001/04/08 02:32:23 1.2 +++ RELEASE-NOTES-4.0-B4.txt 2001/04/08 21:27:42 1.3 @@ -3,7 +3,7 @@ Release Notes = -$Id: RELEASE-NOTES-4.0-B4.txt,v 1.2 2001/04/08 02:32:23 craigmcc Exp $ +$Id: RELEASE-NOTES-4.0-B4.txt,v 1.3 2001/04/08 21:27:42 craigmcc Exp $ @@ -41,6 +41,9 @@ PersistentManager: You can now configure the persistent session manager (along with an appropriate Store implementation) in the server.xml file. Added an example of this, commented out by default. + +Manager/Session: Refactor to eliminate dependencies by StandardManager, +ManagerBase, and StandardSession on each other. ---
mod_webapp, mod_jk etc.
I've posted a few messages about this to Tomcat User list, but since this is really development related, I'm posting this one here. Basically, mod_webapp packaged with Tomcat 4.0 b2 and b3 doesn't compile, so I switched back to the version from b1. I've noticed a few things: - I'm confused as to why mod_webapp (and mod_jk) aren't designed to be statically linked with Apache; after all this is a supported configuration of Apache, runs faster and it has a smaller memory footprint; I know that mod_jk works nicely when statically linked, I use it in my production environment; most other modules support this, including really big ones like mod_ssl, mod_php, mod_perl etc. - mod_webapp from T4b1 doesn't survive the second round of initialisation on Unix because it reports duplicate WebAppConnection entries (at least when statically linked, not sure if that affects the dynamically linked version); this can be easily fixed by using tricks from mod_ssl, where they use ap_global_ctx to store status of initialisation and check on it later - although I'm not Apache API proficient I think I could write that kind of code by stealing from mod_ssl when pushed in the right direction by developers of mod_webapp - even after changing the code of mod_webapp to survive the second round of initialisation (by removing the duplicate check of WebAppConnection and WebAppMount), it still fails when being used with error 'Cannot switch to passive mode'; part of the requested page appears but then there is the stack trace due to some null pointers in Catalina, probaly related to the fact that mod_webapp just died - I understand the need for the TCP connections to be persistent in mod_jk and mod_webapp, but I'm not sure why another connection wouldn't be attempted after the reuse of the previous connection fails; in production environments it is sometimes handy to restart Tomcat only, without touching Apache; also, if Tomcat dies and gets automatically restarted, the connections would still go through from Apache; Apache with mod_ssl might need a password at startup and automatic restart of it might not be possible; how difficult would it be to have functionality like that in mod_webapp/mod_jk? - once again, if I'm pushed in the right direction... As you're all aware, every developer is scratching his/hers own personal itch. Nothing new here. I just kind of like Catalina's features and I would really like it to work behind Apache... Bojan
cvs commit: jakarta-tomcat-4.0/catalina/src/conf catalina.policy
craigmcc01/04/08 17:23:32 Modified:catalina/src/conf catalina.policy Log: Add a property reading permission needed for JAXP. Revision ChangesPath 1.8 +2 -1 jakarta-tomcat-4.0/catalina/src/conf/catalina.policy Index: catalina.policy === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/conf/catalina.policy,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- catalina.policy 2001/04/08 01:05:19 1.7 +++ catalina.policy 2001/04/09 00:23:32 1.8 @@ -8,7 +8,7 @@ // // * Read access to the document root directory // -// $Id: catalina.policy,v 1.7 2001/04/08 01:05:19 craigmcc Exp $ +// $Id: catalina.policy,v 1.8 2001/04/09 00:23:32 craigmcc Exp $ // @@ -104,6 +104,7 @@ permission java.util.PropertyPermission "java.vm.version", "read"; permission java.util.PropertyPermission "java.vm.vendor", "read"; permission java.util.PropertyPermission "java.vm.name", "read"; + permission java.util.PropertyPermission "jaxp.debug", "read"; };