Stopping external access to jsp files
Hi Everyone, After some good advise from members of this lists (thanks again) I have started learning about servlets. I have created a simple servlet that act as a controller in my webapp, this is where all requests get sent to. However I have not been able to find a way to stop users from getting to the .jsp files that the servlet uses for the presentation element. I know that I could use Tomcat along with Apache HTTP server to restrict access to the JSP pages but I was wondering if anyone knew how to specify in the web.xml file that users should not be able to get to the jsp's but the servlets (and jsp's can access other jsp's via include or forward). My reading of the docs on the tomcat website and by STW have not yielded any suggestions. Thanks again. Regards Lee - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help Running Tomcat
Ivon Gonzalez wrote: The servlet.jar file needs to exist in both Tomcat and the JDK - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] That is why you setup your CLASSPATH environment. For example mine is(Excuse the line wrapping): C:\Program Files\Apache Group\Tomcat 4.1\common\lib\servlet.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib;c:\JMF\lib\jmf.jar;. By having this setup both tomcat and your Java development enviroment have access to the servlet (and whatever other item you have it in, such as Java Media Framework, jmf.jar) classes. Regards Lee - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help Running Tomcat
Ivon Gonzalez wrote: I have set up a few computers with Tomcat on a network and local machines. I am having problems running Tomcat on this particular machine which is on a network. I have moved the servlet.jar file to the java sdk home/jre/lib/ext. I have set up JAVA_HOME to point to my sdk location and the TOMCAT_HOME to the tomcat location. when I run Tomcat by typing tomcat startup or tomcat start it opens a new dos window and closes it immediately. I type in tomcat run and it gives me this error: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tomcat/logging/Logger What could be causing this error? How do I fix it so that I can run Tomcat on this machine. Could the current network setup interfere? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] . Ivon, I don't think this is the reason for the problem but why are you moving the servlet.jar file. All the instructions I have ready so far (yes I am still a newbie) say to simply set the classpath to point to where the servlet.jar file is, on a windows machine(and I think unix/linux as well) it should be in %CATALINA_HOME%\common\lib\servlet.jar. Have you set the environment variables (JAVA_HOME, CATLINA_HOME, CLASSPATH)? Just though I would add my 2 pennies worth. Regards Lee - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Custom error pages & Internet Explorer
What is going on with my typing today :-< Do you think to is any OK was to have done it or could it cause problems ? Should have read as: Do you think is was OK to have done it like this or could it cause problems ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Custom error pages & Internet Explorer
Michael Duffy wrote: Hi Lee, Do you have tags in your web.xml? You can tell Tomcat to send 404 errors to a JSP of your choosing by adding something like this to web.xml, after and before : 404 /not-found.jsp Put your custom message in not-found.jsp. HTH - MOD Hi Michael, Yep I have got that stuff in web.xml. I think I've figured out what the problem is although I am not sure if it is the best way to have done it. When I was specifying the setStatus tag I was only using the variable name not the fully quantified package so therefore when I changed it to: response.setStatus( javax.servlet.http.HttpServletResponseWrapper.SC_NOT_FOUND); The page appears to work fine in both IE & Mozilla. Do you think to is any OK was to have done it or could it cause problems ? Regards Lee - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Custom error pages & Internet Explorer
Hi, I have just started learning JSP & Tomcat so please be gentle. I am currently designing a webapp and was trying to get some custom error pages working (currently just to handle 404, page cannot be found). However they don't seem to work in Internet Explorer. All of the default Tomcat errors work fine and so do my custom ones when viewed in Mozilla, however IE just displays the default Microsoft errors. I though that maybe IE was using the HTTP return code in order to determine which page was displayed so I try changing that code using (in the custom error jsp page): response.setStatus() - with codes SC_OK, SC_MOVE_TEMPORARILY All this ended up doing is was breaking Mozilla & causing the default Tomcat errors to come back. Searching though the achives someone posted a similar problem last year but either the archive does not have the replies or no-one replied to the poster. Any help here would be appreciated. Regards Lee - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]