Re: cvscommit:jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/resourcesmessages.properties
on 4/24/01 7:58 PM, horwat [EMAIL PROTECTED] wrote: My bad. Flog me. Justy Yea! :-) -jon
FW: Sun J2EE RI, JSP, Include, ErrorPage -- cannot use an errorpage with dinamically included JSPs
Hi! I have a very unnoying problem. In a J2EE application I use a "master JSP" as a template for generating predefined screens (the idea is borrowed from the demo application PetStore). This JSP includes several other JSPs (for the top, left side, right side, central, bottom positions). What JSPs should be included for a given view is defined for each screen in a configuration object. Okay, this is quite simple so far, and what is more, it is working fine. The problem arises when one decides to add error handling. If you add the %@ page errorPage="errorpage.jsp" % directive to an included page, and throw an exception from that page, the JSP container says that it cannot forward to the errorpage "as OutputStream or Writer has already been obtained" (throws a java.lang.IllegalStateException) This happens when you use the jsp:include tag, the one which enables you to use an expression for defining its "page" attribute. It is essential for us, since we want to say something like the following in our template.jsp: jsp:include page="%= currentScreen.get("TOP") %" flush="true" // My Tomcat in J2EE 1.2.1 says "flush="true" is obligatory in JSP 1.0" so I use it in this form This line would dinamically include the JSP defined in the actual "screen" for the topmost area in the template. So this would be fine, but it does not work. The whole thing works fine with the %@ include file="file.jsp" % tag. So this tag does what I really need: it glues all included JSPs together, parses them, greating one big JSP (one servlet finally), which uses a common errorpage, so when I throw an exception from one of the included JSPs, the error page gets called. The only problem is that this tag does not accept an expression, only a literal string, so you cannot say: %@ include file="%= currentScreen.get("TOP") %" % Rather annoying, isn't it? I would appreciate any kind of urgent help. Cheers, Janos. PS: I forgot to mention before, that I tested Sun's PetStore Demo application in this respect, and it _failed_ also... So JSP error handling does not work (!) in Sun's demo application, either.
How do I deploying servlets without a tomcat restart.
I would like to know how I could deploy servlets in incremental bases on a production server to an existing context without having to restart tomcat after modifying the context's web.xml Allan. __ FREE voicemail, email, and fax...all in one place. Sign Up Now! http://www.onebox.com
tomcat+EJB container
Hi, do you have any hints on setting up tomcat, to enable e.g. servlets to access EJB's in an EJB container, running in a separate JVM ? I have made some initial tries to access the J2EE RI container. First problem, calling getInitialContext() in the servlet throwed a javax.naming.NoInitialContextException. I must probably set up a local getInitialContext(), defining a jndi context factory ? Something like env.put(Context.INITIAL_CONTEXT_FACTORY, com.sun.jndi.ldap.LdapCtxFactory) ? I tried to but the j2ee.jar archive in the tomcat lib directory, but I get an ugly exception like this (tried both jdk1.2.2 and jdk1.3 together with j2ee 1.2.1) Too rude try, I guess regards Anatolij Gusev, Volvo IT java.lang.UnsatisfiedLinkError: specialLoadClass at com.sun.corba.ee.internal.util.JDKClassLoader.specialLoadClass(Native Method) at com.sun.corba.ee.internal.util.JDKClassLoader.loadClass(JDKClassLoader.java: 58) at com.sun.corba.ee.internal.util.JDKBridge.loadClassM(JDKBridge.java:180) at com.sun.corba.ee.internal.util.JDKBridge.loadClass(JDKBridge.java:83) at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.loadClass(Util.java:378) at javax.rmi.CORBA.Util.loadClass(Util.java:213) at javax.rmi.PortableRemoteObject.createDelegateIfSpecified(PortableRemoteObjec t.java:182) at javax.rmi.PortableRemoteObject.(PortableRemoteObject.java:61) at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:57) at com.sun.enterprise.naming.SerialContext.(SerialContext.java:79) at com.sun.enterprise.naming.SerialInitContextFactory.getInitialContext(SerialI nitContextFactory.java:54) at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:668) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246) at javax.naming.InitialContext.init(InitialContext.java:222) at javax.naming.InitialContext.(InitialContext.java:178) at ConverterServlet.doGet(ConverterServlet.java:78) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79 7) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC onnectionHandler.java:210) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484)
[BUG Report Tomat 3.2.1 release] servlet's twice calling
os : unix windows 2000servlet container : tomcat 3.2.1 releaseFor the two implementations presented below, requests submitted from the file fileupload.html call up fileUpload2.jsp twice.The file fileUpload2.jsp is called only once when fileupload.html submits a request on other serlet engines(servlet containers).Apparently this is a tomcat bug. The results are identical for UNIX and Windows 2000 systems.¢Ñ fileupload.htmlform action="/examples/fileUpload2.jsp"method=post enctype=multipart/form-datainput type=file size=50 name="upload"input type=reset value="cancel"brinput type=submit value="file transmit"¢Ñ fileUpload2.jsp%@ page contentType="text/html; charset=euc-kr" errorPage="error.jsp" import="java.io.*" language="java" %%boolean checkFileSize = true;int fileSize = request.getContentLength();System.out.println("contentLength : " + fileSize);out.println("contentLength : " + fileSize + "br");// limited file size (5MB)if ( fileSize 1024*1024*5 ) { System.out.println("Large file size"); checkFileSize = false; out.println("script language=JavaScript"); out.println("alert(\"too large file. retry again...\");"); out.println("history.back();"); out.println("/script"); out.flush(); }if ( checkFileSize ) { System.out.println("Small file size"); out.println("run file upload");}System.out.println("end");%
Re: Solaris Sparc Performance Problem
second delays add up. I like Linux a lot myself but the bosses here feel more comfortable with more traditional business models, and besides shouldn't Java run best on a Sparc with Solaris? I am perplexed as to what the problem is and would greatly appreciate any help or ideas I can get. This may NOT be the place for this discussion but since the question was asked about Java running best on Sparc with Solaris ... On the contrary the JVM is only as good as the supporting components that it runs on. In particular the threads library that it sits on. Plus all the other components all others have mentioned here like tcpip stack, name server etc. if you factor in networking components. The JVM may not run best on Solaris. If you are interested in performances of JVMs go to www.tpc.org or www.volano.com They both publish JVM numbers. I was told (and this might be a biased information, so discretion is adviced and apologies to whoever is offended) that Suns JVM performance was bad enough last year compared to IBM's they (Sun) had to pull out their numbers from the SPECjbb benchmarks from www.tpc.org just my 2 cents -- Freddie Mendoza [EMAIL PROTECTED] Search Engine for Cheap Books http://satori.com/cheapbooks
Re: tomcat+EJB container
Dear Gusev, Perhaps you should try JBoss an open source EJB container, you will find documentation on JBoss-tomcat at http://www.jboss.org/business/jboss-tomcat.html and the binaries and source code (if required) from the www.jboss.org Allan. __ FREE voicemail, email, and fax...all in one place. Sign Up Now! http://www.onebox.com
Re: Future of Filter?
Amy Roh wrote: Servlet spec 2.3 has changed to support init(FilterConfig config) and destroy() methods instead of getFilterConfig() and setFilterConfig(FilterConfig config) after discussion to change filter cycle to be similar to the servlet life cycle in the expert group. The recent changes will be reflected in the new Proposed Final Draft 2 (which will be available to public very soon). So TC4 is up to date with the recent spec. :-) Amy Thanks, that's what I suspected. By the way, I did not find any examples that actually performed any filtering. Would this be a common usage pattern for Filter? : SNIP public class MyFilter implements Filter { //---An inner class wrapper that does my filtering class MyServletResponse extends ServletResponseWrapper { public MyServletResponse(ServletResponse response) { super(response); //do stuff } } //---end inner class public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,ServletException { MyServletResponse altResponse = new MyServletResponse(response); chain.doFilter(request,altResponse); } } UN-SNIP Something like that, maybe? Anyway, thanks again. Bob
Re: tomcat+EJB container
Hi, You may also want to take a look at Enhydra Enterprise at http://enterprise.enhydra.org/ which incorporates Tomcat and the Jonas EJB server. You also may want to ask your question on the jonas mailing lists available at http://www.objectweb.org/ . Shawn Allan Kamau wrote: Dear Gusev, Perhaps you should try JBoss an open source EJB container, you will find documentation on JBoss-tomcat at http://www.jboss.org/business/jboss-tomcat.html and the binaries and source code (if required) from the www.jboss.org Allan. __ FREE voicemail, email, and fax...all in one place. Sign Up Now! http://www.onebox.com -- Shawn McMurdo mailto:[EMAIL PROTECTED] Lutris Technologieshttp://www.lutris.com Enhydra.Orghttp://www.enhydra.org
RE: Future of Filter?
this is kind of unrelated, but sort of related... will a filter only be used once per request? for example, if i have a filter mapped to /*, then from a servlet, i forward to another servlet or to a jsp, will the filter be run twice, or just once? thanks. -Original Message- From: Bob Jamison [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 25, 2001 9:14 AM To: [EMAIL PROTECTED] Subject: Re: Future of Filter? Amy Roh wrote: Servlet spec 2.3 has changed to support init(FilterConfig config) and destroy() methods instead of getFilterConfig() and setFilterConfig(FilterConfig config) after discussion to change filter cycle to be similar to the servlet life cycle in the expert group. The recent changes will be reflected in the new Proposed Final Draft 2 (which will be available to public very soon). So TC4 is up to date with the recent spec. :-) Amy Thanks, that's what I suspected. By the way, I did not find any examples that actually performed any filtering. Would this be a common usage pattern for Filter? : SNIP public class MyFilter implements Filter { //---An inner class wrapper that does my filtering class MyServletResponse extends ServletResponseWrapper { public MyServletResponse(ServletResponse response) { super(response); //do stuff } } //---end inner class public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,ServletException { MyServletResponse altResponse = new MyServletResponse(response); chain.doFilter(request,altResponse); } } UN-SNIP Something like that, maybe? Anyway, thanks again. Bob
Re: Future of Filter?
On Wed, 25 Apr 2001, Bob Jamison wrote: Amy Roh wrote: Servlet spec 2.3 has changed to support init(FilterConfig config) and destroy() methods instead of getFilterConfig() and setFilterConfig(FilterConfig config) after discussion to change filter cycle to be similar to the servlet life cycle in the expert group. The recent changes will be reflected in the new Proposed Final Draft 2 (which will be available to public very soon). So TC4 is up to date with the recent spec. :-) Amy Thanks, that's what I suspected. By the way, I did not find any examples that actually performed any filtering. Inside the sources of the examples web app that comes with Tomcat 4.0, there is a CompressionFilter that automatically applies GZIP compression if the client says they can use it, and the response is over a configurable size limit. Would this be a common usage pattern for Filter? : Yep, you've got the pattern down. It's also legal to use HttpServletResponseWrapper if you're wrapping HTTP responses. And, of course, you can wrap the request if you want to do input filtering, in pretty much the same manner. Craig
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core ContextManager.java
costin 01/04/25 09:50:15 Modified:src/share/org/apache/tomcat/core Tag: tomcat_32 ContextManager.java Log: Small fix from Peer Heijnen, aproved by Marc. On internal requests we create we also need to set the host, so error pages work in virtual hosts. 3.3 was already fixed ( part of error handling refactoring ). Submitted by: Peer Heijnen [EMAIL PROTECTED] Revision ChangesPath No revision No revision 1.100.2.23 +1 -0 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.100.2.22 retrieving revision 1.100.2.23 diff -u -r1.100.2.22 -r1.100.2.23 --- ContextManager.java 2001/03/20 19:01:43 1.100.2.22 +++ ContextManager.java 2001/04/25 16:50:12 1.100.2.23 @@ -1172,6 +1172,7 @@ RequestImpl req1=new RequestImpl(); ResponseImpl res1=new ResponseImpl(); initRequest( req1, res1 ); + req1.setServerName( ctx.getHost() ); req1.setRequestURI( ctx.getPath() + path ); processRequest( req1 );
cvs commit: jakarta-tomcat-4.0/connectors/include wa_main.h wa.h wa_request.h wa_general.h
pier01/04/25 10:04:21 Modified:connectors/include wa.h wa_request.h Added: connectors/include wa_main.h Removed: connectors/include wa_general.h Log: Renamed wa_general to wa_main. Updated function prototypes. Revision ChangesPath 1.3 +2 -2 jakarta-tomcat-4.0/connectors/include/wa.h Index: wa.h === RCS file: /home/cvs/jakarta-tomcat-4.0/connectors/include/wa.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- wa.h 2001/04/24 16:30:24 1.2 +++ wa.h 2001/04/25 17:04:15 1.3 @@ -57,7 +57,7 @@ /** * @author Pier Fumagalli mailto:[EMAIL PROTECTED] - * @version $Id: wa.h,v 1.2 2001/04/24 16:30:24 pier Exp $ + * @version $Id: wa.h,v 1.3 2001/04/25 17:04:15 pier Exp $ */ #ifndef _WA_H_ #define _WA_H_ @@ -68,7 +68,7 @@ #include string.h /* APR Library includes */ -#include apr_general.h +#include apr_main.h #include apr_pools.h #include apr_strings.h #include apr_tables.h 1.3 +17 -5 jakarta-tomcat-4.0/connectors/include/wa_request.h Index: wa_request.h === RCS file: /home/cvs/jakarta-tomcat-4.0/connectors/include/wa_request.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- wa_request.h 2001/04/24 16:30:25 1.2 +++ wa_request.h 2001/04/25 17:04:17 1.3 @@ -58,7 +58,7 @@ /** * @package Request * @author Pier Fumagalli mailto:[EMAIL PROTECTED] - * @version $Id: wa_request.h,v 1.2 2001/04/24 16:30:25 pier Exp $ + * @version $Id: wa_request.h,v 1.3 2001/04/25 17:04:17 pier Exp $ */ #ifndef _WA_REQUEST_H_ #define _WA_REQUEST_H_ @@ -161,7 +161,7 @@ * @param d The web-server specific data for this request. * @return An error message on faliure or bNULL/b. */ -const char *wa_request_alloc(wa_request **r, void *d); +const char *WA_AllocRequest(wa_request **r, void *d); /** * Clean up and free the memory used by a request structure. @@ -169,14 +169,26 @@ * @param r The request structure to destroy. * @return An error message on faliure or bNULL/b. */ -const char *wa_request_free(wa_request *r); +const char *WA_FreeRequest(wa_request *r); /** * Invoke a request in a web application. - * br + * + * @param r The WebApp Library request structure. + * @param a The application to which this request needs to be forwarded. + * @return The HTTP result code of this operation. + */ +int WA_InvokeRequest(wa_request *r, wa_application *a); + +/** + * Report the set up of a list of web applications to the client thru an + * HTTP request. + * * @param r The WebApp Library request structure. + * @param a A bNULL/b terminated list of applications for which a + * description should be generated. * @return The HTTP result code of this operation. */ -int wa_request_invoke(wa_request *r, wa_application *a); +int WA_InfoRequest(wa_request *r, wa_application **a); #endif /* ifndef _WA_REQUEST_H_ */ 1.1 jakarta-tomcat-4.0/connectors/include/wa_main.h Index: wa_main.h === /* = * * * * The Apache Software License, Version 1.1 * * * * Copyright (c) 1999-2001 The Apache Software Foundation. * * All rights reserved.* * * * = * * * * Redistribution and use in source and binary forms, with or without modi- * * fication, are permitted provided that the following conditions are met: * * * * 1. Redistributions of source code must retain the above copyright notice * *notice, this list of conditions and the following disclaimer. * * * * 2. Redistributions in binary form must reproduce the above copyright * *notice, this list of conditions and the following disclaimer in the * *documentation and/or other materials provided with the distribution. * * * * 3. The end-user documentation included with the
cvs commit: jakarta-tomcat-4.0/connectors/lib wa_main.c Makefile.in wa_request.c wa_general.c
pier01/04/25 10:05:54 Modified:connectors/lib Makefile.in wa_request.c Added: connectors/lib wa_main.c Removed: connectors/lib wa_general.c Log: Moved wa_general.c to wa_main.c Updated function prototypes Revision ChangesPath 1.4 +2 -2 jakarta-tomcat-4.0/connectors/lib/Makefile.in Index: Makefile.in === RCS file: /home/cvs/jakarta-tomcat-4.0/connectors/lib/Makefile.in,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Makefile.in 2001/04/24 20:22:14 1.3 +++ Makefile.in 2001/04/25 17:05:50 1.4 @@ -56,11 +56,11 @@ # = # # @author Pier Fumagalli mailto:[EMAIL PROTECTED] -# @version $Id: Makefile.in,v 1.3 2001/04/24 20:22:14 pier Exp $ +# @version $Id: Makefile.in,v 1.4 2001/04/25 17:05:50 pier Exp $ include ../Makedefs -OBJS = wa_general.o wa_request.o +OBJS = wa_main.o wa_request.o LIB = libwebapp.la 1.4 +47 -17jakarta-tomcat-4.0/connectors/lib/wa_request.c Index: wa_request.c === RCS file: /home/cvs/jakarta-tomcat-4.0/connectors/lib/wa_request.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- wa_request.c 2001/04/24 20:20:33 1.3 +++ wa_request.c 2001/04/25 17:05:52 1.4 @@ -55,27 +55,57 @@ * * * = */ -/* @version $Id: wa_request.c,v 1.3 2001/04/24 20:20:33 pier Exp $ */ +/* @version $Id: wa_request.c,v 1.4 2001/04/25 17:05:52 pier Exp $ */ #include wa.h -/* Attempt to match an URL against a web application. */ -boolean wa_match(const char *u, wa_application *a) { -if (u==NULL) return(FALSE); -if (a==NULL) return(FALSE); +/* Allocate a new request structure. */ +const char *WA_AllocRequest(wa_request **r, void *d) { + apr_pool_t *pool=NULL; + wa_request *req=NULL; + + if(apr_pool_create(pool,WA_Pool)!=APR_SUCCESS) + return(Cannot create request memory pool); + if((req=apr_palloc(pool,sizeof(wa_request)))==NULL) { + apr_pool_destroy(pool); + return(Cannot allocate memory for the request structure); + } -if (strncmp(u,a-rpth,strlen(a-rpth))==0) return(TRUE); -else return(FALSE); -} + /* Set up the server host data record */ + if((req-serv=apr_palloc(pool,sizeof(wa_hostdata)))==NULL) { + apr_pool_destroy(pool); + return(Cannot allocate memory for server host data structure); + } else { + req-serv-host=NULL; + req-serv-addr=NULL; + req-serv-port=-1; + } -/* Invoke a request in a web application. */ -int wa_invoke(wa_request *r, wa_application *a) { -return(404); -} + /* Set up the server host data record */ + if((req-clnt=apr_palloc(pool,sizeof(wa_hostdata)))==NULL) { + apr_pool_destroy(pool); + return(Cannot allocate memory for client host data structure); + } else { + req-clnt-host=NULL; + req-clnt-addr=NULL; + req-clnt-port=-1; + } -/* Display an informative status page. */ -int wa_status(wa_request *r, wa_application **appl, wa_connection **conn, - int anum, int cnum) { -int x; + /* Set up the headers table */ +// req-hdrs=NULL; -return(404); + /* Set up all other request members */ + req-pool=pool; + req-data=d; + req-meth=NULL; + req-ruri=NULL; + req-args=NULL; + req-prot=NULL; + req-schm=NULL; + req-user=NULL; + req-auth=NULL; + req-clen=0; + req-rlen=0; + + /* All done */ + return(NULL); } 1.1 jakarta-tomcat-4.0/connectors/lib/wa_main.c Index: wa_main.c === /* = * * * * The Apache Software License, Version 1.1 * * * * Copyright (c) 1999-2001 The Apache Software Foundation. * * All rights reserved.* * * * = * *
form based authentication in Tomcat 4
Hi, didn't get a response to this question on tomcat-user so I'll give it a try here. In the Tomcat 4b2 implementation of form based authentication, the redirection from a request for a protected resource to the login page and then from the login page submission back to the protected resource are done internally in the valve. This makes the browser think it is receiving a response to a request other than the one that was actually served, and interferes with the browser fetching other resources referred to by the served resource, such as images or stylesheets, that may use relative URLs. How is one supposed to deal with this issue? It seems like it might be reasonable to require that one only use absolute URLs in links from the login page, but not for any arbitrary protected resource. Thanks - Mark
cvs commit: jakarta-tomcat-4.0/tester/web/golden SSIConfig03.txt
amyroh 01/04/25 10:19:46 Modified:tester/web SSIConfig03.shtml tester/web/golden SSIConfig03.txt Log: Fix returning different filesizes on different platforms due to line endings. Revision ChangesPath 1.2 +2 -2 jakarta-tomcat-4.0/tester/web/SSIConfig03.shtml Index: SSIConfig03.shtml === RCS file: /home/cvs/jakarta-tomcat-4.0/tester/web/SSIConfig03.shtml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- SSIConfig03.shtml 2001/04/20 04:37:44 1.1 +++ SSIConfig03.shtml 2001/04/25 17:19:42 1.2 @@ -1,4 +1,4 @@ !--#config sizefmt=bytes -- -!--#fsize file=index.shtml -- +!--#fsize file=includeme.txt -- !--#config sizefmt=abbrev -- -!--#fsize file=index.shtml -- +!--#fsize file=includeme.txt -- 1.3 +2 -2 jakarta-tomcat-4.0/tester/web/golden/SSIConfig03.txt Index: SSIConfig03.txt === RCS file: /home/cvs/jakarta-tomcat-4.0/tester/web/golden/SSIConfig03.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SSIConfig03.txt 2001/04/22 21:03:47 1.2 +++ SSIConfig03.txt 2001/04/25 17:19:44 1.3 @@ -1,4 +1,4 @@ -4,080 +34 -3.98 KB +34 bytes
Re: Problem with JNI...
Daniel Diaz wrote: Hello I have now another strange problem. I have reinstalled my machine with a RedHat 7.0, here is the unmae -a output: Linux lima.univ-paris1.fr 2.2.16-22 #1 Tue Aug 22 16:49:06 EDT 2000 i686 unknown but my previous JNI application no longer works (even afetr a total recompilation). Trying to localize the problem I found that I could not even launch the JVM. This simple program does not run: #include stdio.h #include stdlib.h #include jni.h JNIEnv *env; JavaVM *vm; jclass cls; int main() { JavaVMOption options[2]; JavaVMInitArgs vm_args; options[0].optionString = -Djava.class.path=.; /* user classes */ vm_args.version = JNI_VERSION_1_2; vm_args.options = options; vm_args.nOptions = 1; vm_args.ignoreUnrecognized = 1; printf(READY TO LOAD THE JVM\n); if (JNI_CreateJavaVM(vm, (void **)env, (void *)vm_args) 0) { fprintf(stderr, cannot load the JVM\n); exit(1); } printf(JVM LOADED\n); exit(0); } When I execute it I get: [diaz@lima jgprolog-1.0]$ y READY TO LOAD THE JVM # # HotSpot Virtual Machine Error, Unexpected Signal 11 # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Error ID: 4F533F4C494E55580E43505005BC # # Problematic Thread: prio=10 tid=0x80532b0 nid=0x3416 runnable # Abandon here is the gdb session: [diaz@lima jgprolog-1.0]$ gdb y GNU gdb 5.0 Copyright 2000 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type show copying to see the conditions. There is absolutely no warranty for GDB. Type show warranty for details. This GDB was configured as i386-redhat-linux... (gdb) r Starting program: /home/diaz/jgprolog-1.0/y [New Thread 1024 (LWP 13340)] READY TO LOAD THE JVM [New Thread 2049 (LWP 13341)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 1024 (LWP 13340)] 0x401b575c in os::start_thread () from /usr/java/jdk1.3/jre/lib/i386/client/libjvm.so (gdb) where #0 0x401b575c in os::start_thread () from /usr/java/jdk1.3/jre/lib/i386/client/libjvm.so #1 0x401e3767 in Threads::create_vm () from /usr/java/jdk1.3/jre/lib/i386/client/libjvm.so #2 0x4015c458 in JNI_CreateJavaVM () from /usr/java/jdk1.3/jre/lib/i386/client/libjvm.so #3 0x804a877 in main () at y.c:23 #4 0x40457b65 in __libc_start_main (main=0x804a82c main, argc=1, ubp_av=0xb8b4, init=0x804a3c8 _init, fini=0x804f914 _fini, rtld_fini=0x4000df24 _dl_fini, stack_end=0xb8ac) at ../sysdeps/generic/libc-start.c:111 (gdb) Do you have any idea ? That a core in JVM... But I do not get it with JVM 1.2.2... -- === Daniel Diaz University of Paris 1 INRIA Rocquencourt 75013 Paris FRANCE 78153 Le Chesnay FRANCE web: http://pauillac.inria.fr/~diaz email: [EMAIL PROTECTED] ===
cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/resources messages.properties
horwat 01/04/25 12:34:03 Modified:jasper/src/share/org/apache/jasper/compiler XmlOutputter.java JspParseEventListener.java ParserXJspSaxHandler.java jasper/src/share/org/apache/jasper/resources messages.properties Log: It was too late in the development process to make these changes for JSP 1.2 PFD2. Reverting and flagging for later integration. Revision ChangesPath 1.11 +8 -5 jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/XmlOutputter.java Index: XmlOutputter.java === RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/XmlOutputter.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- XmlOutputter.java 2001/04/25 00:36:39 1.10 +++ XmlOutputter.java 2001/04/25 19:33:55 1.11 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/XmlOutputter.java,v 1.10 2001/04/25 00:36:39 horwat Exp $ - * $Revision: 1.10 $ - * $Date: 2001/04/25 00:36:39 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/XmlOutputter.java,v 1.11 2001/04/25 19:33:55 horwat Exp $ + * $Revision: 1.11 $ + * $Date: 2001/04/25 19:33:55 $ * * * @@ -98,7 +98,9 @@ */ private int jspRootLevel = 0; -public static final String JSP_NAMESPACE = http://java.sun.com/JSP/TagLibraryDescriptor;; +public static final String JSP_NAMESPACE = http://java.sun.com/jsp_1_2;; +// FLAG: JSP 1.2 PFD2 implement later +// public static final String JSP_NAMESPACE = http://java.sun.com/JSP/TagLibraryDescriptor;; public static final String JSP_VERSION = 1.2; @@ -110,7 +112,8 @@ rootAttrs = new AttributesImpl(); rootAttrs.addAttribute(, xmlns:jsp, xmlns:jsp, CDATA, JSP_NAMESPACE); -rootAttrs.addAttribute(, version, version, CDATA, JSP_VERSION); +// FLAG: JSP 1.2 PFD2 implement later +// rootAttrs.addAttribute(, version, version, CDATA, JSP_VERSION); } //* 1.27 +6 -4 jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java Index: JspParseEventListener.java === RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- JspParseEventListener.java2001/04/25 00:36:39 1.26 +++ JspParseEventListener.java2001/04/25 19:33:55 1.27 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v 1.26 2001/04/25 00:36:39 horwat Exp $ - * $Revision: 1.26 $ - * $Date: 2001/04/25 00:36:39 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v 1.27 2001/04/25 19:33:55 horwat Exp $ + * $Revision: 1.27 $ + * $Date: 2001/04/25 19:33:55 $ * * * @@ -1103,7 +1103,9 @@ { if (data != null) { handleCharData(start, stop, data); -xo.append(jsp:text, null, data); +xo.append(jsp:cdata, null, data); +// FLAG: JSP 1.2 PFD2 implement later +// xo.append(jsp:text, null, data); } } 1.10 +3 -1 jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/ParserXJspSaxHandler.java Index: ParserXJspSaxHandler.java === RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/ParserXJspSaxHandler.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- ParserXJspSaxHandler.java 2001/04/25 00:36:39 1.9 +++ ParserXJspSaxHandler.java 2001/04/25 19:33:56 1.10 @@ -291,7 +291,9 @@ if (name.equals(jsp:root)) { node.validate(true, false); jspHandler.handleRootEnd(); - } else if (name.equals(jsp:text)) { + } else if (name.equals(jsp:cdata)) { +// FLAG: JSP 1.2 PFD2 implement later + // } else if (name.equals(jsp:text)) { node.validate(false, true); jspHandler.handleJspCdata(node.start, stop, node.getText()); } else if (name.equals(jsp:directive.include)) { 1.16 +4 -2
cvs commit: jakarta-tomcat-4.0/tester/src/tester/org/apache/tester Resources06.java
craigmcc01/04/25 13:30:45 Modified:catalina/src/share/org/apache/catalina/util ResourceSet.java tester/src/tester/org/apache/tester Resources06.java Log: Add a test to ensure that the Set returned by ServletContext.getResourcePaths() is immutable -- which it wasn't, so fix that too. Revision ChangesPath 1.2 +57 -3 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/ResourceSet.java Index: ResourceSet.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/ResourceSet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ResourceSet.java 2000/10/21 13:25:33 1.1 +++ ResourceSet.java 2001/04/25 20:30:37 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/ResourceSet.java,v 1.1 2000/10/21 13:25:33 craigmcc Exp $ - * $Revision: 1.1 $ - * $Date: 2000/10/21 13:25:33 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/ResourceSet.java,v 1.2 2001/04/25 20:30:37 craigmcc Exp $ + * $Revision: 1.2 $ + * $Date: 2001/04/25 20:30:37 $ * * * @@ -78,7 +78,7 @@ * is not locked. * * @author Craig R. McClanahan - * @version $Revision: 1.1 $ $Date: 2000/10/21 13:25:33 $ + * @version $Revision: 1.2 $ $Date: 2001/04/25 20:30:37 $ */ public final class ResourceSet extends HashSet { @@ -173,6 +173,60 @@ */ private static final StringManager sm = StringManager.getManager(org.apache.catalina.util); + + +// - Public Methods + + +/** + * Add the specified element to this set if it is not already present. + * Return codetrue/code if the element was added. + * + * @param o The object to be added + * + * @exception IllegalStateException if this ResourceSet is locked + */ +public boolean add(Object o) { + +if (locked) +throw new IllegalStateException + (sm.getString(resourceSet.locked)); +return (super.add(o)); + +} + + +/** + * Remove all of the elements from this set. + * + * @exception IllegalStateException if this ResourceSet is locked + */ +public void clear() { + +if (locked) +throw new IllegalStateException + (sm.getString(resourceSet.locked)); +super.clear(); + +} + + +/** + * Remove the given element from this set if it is present. + * Return codetrue/code if the element was removed. + * + * @param o The object to be removed + * + * @exception IllegalStateException if this ResourceSet is locked + */ +public boolean remove(Object o) { + +if (locked) +throw new IllegalStateException + (sm.getString(resourceSet.locked)); +return (super.remove(o)); + +} } 1.2 +31 -1 jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/Resources06.java Index: Resources06.java === RCS file: /home/cvs/jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/Resources06.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Resources06.java 2001/04/25 03:12:03 1.1 +++ Resources06.java 2001/04/25 20:30:42 1.2 @@ -73,7 +73,7 @@ * found in order to pass. * * @author Craig R. McClanahan - * @version $Revision: 1.1 $ $Date: 2001/04/25 03:12:03 $ + * @version $Revision: 1.2 $ $Date: 2001/04/25 20:30:42 $ */ public class Resources06 extends HttpServlet { @@ -125,6 +125,7 @@ // Request the set of resources in the specified path StaticLogger.write(Processing path ' + path + '); +String first = null; Set set = getServletContext().getResourcePaths(path); if (set == null) { sb.append( No resources returned/); @@ -135,6 +136,8 @@ Iterator resources = set.iterator(); while (resources.hasNext()) { String resource = (String) resources.next(); +if (first == null) +first = resource; StaticLogger.write(Found resource ' + resource + '); for (int i = 0; i paths.length; i++) { if (paths[i].equals(resource)) { @@ -158,6 +161,33 @@ sb.append( times/); } } + +// Verify that the returned set is immutable +try { +String newElement = NEW FOO; +
cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler XmlOutputter.java
horwat 01/04/25 13:54:22 Modified:jasper/src/share/org/apache/jasper/compiler XmlOutputter.java Log: Now consistent with DTD. Specification was inconsistent. When in doubt, default to the DTD. Revision ChangesPath 1.12 +4 -4 jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/XmlOutputter.java Index: XmlOutputter.java === RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/XmlOutputter.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- XmlOutputter.java 2001/04/25 19:33:55 1.11 +++ XmlOutputter.java 2001/04/25 20:54:19 1.12 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/XmlOutputter.java,v 1.11 2001/04/25 19:33:55 horwat Exp $ - * $Revision: 1.11 $ - * $Date: 2001/04/25 19:33:55 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/XmlOutputter.java,v 1.12 2001/04/25 20:54:19 horwat Exp $ + * $Revision: 1.12 $ + * $Date: 2001/04/25 20:54:19 $ * * * @@ -98,7 +98,7 @@ */ private int jspRootLevel = 0; -public static final String JSP_NAMESPACE = http://java.sun.com/jsp_1_2;; +public static final String JSP_NAMESPACE = http://java.sun.com/dtd/jsp_1_2;; // FLAG: JSP 1.2 PFD2 implement later // public static final String JSP_NAMESPACE = http://java.sun.com/JSP/TagLibraryDescriptor;; public static final String JSP_VERSION = 1.2;
Re: Future of Filter?
Craig R. McClanahan wrote: Yep, you've got the pattern down. It's also legal to use HttpServletResponseWrapper if you're wrapping HTTP responses. And, of course, you can wrap the request if you want to do input filtering, in pretty much the same manner. Craig Ok, thanks for the help! I finally got my first Filter working, with a little cajoling (and some begging) ;-) This is the typical XSL transform that I plan to use on a set of generic servlets which will produce XML only, with stylesheets giving the pages 'skins.' I know this initial implementation is not optimal, but it works for now. The XSLTOutputStream took a bit of imagination. It plugs in like this: filter filter-nameXSLT Filter for Skin1/filter-name filter-classXSLTFilter/filter-class init-param param-namexsltFileName/param-name param-valueskin1.xsl/param-value /init-param /filter filter-mapping filter-nameSkin1Command/filter-name servlet-namecommand/servlet-name /filter-mapping Anyway, thanks again. Bob = BEGIN XSLTFilter == import java.io.*; import javax.servlet.*; public class XSLTFilter implements Filter { FilterConfig filterConfig; String xsltName; ServletResponse xsltResponse; //---# Inner class ServletResponse class XSLTResponse extends ServletResponseWrapper { OutputStream outs; ServletOutputStream souts; public ServletOutputStream getOutputStream() { return souts; } public XSLTResponse(ServletResponse response,String xslFileName) throws ServletException,IOException { super(response); outs = new XSLTOutputStream(response.getOutputStream(),xslFileName); souts = new ServletOutputStream() { public void write(int ch) throws IOException { outs.write(ch); } }; } } //---# end inner class ServletResponse public void init(FilterConfig val) throws ServletException { filterConfig=val; xsltName=filterConfig.getInitParameter(xsltFileName); if (xsltName==null) throw new ServletException(XSLTFilter.init():no file name given for init-param 'xsltFileName'); } public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain) throws IOException,ServletException { if (xsltResponse==null) try { xsltResponse = new XSLTResponse(response,xsltName); } catch (Exception e) { throw new ServletException(XSLTFilter.doFilter():+e); } chain.doFilter(request,xsltResponse); } public void destroy() { } } = END XSLTFilter == = BEGIN XSLTOutputStream == import java.io.*; import javax.xml.transform.*; import javax.xml.transform.stream.*; /** * This class uses a very simple piping mechanism to push XML data through * an XSL transform. * @author Bob Jamison * @date 25 Apr 01 */ public class XSLTOutputStream extends FilterOutputStream implements Runnable { OutputStream outputStream; Transformer transformer; PipedInputStream pins; PipedOutputStream pouts; public void run() { try { transformer.transform(new StreamSource(pins),new StreamResult(outputStream)); } catch (Exception e) { } } //Implement OutputStream things /** * Closes this output stream and releases any system resources * associated with this stream. The general contract of codeclose/code * is that it closes the output stream. A closed stream cannot perform * output operations and cannot be reopened. * p * @exception IOException if an I/O error occurs. */ public void close() throws IOException { pouts.flush(); pouts.close(); //pins.close(); } /** * Flushes this output stream and forces any buffered output bytes * to be written out. The general contract of codeflush/code is * that calling it is an indication that, if any bytes previously * written have been buffered by the implementation of the output * stream, such bytes should immediately be written to their * intended destination. * p * @exception IOException if an I/O error occurs. */ public void flush() throws IOException { pouts.flush(); } /** * Writes codeb.length/code bytes from the specified byte array * to this output stream. The general contract for codewrite(b)/code * is that it should have exactly the same effect as the call * codewrite(b, 0, b.length)/code. * * @param b the data. * @exception IOException if an I/O error occurs. * @seejava.io.OutputStream#write(byte[], int, int) */ public void write(byte[] b) throws IOException { pouts.write(b); } /** * Writes codelen/code bytes from the specified byte array * starting at offset codeoff/code to this output stream. * The general contract for codewrite(b, off, len)/code is that * some of the bytes in the array codeb/code are written to the * output stream in order; element codeb[off]/code is the first * byte written and codeb[off+len-1]/code is the last
Tomcat 3.2.2 and Thread synchronization
I've made some pretty major changes to JspServlet.java to clean up lots of thread synchroniztion problems. The commit message summarizes most of the changes. Because this is a major change very late in the beta cycle I would appreciate it if other developers would give this a through review. Be kind, my head is still spinning from all this synchronization stuff. If no one has any complaints I'll cut a new (and hopfully final) beta release for Tomcat 3.2.2 in a couple days. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 25, 2001 6:30 PM To: [EMAIL PROTECTED] Subject: cvs commit: jakarta-tomcat/src/share/org/apache/jasper/servlet JspServlet.java marcsaeg01/04/25 16:29:30 Modified:src/share/org/apache/jasper/resources Tag: tomcat_32 messages.properties messages_es.properties messages_fr.properties src/share/org/apache/jasper/servlet Tag: tomcat_32 JspServlet.java Log: This is a fairly major update. There were numerous thread synchronization problems involving compiling JSP files. These problems were most apparent on systems running under load in which page re-compilations might happen while pages are being executed and where new requests arrive while a page compilation is underway. I've made lots of changes so I'll just summarize the major differences here. 1) The thread synchronization in doLoadJSP() is quite different. The comments before that method describe the synchronization model in detail. 2) The synchronization in doLoadJSP() is now based on the JspServletWrapper object instead of the JspServlet object. 3) The class loading and the object instantiation used to be split between doLoadJSP() and the JspServletWrapper. They are now combined into a single synchronization block inside doLoadJSP(). 4) In JspServletWrapper, the data member theServlet was used directly by several methods. Access to this is now provided only through a synchronized accessor method(). Any method that needs to obtain the servlet must call getServlet() and store the result in a stack variable (or other per-thread storage). Multiple threads of execution through JspServletWrapper may be executing different servlet classes if a page compilation happened while other requests were being processed. 5) When a new JSP implementation class replaces an existing class, the original classes destroy() method should be called so that any jspDestroy() method on the page will be executed. However, the destroy() method can't be invoked until we know that there are no more requests being processed on that instance. To support this, the JSP implementation class is wrapped inside a new class called JspCountedServlet. This class provides simple reference counting in the service() method. If the classes destroy method is called it flags the class for destruction but does not call the servlet's destroy() method until it determines that the service method has completed on all threads running in the class. PR: 1280 Revision ChangesPath No revision No revision 1.17.2.9 +3 -1 jakarta-tomcat/src/share/org/apache/jasper/resources/messages.properties Index: messages.properties === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/resources/mes sages.properties,v retrieving revision 1.17.2.8 retrieving revision 1.17.2.9 diff -u -r1.17.2.8 -r1.17.2.9 --- messages.properties 2001/01/12 04:47:00 1.17.2.8 +++ messages.properties 2001/04/25 23:29:28 1.17.2.9 @@ -1,4 +1,4 @@ -# $Id: messages.properties,v 1.17.2.8 2001/01/12 04:47:00 larryi Exp $ +# $Id: messages.properties,v 1.17.2.9 2001/04/25 23:29:28 marcsaeg Exp $ # # Default localized string information # Localized this the Default Locale as is en_US @@ -214,3 +214,5 @@ jsp.error.unterminated.user.tag=Unterminated user-defined tag: ending tag {0} not found or incorrectly nested jsp.error.invalid.javaEncoding=Invalid java encodings. Tried {0} and then {1}. Both failed. jsp.error.needAlternateJavaEncoding=Default java encoding {0} is invalid on your java platform. An alternate can be specified via the 'javaEncoding' parameter of JspServlet. +jsp.error.badcount=Internal error. Attempted to decrement the reference count for an unreferenced JSP. + 1.3.2.7 +3 -1 jakarta-tomcat/src/share/org/apache/jasper/resources/messages_es.p roperties Index: messages_es.properties === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/resources/mes sages_es.properties,v retrieving revision 1.3.2.6 retrieving
Re: Tomcat 3.2.2 and Thread synchronization
One quick comment - this should be provided by the servlet container. ( i.e. make sure that destroy() is not called while a servlet is in progress ). Of course, JspServlet is overriding the container and manage it's own servlets. I'll look at the code and try to port it to 3.3 - and send more comments as I go. ( if anyone wants to help - the fix should go in the container, since in 3.3 jsp-generated servlets are treated as normal servlets ). ( for 3.3 JspServlet - probably a cvs merge will work fine ) Costin On Wed, 25 Apr 2001, Marc Saegesser wrote: I've made some pretty major changes to JspServlet.java to clean up lots of thread synchroniztion problems. The commit message summarizes most of the changes. Because this is a major change very late in the beta cycle I would appreciate it if other developers would give this a through review. Be kind, my head is still spinning from all this synchronization stuff. If no one has any complaints I'll cut a new (and hopfully final) beta release for Tomcat 3.2.2 in a couple days. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 25, 2001 6:30 PM To: [EMAIL PROTECTED] Subject: cvs commit: jakarta-tomcat/src/share/org/apache/jasper/servlet JspServlet.java marcsaeg01/04/25 16:29:30 Modified:src/share/org/apache/jasper/resources Tag: tomcat_32 messages.properties messages_es.properties messages_fr.properties src/share/org/apache/jasper/servlet Tag: tomcat_32 JspServlet.java Log: This is a fairly major update. There were numerous thread synchronization problems involving compiling JSP files. These problems were most apparent on systems running under load in which page re-compilations might happen while pages are being executed and where new requests arrive while a page compilation is underway. I've made lots of changes so I'll just summarize the major differences here. 1) The thread synchronization in doLoadJSP() is quite different. The comments before that method describe the synchronization model in detail. 2) The synchronization in doLoadJSP() is now based on the JspServletWrapper object instead of the JspServlet object. 3) The class loading and the object instantiation used to be split between doLoadJSP() and the JspServletWrapper. They are now combined into a single synchronization block inside doLoadJSP(). 4) In JspServletWrapper, the data member theServlet was used directly by several methods. Access to this is now provided only through a synchronized accessor method(). Any method that needs to obtain the servlet must call getServlet() and store the result in a stack variable (or other per-thread storage). Multiple threads of execution through JspServletWrapper may be executing different servlet classes if a page compilation happened while other requests were being processed. 5) When a new JSP implementation class replaces an existing class, the original classes destroy() method should be called so that any jspDestroy() method on the page will be executed. However, the destroy() method can't be invoked until we know that there are no more requests being processed on that instance. To support this, the JSP implementation class is wrapped inside a new class called JspCountedServlet. This class provides simple reference counting in the service() method. If the classes destroy method is called it flags the class for destruction but does not call the servlet's destroy() method until it determines that the service method has completed on all threads running in the class. PR: 1280 Revision ChangesPath No revision No revision 1.17.2.9 +3 -1 jakarta-tomcat/src/share/org/apache/jasper/resources/messages.properties Index: messages.properties === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/resources/mes sages.properties,v retrieving revision 1.17.2.8 retrieving revision 1.17.2.9 diff -u -r1.17.2.8 -r1.17.2.9 --- messages.properties 2001/01/12 04:47:00 1.17.2.8 +++ messages.properties 2001/04/25 23:29:28 1.17.2.9 @@ -1,4 +1,4 @@ -# $Id: messages.properties,v 1.17.2.8 2001/01/12 04:47:00 larryi Exp $ +# $Id: messages.properties,v 1.17.2.9 2001/04/25 23:29:28 marcsaeg Exp $ # # Default localized string information # Localized this the Default Locale as is en_US @@ -214,3 +214,5 @@ jsp.error.unterminated.user.tag=Unterminated user-defined tag: ending tag {0} not found or incorrectly nested jsp.error.invalid.javaEncoding=Invalid java encodings. Tried {0} and then
Re: jsp's and getPathInfo()
On Wed, 25 Apr 2001, Glenn Nielsen wrote: Hi Gus, Which version of Tocmat are you using? Are you using Apache as a front end to Tomcat? I searched bugzilla and didn't find any bugs reported for any version of Tomcat related to passing pathinfo with a jsp page request. Glenn The servlet spec rules for extension mapping specify that it works only on the *last* component of a request URI path. A side effect of this is that you cannot have path info on a JSP page URI, which used extension mapping on *.jsp. Craig McClanahan Gus Mueller wrote: Hi. I'm finding that when I try and append extra path info to my jsp's like I have in the past my servlets, I get back a page not found. Ok, I can sort of understand that- it's not a real page.. but... If I have a url that's like this: http://localhost/foo/bar.jsp and I make a request like this: http://localhost/foo/bar.jsp/extra/path/info?querystring It gives me back a 404... this isn't the case with servlets. I can do: http://localhost/foo/servlet as the real servlet and: http://localhost/foo/servlet/extra/path/info?querysting works just find. eh? Is this supposed to not work with jsp's? Or have I found a bug I can fix? For what it's worth, I hacked up ContextManager.java and added this at the top of processRequest() to get it to at least find my url. String r = req.getRequestURI(); int x = 0; if ((x = r.indexOf(.jsp/)) 0) { String pathinfo = r.substring(x + 4); String without_path = r.substring(0, x + 4); req.setRequestURI(without_path); req.setPathInfo(pathinfo); } Granted the req.getPathInfo() still returns null when I try and use it in my jsp's later on, but at least it can find my pages now... Thoughts? Suggestions? Am I out of my mind? thanks, -gus -- Christmas means carnage! -- Ferdinand, the duck -- -- Glenn Nielsen [EMAIL PROTECTED] | /* Spelin donut madder| MOREnet System Programming | * if iz ina coment. | Missouri Research and Education Network | */ | --
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java
glenn 01/04/25 18:14:04 Modified:catalina/src/share/org/apache/catalina/core ApplicationContext.java Log: Wrap servlet logging with doPrivileged Revision ChangesPath 1.22 +88 -7 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- ApplicationContext.java 2001/04/25 17:17:49 1.21 +++ ApplicationContext.java 2001/04/26 01:14:02 1.22 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.21 2001/04/25 17:17:49 craigmcc Exp $ - * $Revision: 1.21 $ - * $Date: 2001/04/25 17:17:49 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.22 2001/04/26 01:14:02 glenn Exp $ + * $Revision: 1.22 $ + * $Date: 2001/04/26 01:14:02 $ * * * @@ -111,7 +111,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.21 $ $Date: 2001/04/25 17:17:49 $ + * @version $Revision: 1.22 $ $Date: 2001/04/26 01:14:02 $ */ public final class ApplicationContext @@ -158,10 +158,10 @@ protected class PrivilegedGetResource implements PrivilegedExceptionAction { - - private String path; + +private String path; private String host; - private DirContext resources; +private DirContext resources; PrivilegedGetResource(String host, String path, DirContext resources) { this.host = host; @@ -176,7 +176,59 @@ } +protected class PrivilegedLogMessage +implements PrivilegedAction { + +private String message; + +PrivilegedLogMessage(String message) { +this.message = message; +} + +public Object run() { +internalLog(message); +return null; +} + +} + +protected class PrivilegedLogException +implements PrivilegedAction { + +private String message; +private Exception exception; + +PrivilegedLogException(Exception exception,String message) { +this.message = message; +this.exception = exception; +} + +public Object run() { +internalLog(exception,message); +return null; +} + +} + +protected class PrivilegedLogThrowable +implements PrivilegedAction { + +private String message; +private Throwable throwable; + +PrivilegedLogThrowable(String message,Throwable throwable) { +this.message = message; +this.throwable = throwable; +} + +public Object run() { +internalLog(message,throwable); +return null; +} + +} + // --- Constructors @@ -682,7 +734,17 @@ * @param message Message to be written */ public void log(String message) { +if( System.getSecurityManager() != null ) { +PrivilegedLogMessage dp = +new PrivilegedLogMessage(message); +AccessController.doPrivileged(dp); +} else { +internalLog(message); +} +} +private void internalLog(String message) { + Logger logger = context.getLogger(); if (logger != null) logger.log(message); @@ -700,7 +762,16 @@ * codelog(String, Throwable)/code instead */ public void log(Exception exception, String message) { +if( System.getSecurityManager() != null ) { +PrivilegedLogException dp = +new
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup Bootstrap.java
glenn 01/04/25 18:14:18 Modified:catalina/src/share/org/apache/catalina/startup Bootstrap.java Log: Wrap servlet logging with doPrivileged Revision ChangesPath 1.16 +13 -4 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java Index: Bootstrap.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- Bootstrap.java2001/04/08 00:03:59 1.15 +++ Bootstrap.java2001/04/26 01:14:17 1.16 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v 1.15 2001/04/08 00:03:59 remm Exp $ - * $Revision: 1.15 $ - * $Date: 2001/04/08 00:03:59 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v 1.16 2001/04/26 01:14:17 glenn Exp $ + * $Revision: 1.16 $ + * $Date: 2001/04/26 01:14:17 $ * * * @@ -85,7 +85,7 @@ * class path and therefore not visible to application level classes. * * @author Craig R. McClanahan - * @version $Revision: 1.15 $ $Date: 2001/04/08 00:03:59 $ + * @version $Revision: 1.16 $ $Date: 2001/04/26 01:14:17 $ */ public final class Bootstrap { @@ -134,6 +134,15 @@ catalinaLoader.loadClass (basePackage + core.ApplicationContext$PrivilegedGetRequestDispatcher); +catalinaLoader.loadClass +(basePackage + + core.ApplicationContext$PrivilegedLogMessage); +catalinaLoader.loadClass +(basePackage + + core.ApplicationContext$PrivilegedLogException); +catalinaLoader.loadClass +(basePackage + + core.ApplicationContext$PrivilegedLogThrowable); catalinaLoader.loadClass (basePackage + core.ApplicationDispatcher$PrivilegedForward);
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util CustomObjectInputstream.java
bip 01/04/25 18:30:27 Added: catalina/src/share/org/apache/catalina/util CustomObjectInputstream.java Log: Initial revision, broken out from FileStore. Revision ChangesPath 1.1 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/CustomObjectInputstream.java Index: CustomObjectInputstream.java === /* * CustomObjectInputStream.java * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/CustomObjectInputstream.java,v 1.1 2001/04/26 01:30:27 bip Exp $ * $Revision: 1.1 $ * $Date: 2001/04/26 01:30:27 $ * * * * The Apache Software License, Version 1.1 * * Copyright (c) 1999 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in *the documentation and/or other materials provided with the *distribution. * * 3. The end-user documentation included with the redistribution, if *any, must include the following acknowlegement: * This product includes software developed by the *Apache Software Foundation (http://www.apache.org/). *Alternately, this acknowlegement may appear in the software itself, *if and wherever such third-party acknowlegements normally appear. * * 4. The names The Jakarta Project, Tomcat, and Apache Software *Foundation must not be used to endorse or promote products derived *from this software without prior written permission. For written *permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called Apache *nor may Apache appear in their names without prior written *permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * http://www.apache.org/. * * [Additional notices, if required by prior licensing conditions] * */ package org.apache.catalina.util; import java.io.InputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectStreamClass; /** * Custom subclass of codeObjectInputStream/code that loads from the * class loader for this web application. This allows classes defined only * with the web application to be found correctly. * * @author Craig R. McClanahan * @author Bip Thelin * @version $Revision: 1.1 $, $Date: 2001/04/26 01:30:27 $ */ public final class CustomObjectInputStream extends ObjectInputStream { /** * The class loader we will use to resolve classes. */ private ClassLoader classLoader = null; /** * Construct a new instance of CustomObjectInputStream * * @param stream The input stream we will read from * @param classLoader The class loader used to instantiate objects * * @exception IOException if an input/output error occurs */ public CustomObjectInputStream(InputStream stream, ClassLoader classLoader) throws IOException { super(stream); this.classLoader = classLoader; } /** * Load the local class equivalent of the specified stream class * description, by using the class loader assigned to this Context. * * @param classDesc Class description from the
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session StoreBase.java
bip 01/04/25 18:36:06 Added: catalina/src/share/org/apache/catalina/session StoreBase.java Log: Moved common code from FileStore/JDBCStore into StoreBase. Extended by the concrete Store implementations like FileStore. Each Store now have the ability to implement their own processExpires() and storeStart()/storeStop(). Revision ChangesPath 1.1 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StoreBase.java Index: StoreBase.java === /* * StoreBase.java * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StoreBase.java,v 1.1 2001/04/26 01:36:05 bip Exp $ * $Revision: 1.1 $ * $Date: 2001/04/26 01:36:05 $ * * * * The Apache Software License, Version 1.1 * * Copyright (c) 1999 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in *the documentation and/or other materials provided with the *distribution. * * 3. The end-user documentation included with the redistribution, if *any, must include the following acknowlegement: * This product includes software developed by the *Apache Software Foundation (http://www.apache.org/). *Alternately, this acknowlegement may appear in the software itself, *if and wherever such third-party acknowlegements normally appear. * * 4. The names The Jakarta Project, Tomcat, and Apache Software *Foundation must not be used to endorse or promote products derived *from this software without prior written permission. For written *permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called Apache *nor may Apache appear in their names without prior written *permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * http://www.apache.org/. * * [Additional notices, if required by prior licensing conditions] * */ package org.apache.catalina.session; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.io.IOException; import org.apache.catalina.Container; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleEvent; import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleListener; import org.apache.catalina.Logger; import org.apache.catalina.Manager; import org.apache.catalina.Store; import org.apache.catalina.util.LifecycleSupport; import org.apache.catalina.util.StringManager; /** * Abstract implementation of the Store interface to * support most of the functionality required by a Store. * * @author Bip Thelin * @version $Revision: 1.1 $, $Date: 2001/04/26 01:36:05 $ */ public abstract class StoreBase implements Lifecycle, Runnable, Store { // - Instance Variables /** * The descriptive information about this implementation. */ protected static String info = StoreBase/1.0; /** * The interval (in seconds) between checks for expired sessions. */ protected int checkInterval = 60; /** * Name to
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session JDBCStore.java
bip 01/04/25 18:38:01 Added: catalina/src/share/org/apache/catalina/session JDBCStore.java Log: A concrete Store implementation that uses a JDBC compatible RDBMS to store Sessions. Revision ChangesPath 1.1 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/JDBCStore.java Index: JDBCStore.java === /* * JDBCStore.java * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/JDBCStore.java,v 1.1 2001/04/26 01:37:59 bip Exp $ * $Revision: 1.1 $ * $Date: 2001/04/26 01:37:59 $ * * * * The Apache Software License, Version 1.1 * * Copyright (c) 1999 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in *the documentation and/or other materials provided with the *distribution. * * 3. The end-user documentation included with the redistribution, if *any, must include the following acknowlegement: * This product includes software developed by the *Apache Software Foundation (http://www.apache.org/). *Alternately, this acknowlegement may appear in the software itself, *if and wherever such third-party acknowlegements normally appear. * * 4. The names The Jakarta Project, Tomcat, and Apache Software *Foundation must not be used to endorse or promote products derived *from this software without prior written permission. For written *permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called Apache *nor may Apache appear in their names without prior written *permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * http://www.apache.org/. * * [Additional notices, if required by prior licensing conditions] * */ package org.apache.catalina.session; import java.io.InputStream; import java.io.OutputStream; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.ObjectStreamClass; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.apache.catalina.Container; import org.apache.catalina.Loader; import org.apache.catalina.Session; import org.apache.catalina.Store; import org.apache.catalina.util.CustomObjectInputStream; /** * Implementation of the codeStore/code interface that stores * serialized session objects in a database. Sessions that are * saved are still subject to being expired based on inactivity. * * @author Bip Thelin * @version $Revision: 1.1 $, $Date: 2001/04/26 01:37:59 $ */ public class JDBCStore extends StoreBase implements Store { /** * The descriptive information about this implementation. */ protected static String info = JDBCStore/1.0; /** * Name to register for this Store, used for logging. */ protected static String storeName = JDBCStore; /** * Name to register
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session LocalStrings.properties
bip 01/04/25 18:41:00 Modified:catalina/src/share/org/apache/catalina/session LocalStrings.properties Log: Added entries for JDBCStore. Revision ChangesPath 1.7 +10 -0 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/LocalStrings.properties Index: LocalStrings.properties === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/LocalStrings.properties,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- LocalStrings.properties 2001/04/15 10:50:04 1.6 +++ LocalStrings.properties 2001/04/26 01:40:55 1.7 @@ -5,6 +5,16 @@ fileStore.saving=Saving Session {0} to file {1} fileStore.loading=Loading Session {0} from file {1} fileStore.removing=Removing Session {0} at file {1} +JDBCStore.alreadyStarted=JDBC Store has already been started +JDBCStore.notStarted=JDBC Store has not yet been started +JDBCStore.saving=Saving Session {0} to database {1} +JDBCStore.loading=Loading Session {0} from database {1} +JDBCStore.removing=Removing Session {0} at database {1} +JDBCStore.SQLException=SQL Error {0} +JDBCStore.checkConnectionDBClosed=The database connection is null or was found to be closed. Trying to re-open it. +JDBCStore.checkConnectionDBReOpenFail=The re-open on the database failed. The database could be down. +JDBCStore.checkConnectionSQLException=A SQL exception occured {0} +JDBCStore.checkConnectionClassNotFoundException=JDBC driver class not found {0} managerBase.complete=Seeding of random number generator has been completed managerBase.getting=Getting message digest component for algorithm {0} managerBase.gotten=Completed getting message digest component
Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/sessionStoreBase.java
On 26 Apr 2001 [EMAIL PROTECTED] wrote: Each Store now have the ability to implement their own processExpires() and storeStart()/storeStop(). The typical design pattern for most subclassable components in Catalina is to have the subclass simply override the methods it needs to, with an appropriate call to the superclass method. For example, FileStore would implement: public void start() throws LifecycleException { ... stuff before superclass start() is called ... super.start(); ... stuff after superclass start() is called ... } I'd prefer if we used that pattern here as well. While you are at it, the current convention in Tomcat is to use spaces rather than embedded tabs for indentation. I know some of the old code that you cut and pasted from probably had tabs in it, but new code (and patches to old code) should use spaces instead. Craig
Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/sessionStoreBase.java
While you are at it, the current convention in Tomcat is to use spaces rather than embedded tabs for indentation. I know some of the old code Is it a convention or an absolute requirement ? Costin ( waiting for the space police to remove my tabs :-)
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util CustomObjectInputStream.java
craigmcc01/04/25 19:45:11 Added: catalina/src/share/org/apache/catalina/util CustomObjectInputStream.java Log: Add for Bip ... CVS is giving him a screwy error message. Revision ChangesPath 1.1 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/CustomObjectInputStream.java Index: CustomObjectInputStream.java === /* * CustomObjectInputStream.java * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/CustomObjectInputStream.java,v 1.1 2001/04/26 02:45:10 craigmcc Exp $ * $Revision: 1.1 $ * $Date: 2001/04/26 02:45:10 $ * * * * The Apache Software License, Version 1.1 * * Copyright (c) 1999 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in *the documentation and/or other materials provided with the *distribution. * * 3. The end-user documentation included with the redistribution, if *any, must include the following acknowlegement: * This product includes software developed by the *Apache Software Foundation (http://www.apache.org/). *Alternately, this acknowlegement may appear in the software itself, *if and wherever such third-party acknowlegements normally appear. * * 4. The names The Jakarta Project, Tomcat, and Apache Software *Foundation must not be used to endorse or promote products derived *from this software without prior written permission. For written *permission, please contact apache@@apache.org. * * 5. Products derived from this software may not be called Apache *nor may Apache appear in their names without prior written *permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * http://www.apache.org/. * * [Additional notices, if required by prior licensing conditions] * */ package org.apache.catalina.util; import java.io.InputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectStreamClass; /** * Custom subclass of codeObjectInputStream/code that loads from the * class loader for this web application. This allows classes defined only * with the web application to be found correctly. * * @@author Craig R. McClanahan * @@author Bip Thelin * @@version $Revision: 1.1 $, $Date: 2001/04/26 02:45:10 $ */ public final class CustomObjectInputStream extends ObjectInputStream { /** * The class loader we will use to resolve classes. */ private ClassLoader classLoader = null; /** * Construct a new instance of CustomObjectInputStream * * @@param stream The input stream we will read from * @@param classLoader The class loader used to instantiate objects * * @@exception IOException if an input/output error occurs */ public CustomObjectInputStream(InputStream stream, ClassLoader classLoader) throws IOException { super(stream); this.classLoader = classLoader; } /** * Load the local class equivalent of the specified stream class * description, by using the class loader assigned to this Context. * * @@param classDesc
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java
craigmcc01/04/25 20:09:09 Modified:catalina/src/share/org/apache/catalina/core StandardWrapperValve.java Log: [PFD2-9.9.2] - Implement the revised algorithm for looking up the error page associated with an exception thrown by the top-level servlet (first match wins): - Look for an error page with this exact exception class - Look for an error page for progressive superclasses of the exception class - If this exception is a ServletException with a rootCause property, rerun the above two steps on the rootCause exception - Display the container's standard error page. NOTE: Currently, four of the ErrorPage tests in tester will fail, because they assume that the exception forwarded to the error page will be the root cause exception, rather that the ServletException. I've submitted a request for clarification to know which behavior is correct, and will change either the logic or the tests accordingly. Revision ChangesPath 1.24 +44 -18 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java Index: StandardWrapperValve.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- StandardWrapperValve.java 2001/03/30 19:33:37 1.23 +++ StandardWrapperValve.java 2001/04/26 03:09:07 1.24 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v 1.23 2001/03/30 19:33:37 craigmcc Exp $ - * $Revision: 1.23 $ - * $Date: 2001/03/30 19:33:37 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v 1.24 2001/04/26 03:09:07 craigmcc Exp $ + * $Revision: 1.24 $ + * $Date: 2001/04/26 03:09:07 $ * * * @@ -103,7 +103,7 @@ * codeStandardWrapper/code container implementation. * * @author Craig R. McClanahan - * @version $Revision: 1.23 $ $Date: 2001/03/30 19:33:37 $ + * @version $Revision: 1.24 $ $Date: 2001/04/26 03:09:07 $ */ final class StandardWrapperValve @@ -499,26 +499,23 @@ Throwable exception) { // Handle a custom error page for this status code - Context context = (Context) container.getParent(); - Throwable realError = exception; - if (exception instanceof ServletException) { - Throwable rootCause = - ((ServletException) exception).getRootCause(); - if (rootCause != null) - realError = rootCause; - } if (debug = 1) -log(Handling exception: + realError.toString()); -ErrorPage errorPage = - context.findErrorPage(realError.getClass().getName()); +log(Handling exception: + exception); + Context context = (Context) container.getParent(); +Throwable realError = exception; +ErrorPage errorPage = findErrorPage(context, realError); +if ((errorPage == null) (realError instanceof ServletException)) { +realError = ((ServletException) exception).getRootCause(); +errorPage = findErrorPage(context, realError); +} if (errorPage != null) { //if (debug = 1) //log( Sending to custom error page + errorPage); ServletRequest sreq = request.getRequest(); sreq.setAttribute(Globals.ERROR_MESSAGE_ATTR, - realError.getMessage()); + exception.getMessage()); sreq.setAttribute(Globals.EXCEPTION_ATTR, - realError); + exception); Wrapper wrapper = (Wrapper) getContainer(); sreq.setAttribute(Globals.SERVLET_NAME_ATTR, wrapper.getName()); @@ -526,7 +523,7 @@ sreq.setAttribute(Globals.EXCEPTION_PAGE_ATTR, ((HttpServletRequest) sreq).getRequestURI()); sreq.setAttribute(Globals.EXCEPTION_TYPE_ATTR, - realError.getClass()); + exception.getClass()); if (custom(request, response, errorPage)) return; } @@ -618,6 +615,35 @@ } //if (debug = 1) //log( Finished with exception() report); + +} + + +/** + * Find and return the ErrorPage instance for the specified exception's + * class, or an ErrorPage instance for the closest superclass for which + * there is such a
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java
craigmcc01/04/25 20:12:53 Modified:catalina/src/share/org/apache/catalina/core StandardWrapperValve.java Log: Oops, deal with a NullPointerException issue of the servlet exception does *not* wrap a root cause. Revision ChangesPath 1.25 +8 -5 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java Index: StandardWrapperValve.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- StandardWrapperValve.java 2001/04/26 03:09:07 1.24 +++ StandardWrapperValve.java 2001/04/26 03:12:51 1.25 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v 1.24 2001/04/26 03:09:07 craigmcc Exp $ - * $Revision: 1.24 $ - * $Date: 2001/04/26 03:09:07 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v 1.25 2001/04/26 03:12:51 craigmcc Exp $ + * $Revision: 1.25 $ + * $Date: 2001/04/26 03:12:51 $ * * * @@ -103,7 +103,7 @@ * codeStandardWrapper/code container implementation. * * @author Craig R. McClanahan - * @version $Revision: 1.24 $ $Date: 2001/04/26 03:09:07 $ + * @version $Revision: 1.25 $ $Date: 2001/04/26 03:12:51 $ */ final class StandardWrapperValve @@ -506,7 +506,10 @@ ErrorPage errorPage = findErrorPage(context, realError); if ((errorPage == null) (realError instanceof ServletException)) { realError = ((ServletException) exception).getRootCause(); -errorPage = findErrorPage(context, realError); +if (realError != null) +errorPage = findErrorPage(context, realError); +else +realError = exception; } if (errorPage != null) { //if (debug = 1)
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session JDBCStore.java StoreBase.java
bip 01/04/25 20:15:01 Modified:catalina/src/share/org/apache/catalina/session JDBCStore.java StoreBase.java Log: Changed subclassing of start()/stop(). Cosmetic changes, tabs to spaces. Revision ChangesPath 1.2 +383 -378 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/JDBCStore.java Index: JDBCStore.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/JDBCStore.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- JDBCStore.java2001/04/26 01:37:59 1.1 +++ JDBCStore.java2001/04/26 03:14:59 1.2 @@ -1,8 +1,8 @@ /* * JDBCStore.java - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/JDBCStore.java,v 1.1 2001/04/26 01:37:59 bip Exp $ - * $Revision: 1.1 $ - * $Date: 2001/04/26 01:37:59 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/JDBCStore.java,v 1.2 2001/04/26 03:14:59 bip Exp $ + * $Revision: 1.2 $ + * $Date: 2001/04/26 03:14:59 $ * * * @@ -81,6 +81,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import org.apache.catalina.Container; +import org.apache.catalina.LifecycleException; import org.apache.catalina.Loader; import org.apache.catalina.Session; import org.apache.catalina.Store; @@ -92,7 +93,7 @@ * saved are still subject to being expired based on inactivity. * * @author Bip Thelin - * @version $Revision: 1.1 $, $Date: 2001/04/26 01:37:59 $ + * @version $Revision: 1.2 $, $Date: 2001/04/26 03:14:59 $ */ public class JDBCStore @@ -198,21 +199,21 @@ * Return the info for this Store. */ public String getInfo() { - return(info); +return(info); } /** * Return the thread name for this Store. */ public String getThreadName() { - return(threadName); +return(threadName); } /** * Return the name for this Store, used for logging. */ public String getStoreName() { - return(storeName); +return(storeName); } /** @@ -221,19 +222,19 @@ * @param driverName The new driver */ public void setDriverName(String driverName) { - String oldDriverName = this.driverName; - this.driverName = driverName; - support.firePropertyChange(driverName, -oldDriverName, -this.driverName); - this.driverName = driverName; +String oldDriverName = this.driverName; +this.driverName = driverName; +support.firePropertyChange(driverName, + oldDriverName, + this.driverName); +this.driverName = driverName; } /** * Return the driver for this Store. */ public String getDriverName() { - return(this.driverName); +return(this.driverName); } /** @@ -242,18 +243,18 @@ * @param connectionURL The new Connection URL */ public void setConnectionURL(String connectionURL) { - String oldConnString = this.connString; - this.connString = connectionURL; - support.firePropertyChange(connString, -oldConnString, -this.connString); +String oldConnString = this.connString; +this.connString = connectionURL; +support.firePropertyChange(connString, + oldConnString, + this.connString); } /** * Return the Connection URL for this Store. */ public String getConnectionURL() { - return(this.connString); +return(this.connString); } /** @@ -262,18 +263,18 @@ * @param sessionTable The new table */ public void setSessionTable(String sessionTable) { - String oldSessionTable = this.sessionTable; - this.sessionTable = sessionTable; - support.firePropertyChange(sessionTable, -oldSessionTable, -this.sessionTable); +String oldSessionTable = this.sessionTable; +this.sessionTable = sessionTable; +support.firePropertyChange(sessionTable, + oldSessionTable, + this.sessionTable); } /** * Return the table for this Store. */ public String getSessionTable() { - return(this.sessionTable); +