Re: How to hide login pages
I am not validating the form. I'm using the FORM authentication provided by Tomcat, so Tomcat is validating the form. Dave Chad Wray [EMAIL PROTECTED] on 08/02/2001 10:32:55 AM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: Re: How to hide login pages Are you including mylogin.jsp on every page? I am a little confused because if you are validating a form then you can check to see if the form was submitted or not. Can you send a small piece of the code, so we can take a look. -- Chad --- [EMAIL PROTECTED] wrote: I thought of this but I don't think this will work. Login is a special case. If the user has not yet logged in and they enter a URL to a page (any valid page) the container (Tomcat) automatically returns the login page and then AFTER successful login redirects them to the page. Therefore whether the user enters a valid page or the login page directly, the login page is returned BEFORE any other page in my webapp. I never have a chance to create a session object. After successful login I think your suggestion works but I want to catch it before login as well. Or am I missing something here. Thanks, Dave Chad Wray [EMAIL PROTECTED] on 08/02/2001 09:13:31 AM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: Re: How to hide login pages This may be a pain to implement if you have lots of pages in your website, but it would work. You could use a Session variable to hold onto where you are in the site. Then if you have a link that calls mylogin.jsp or another page that calls mylogin.jsp just check to see who called the page. So, on every page you would need to set the variable to null or some error value and then if the user clicks the login link then you could set the variable to a valid value. You are probably asking how can I set a value from a link. Well, have the link call the same page it is on and pass a value on the URL and then set the Session variable and redirect to mylogin.jsp. Then, on mylogin.jsp check the Session variable and if it is valid continue otherwise use javascript to go back one page. This would stop people from typing mylogin.jsp in the Address of the browser. Hope this helps. -- Chad --- [EMAIL PROTECTED] wrote: I'm using FORM authentication and I would like to hide the login JSP files so the users don't access them directly. For example, I don't want the user to be able to enter the URL http://myserver/mywebapp/mylogin.jsp since this will not work (since there is no original url to redirect them to they get redirected to j_security_check). I've tried putting my login files in WEB-INF but then when they try to access a page in my webapp they get file not found error. I've tried putting the login files in a secured directory under my webapp but this puts the ContextManager in an infinite loop. Any ideas? Thanks, Dave __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Re: How to hide login pages
I thought of this but I don't think this will work. Login is a special case. If the user has not yet logged in and they enter a URL to a page (any valid page) the container (Tomcat) automatically returns the login page and then AFTER successful login redirects them to the page. Therefore whether the user enters a valid page or the login page directly, the login page is returned BEFORE any other page in my webapp. I never have a chance to create a session object. After successful login I think your suggestion works but I want to catch it before login as well. Or am I missing something here. Thanks, Dave Chad Wray [EMAIL PROTECTED] on 08/02/2001 09:13:31 AM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: Re: How to hide login pages This may be a pain to implement if you have lots of pages in your website, but it would work. You could use a Session variable to hold onto where you are in the site. Then if you have a link that calls mylogin.jsp or another page that calls mylogin.jsp just check to see who called the page. So, on every page you would need to set the variable to null or some error value and then if the user clicks the login link then you could set the variable to a valid value. You are probably asking how can I set a value from a link. Well, have the link call the same page it is on and pass a value on the URL and then set the Session variable and redirect to mylogin.jsp. Then, on mylogin.jsp check the Session variable and if it is valid continue otherwise use javascript to go back one page. This would stop people from typing mylogin.jsp in the Address of the browser. Hope this helps. -- Chad --- [EMAIL PROTECTED] wrote: I'm using FORM authentication and I would like to hide the login JSP files so the users don't access them directly. For example, I don't want the user to be able to enter the URL http://myserver/mywebapp/mylogin.jsp since this will not work (since there is no original url to redirect them to they get redirected to j_security_check). I've tried putting my login files in WEB-INF but then when they try to access a page in my webapp they get file not found error. I've tried putting the login files in a secured directory under my webapp but this puts the ContextManager in an infinite loop. Any ideas? Thanks, Dave __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
RE: How can I logoff
I'm using form authentication and used session.invalidate(). This works great but the browser may be cacheing your logoff page, in which case you may get some unexpected results if you logoff and back in more than once. You need to disable the page cacheing. I used the following in the head section of my page. meta http-equiv=Pragma content=no-cache meta http-equiv=Expires content=0 Hopefully this little tidbit will help someone else avoid a few hours of debugging that I went through. :o) Dave
Re: Default folder in Tomcat
If you don't want to be tied to the servlet you could use the class loader by doing something like one of the following: // Use this if you don't care where the file is located (just doing reads) this.getClass().getResourceAsStream(xyz.properties) // Use this if need to know where the file is located (writing back to the file) URL resUrl = this.getClass().getClassLoader().getResource(xyz.properties); if (resUrl != null) { Properties props = new Properties(); FileInputStream fs = new FileInputStream(resUrl.getFile()); props.load(fs); } Ludovic Maitre [EMAIL PROTECTED]@sophia.inria.fr on 07/27/2001 09:14:35 AM Please respond to [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: Re: Default folder in Tomcat hello, you can obtain the path where your application is located with the following function : WEBAPP_ROOT = getServletConfig().getServletContext().getRealPath() this is obtained from the sample file realpath.jsp, that i sugger you read. After obtaining the location of your webapp, simply add WEB-INF + the name of the property file. [EMAIL PROTECTED] wrote: Hello, I am using Tomcat for the first time, I have a doubt, can someone help me with that please. I am refering to some properties files from my Bean. I do not want to hardcode the path in my code. Can someone plesae tell me the default folder that the server reads from. I tried putting my files in my webapps folder , it doesnt seem to work. Thanks in advance. regs M -- [EMAIL PROTECTED] INRIA - 2004 route des lucioles - BP 93Tel: (33/0) 4 92 38 50 41 06902 SOPHIA-ANTIPOLIS cedex (France)Fax: (33/0) 4 92 38 76 02
Re: question about WEB-INF/lib
Oh, I'm so embarrased! I should have actually LOOKED at our tomcat.bat/sh files. We had created a 'realm' for our own custom authentication. The new classes are in the same packages as our webapp classes, so someone added our webapp/WEB-INF/classes directory to the classpath for tomcat. Very bad! Our classes were being loaded by the parent classloader and when we tried to access a 3rd party class within the webapp's lib it couldn't be found. I moved these classes into a separate jar, put that jar in tomcat/lib, removed the classpath modification, and everything works great. As a suggestion to Joe, you may want to put some trace messages in your classes and print out the class loaders. Another thing I did was install a clean version of tomcat and create a very simple webapp with some jsp that calls a bean that calls a 3rd party class. I also made sure there was nothing in my CLASSPATH. This just verified that it was my problem and not Tomcat's. Thanks for the help. I learned a lot on this thread of discussion. Sorry it was at the expense of others. :o) Dave Craig R. McClanahan [EMAIL PROTECTED] on 07/25/2001 06:34:18 PM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: Re: question about WEB-INF/lib The other side of the coin is that I know for a fact that web apps using JAR files in /WEB-INF/lib can run under Tomcat 3.2 (example: download Struts, deploy the struts-example.war application, restart Tomcat, and run it). So it's *not* as simple as saying Tomcat does not know how to load application classes from /WEB-INF/classes or /WEB-INF/lib/*.jar files. You will also find that Tomcat can indeed load applications from /WEB-INF/classes for at least some users -- otherwise, none of the /examples servlets or jsp pages shipped with Tomcat would work at all. Your webapp sounds like it is set up correctly ... now let's look at your environment. I'm going to start with the assumption that you have *not* tried to manually manipulate your CLASSPATH to put the webapp's /WEB-INF/classes directory (or any JAR files under /WEB-INF/lib) specifically on it. The most critical issue (and the one that will definitely cause ClassNotFoundException errors) is to have a copy of one of the same application classes (or the JDBC driver classes in your case) *also* visible through the CLASSPATH (since you're using Tomcat 3.2 this matters), in $TOMCAT_HOME/lib, or in your Java extensions directory ($JAVA_HOME/jre/lib/ext). The reason this causes you grief is that, because of the way Java class loading works in Tomcat 3.2, the shared version of the class will be loaded. And, this shared copy (because it was loaded from a classloader that is the parent of the webapp class loader) cannot itself load classes from the webapp classloader (in class loading terms, delegation can go *up* the classloader hierarchy but not *down*). If this is not the cause of the problem, the only way to resolve it is to create a minimal webapp that illustrates the problem, and post it along with a bug report. However, my experience has been that CLASSPATH issues are by far the most common cause of ClassNotFoundException problems that Tomcat users run into. Craig McClanahan PS: Classpath problems are so prevalent that Tomcat 4's startup scripts totally ignore the user's CLASSPATH variable. If you want to share JARs across multiple webapps, put them in $TOMCAT_HOME/lib -- otherwise, put them in the /WEB-INF/lib directory of the webapp that needs them. This strategy also works in Tomcat 3.2 (as long as you don't have so many JARs in $TOMCAT_HOME/lib that the environment variable length of your OS is exceeded). On 25 Jul 2001, Joseph D Toussaint wrote: I'm pretty certain that my war file is set up correctly. In my WEB-INF/lib directoy I have jdbc jar file that tomcat can't find and the tomcat user manual for deploying tomcat applications says WEB-INF/lib/ - This directory contains JAR files that contain Java class files (and associated resources) required for your application, such as third party class libraries or JDBC drivers. My servlets are in the WEB-INF/classes directory and the same document says WEB-INF/classes/ - This directory contains any Java class files (and associated resources) required for your application, including both servlet and non-servlet classes, that are not combined into JAR files. Aside from that I have read the Servlet 2.3 spec on this topic and it says this about the WEB-INF/lib The /WEB-INF/lib/*.jar area for Java ARchive files. These files contain servlets, beans, and other utility classes useful to the web application. The web application class loader can load class from any of these archive files. Here is what it says about the WEB-INF/classes directory The /WEB-INF/classes/* directory for servlet and utility classes. The classes in this directory are available to the application class
Re: question about WEB-INF/lib
I'm running on NT (development) and Redhat Linux (production). startup.bat and startup.sh (actually tomcat.bat/tomcat.sh) add the jar files from tomcat/lib to the classpath but do not add jars from WEB-INF/lib of the individual webapps. Thanks, Dave Joseph D Toussaint [EMAIL PROTECTED] on 07/24/2001 07:33:49 PM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: Re: question about WEB-INF/lib Out of curiosity what are you runing tomcat on unix or nt? Maybe there is a diffrence between startup.bat and startup.sh??? joe On 25 Jul 2001 08:05:31 +1000, Dmitri Colebatch wrote: I can verify it does work. I dont have any suggestions though - sorry. cheesr dim On Tue, 24 Jul 2001 [EMAIL PROTECTED] wrote: I see this problem, too. I'm using Tomcat 3.2.x. It appears to me to be a bug. I've seen others with this problem on this mailing list. Can anyone verify that this actually does work? (Just trying to add some weight to your claim and get it fixed if it is a bug. :o) Thanks, Dave Joseph D Toussaint [EMAIL PROTECTED] on 07/24/2001 11:55:44 AM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: question about WEB-INF/lib It's my understanding that any jar files in the WEB-INF/lib directory should be found by the container when the app is deployed - however I havea jdbc driver in that directory and I'm getting a class not found exception. When ever I have set up tomcat before I've always edited the tomcat.sh script so search all the WEB-INF/lib directories for every web application - however this time I'd like to do it right. Thanks! joe -- ## # Joseph Toussaint # # Caribou Lake Software # # http://www.cariboulake.com # # [EMAIL PROTECTED] # # 952-837-98029 # ## -- ## # Joseph Toussaint # # Caribou Lake Software # # http://www.cariboulake.com # # [EMAIL PROTECTED] # # 952-837-98029 # ##
Re: question about WEB-INF/lib
This is my workaround as well, but it is not a very good solution. I often have multiple webapps running that need different versions of the same jar file. This becomes a real pain. Thanks, Dave john regan [EMAIL PROTECTED] on 07/24/2001 05:20:39 PM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: Re: question about WEB-INF/lib (a newbie speaks...) Are you looking for a workaround? When I saw this problem, I copied the jar file to tomcat's lib directory and it worked. I thought maybe I had misread something in the doc. Like I said, I'm new here, but I agree that this is not what I expected to do. -john Dmitri Colebatch wrote: I can verify it does work. I dont have any suggestions though - sorry. cheesr dim On Tue, 24 Jul 2001 [EMAIL PROTECTED] wrote: I see this problem, too. I'm using Tomcat 3.2.x. It appears to me to be a bug. I've seen others with this problem on this mailing list. Can anyone verify that this actually does work? (Just trying to add some weight to your claim and get it fixed if it is a bug. :o) Thanks, Dave Joseph D Toussaint [EMAIL PROTECTED] on 07/24/2001 11:55:44 AM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: question about WEB-INF/lib It's my understanding that any jar files in the WEB-INF/lib directory should be found by the container when the app is deployed - however I havea jdbc driver in that directory and I'm getting a class not found exception. When ever I have set up tomcat before I've always edited the tomcat.sh script so search all the WEB-INF/lib directories for every web application - however this time I'd like to do it right. Thanks! joe -- ## # Joseph Toussaint # # Caribou Lake Software # # http://www.cariboulake.com # # [EMAIL PROTECTED] # # 952-837-98029 # ##
Re: question about WEB-INF/lib
I see this problem, too. I'm using Tomcat 3.2.x. It appears to me to be a bug. I've seen others with this problem on this mailing list. Can anyone verify that this actually does work? (Just trying to add some weight to your claim and get it fixed if it is a bug. :o) Thanks, Dave Joseph D Toussaint [EMAIL PROTECTED] on 07/24/2001 11:55:44 AM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: question about WEB-INF/lib It's my understanding that any jar files in the WEB-INF/lib directory should be found by the container when the app is deployed - however I havea jdbc driver in that directory and I'm getting a class not found exception. When ever I have set up tomcat before I've always edited the tomcat.sh script so search all the WEB-INF/lib directories for every web application - however this time I'd like to do it right. Thanks! joe -- ## # Joseph Toussaint # # Caribou Lake Software # # http://www.cariboulake.com # # [EMAIL PROTECTED] # # 952-837-98029 # ##
Wrong scope for scripting variable
Hi, I've written some custom JSP tags that create scripting variables to be used in a JSP page. These tags are nested. I use the VariableInfo.AT_BEGIN for the scope in my VariableInfo objects. The JSP 1.1 specification indicates that the scope of my variables should be from the start tag to the end of the page. This works fine for the top level tag, but the scope of the variables in the nested tags is only to then end tag of the enclosing tag (not the end of the page). When I look at the java code generated for my JSP, sure enough the variable is declared within the scope of the enclosing tag. Is this a bug or am I reading the 1.1 specification wrong? Is this a known bug? If it is, is there a planned fix? I also tried using AT_END but get the same behavior. I've run this under Tomcat 3.2.2 and 3.2.3 with the same results. As an example: x:foo id='toplevel' x:bar id='leve2' / /x:foo %-- The following works. --% p%= toplevel.getSomeText() % %-- The following does NOT work. --% p%= leve2.getSomeText() % Thanks, Dave