RE: protecting a non-jsp file from accessing
I would include the file in the same place as the class file (in the app-root/web-inf/classes/...)- then you can use something like yourclassname.class.getResourceAsStream(sub folder relative to class's package/db.cfg); Then you can read the configuration properties from that stream (Dont forget to close it after reading the contents). By default tomcat blocks all access to the web-inf folder S. -Original Message- From: Venkat Dosapati [mailto:[EMAIL PROTECTED]] Sent: Friday, December 21, 2001 12:47 AM To: Tomcat Users List Subject: protecting a non-jsp file from accessing Hi, I have been using Tomcat 3.2.1 with Apache for my application deployment. In my application I have a database configuration file called db.cfg. The file is placed in document root directory. Now my problem is that the file can be accessed through the browser by using http://VirtualHostName/db.cfg. Is there anyway to block the file from users. Any ideas will be appreciated. Thanx in advance. Venkat -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: servlet-mapping problem - tomcat 4.0.1
set the welcome file list element to the URL address you want to default to Something like - welcome-file-list welcome-filepages/main.jsp/welcome-file /welcome-file-list This will default a user going to your context to the file pages/main.jsp - Tomcat (4.1) has a few default context attributes which are located in the CATALINA_HOME/conf/web.xml which a context will default to if the welcome file list element is not specified - they are as follows welcome-file-list welcome-fileindex.html/welcome-file welcome-fileindex.htm/welcome-file welcome-fileindex.jsp/welcome-file /welcome-file-list HTH S. -Original Message- From: Scott Eade [mailto:[EMAIL PROTECTED]] Sent: Friday, December 21, 2001 6:54 AM To: [EMAIL PROTECTED] Subject: servlet-mapping problem - tomcat 4.0.1 How do I default a user to my servlet without blocking access to other directories? Using a default mapping of / results in failure to gain access to resources under my servlet directory. I think I have a fairly standard set-up of tomcat 4.0.1 on win2k. Within C:\jakarta-tomcat-4.0.1\webapps I have a directory structure like this: myapp styles global.css WEB_INF web.xml lib [jar files] web.xml defines a servlet whose output includes a reference to http://mysite.com/myapp/styles/global.css If I set my servlet mapping up like this: servlet-mapping servlet-namemyapp/servlet-name url-pattern//url-pattern /servlet-mapping then the stylesheet cannot be loaded when the user surfs to http://mysite.com/myapp/ Alternatively if I set up my mapping like this: servlet-mapping servlet-namemyapp/servlet-name url-pattern/foo/*/url-pattern /servlet-mapping then the stylesheet can be located, but the user must surf to http://mysite.com/myapp/foo/ How can I configure tomcat or structure my directories so that a user can surf to http://mysite.com/myapp/ and also successfully access the stylesheet? Note that the above is a contrived example. The real servlet includes many other resources in the myapp directory to which the servlet refers. Any advice would be most welcome. Thanks, Scott -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: Illegal State Exception
You are doing something like res.getOutputStream().write(data); twice within the same request. This could be for several reasons and it general occurs when you include a page in your response and then try to use the above - you can do a response.isCommited() to check the state of the response. -Original Message- From: Justin Rowles [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 19, 2001 10:03 AM To: 'Tomcat Users List' Subject: Illegal State Exception At intervals I get this error (or very similar). I have previously got rid of it by removing what I last did! Last time, it appeared to be caused by calling the first() method on a ResultSet. This time I have made several changes and have no idea what the cause is. How can I pursue it through my code from the information I have below? Justin. -- You're only jealous cos the little penguins are talking to me. Error: 500 Location: /pod_users/justin/jsp/form.jsp Internal Servlet Error: java.lang.IllegalStateException: Response has already been committed at org.apache.tomcat.core.HttpServletResponseFacade.sendError(HttpServletRespon seFacade.java:157) at org.apache.jasper.runtime.JspServlet.unknownException(JspServlet.java:299) at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:377) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559) at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection (Ajp12ConnectionHandler.java:156) at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338 ) at java.lang.Thread.run(Thread.java:484) *** For more information on Ordnance Survey products and services, visit our web site at http://www.ordnancesurvey.co.uk *** -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: JSP translation's problem...
Use the pageWriter from the JSP page, Send the writer to your servlet using somethinglike % fmngt.getPage(request, out); % then in your code do your output lines directly Something like out.println(My page is a wonderful thing); S -Original Message- From: Marcelo Demestri [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 13, 2001 8:10 PM To: Tomcat Users List Subject: JSP translation's problem... Hi ! I need help, my problem is: I call a bean from one jsp page but the result (HTML code) throw by the bean appars at the top of the HTML page served by the web server (I use Tomcat 4.0.1) instead of the position I call it Example: 1) My jsp page !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN HTML ... jsp:useBean id=fmngt class=myfolder.formmngtbean scope=session / % fmngt.getPage(request, response); % ... /HTML 2) Result --HTML code generated for the bean-- !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN HTML ... /HTML Why? How I can do appear the generated code in the right position? Don't shall be done by default? Thanks in advance. Marcelo -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: JSP translation's problem...
Probably JRun's implmentation of the ServletResponse.getWriter() and JspWriter are the same where as with tomcat the 2 are different entities combined when the response is sent to the client. Whats your code like ? technically using the out should be the same as doing a %=SOME DATA% Should be equivilant to % out.println(Some data); % which is exactly the syntax you should use in your bean class formmngtbean { public void getPage(HttpServletRequest req,JspWriter out) { out.println(Some data); } } -Original Message- From: Marcelo Demestri [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 13, 2001 8:54 PM To: Tomcat Users List Subject: Re: JSP translation's problem... Thank you S for your response, but i can't yet make it work... a curiosity: why i have this problem (within tomcat) and when i run this web app. with IIS/Jrun work perfectly ? I mean, IIS/Jrun translate the jsp page in the correct order, putting the HTML code generated by my bean exactly where i call the bean, not in the top of the HTML page, like happens with tomcat. Really, i don't understand... Marcelo [EMAIL PROTECTED] wrote: Use the pageWriter from the JSP page, Send the writer to your servlet using somethinglike % fmngt.getPage(request, out); % then in your code do your output lines directly Something like out.println(My page is a wonderful thing); S -Original Message- From: Marcelo Demestri [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 13, 2001 8:10 PM To: Tomcat Users List Subject: JSP translation's problem... Hi ! I need help, my problem is: I call a bean from one jsp page but the result (HTML code) throw by the bean appars at the top of the HTML page served by the web server (I use Tomcat 4.0.1) instead of the position I call it Example: 1) My jsp page !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN HTML ... jsp:useBean id=fmngt class=myfolder.formmngtbean scope=session / % fmngt.getPage(request, response); % ... /HTML 2) Result --HTML code generated for the bean-- !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN HTML ... /HTML Why? How I can do appear the generated code in the right position? Don't shall be done by default? Thanks in advance. Marcelo -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: Jakarta NT SERVICE--- logout USER
This isnt a config issue this is a sun JDK (1.3) issue I had heard that 1.4 resolves this, try looking there... -Original Message- From: Catalin [mailto:[EMAIL PROTECTED]] Sent: Monday, December 10, 2001 2:55 PM To: [EMAIL PROTECTED] Subject: Jakarta NT SERVICE--- logout USER Hello to everybody! I have a jakarta-tomcat-3.3m4 on a Win2k system and I have a problem: every times one user of Operating System logout, the service it stoppes. :-( Where do I need to modify the config so that will not be happens any more?? Thanks!! -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Detecting server name and port
I have a web application which sends out email reminders to members in a database when certian tasks are slipping- This all works great however I would like the application to be smart enough to know which server and port it is installed in so when generating a message it can include a link back to the particular task. What I have currently done is include an init-param tag with this information and it works but then it isnt server independent. I have also explored the possibility of getting the information from HttpServletRequest (which also works) but I'd like the timer function not to depend on someone actually requesting a page. Is there any other methods to get the server name and port ? Thanks Steve -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Creating Crystal reports from XML generating servlets
Title: Creating Crystal reports from XML generating servlets Informational post I finally had success using the new crystal reports Version 8.5 to generate a report from a servlet. As long as Seagate doesnt change anything we now have ultimate control over the data that crystal report's displays all without a single line of VBScript. There are a few gotchas though.. 1) the XML encoding method MUST be ?xml version=1.0 encoding=UTF-16 ? using ?xml version=1.0 encoding=UTF-8 ? will NOT work. You can set this up with your transformer by transformer.setOutputProperty(javax.xml.transform.OutputKeys.ENCODING,UTF-16); 2) you need to map your servlet with a .xml extension. in your web.xml add a servlet-mapping servlet-mapping servlet-name MyServlet /servlet-name url-pattern /MyServlet.xml /url-pattern /servlet-mapping Crystal reports automatically expects an xml extension. However when it prompts you for the table name you can send parameters like MyServlet?report_data_type=4 and these parameters will be recieved by the server. 3) Set the table hints and row hints as specified by crystal reports
RE: User login logging (JDBC authentication)
If you store the login information in the session object you could simply check that object on each of your pages (or you could include a page at the top of your pages which does this check) and redirect them back to the login page if the check fails -Original Message-From: Mark Muffett [mailto:[EMAIL PROTECTED]]Sent: Thursday, June 28, 2001 5:54 AMTo: [EMAIL PROTECTED]Subject: User login logging (JDBC authentication) Any ideas how best to log succesful (or unsuccesful) logins via JDBC authentication. The big problem is that the user may have bookmarked any one of a number of protected pages, and it isn't practical to put code on each of them. Any help would be appreciated Mark Muffett
RE: IIS won't Integrate (Revisited)
Title: RE: IIS won't Integrate (Revisited) Just a quick question here does http://localhost:8080/test/index.html work ? If so could you not stop IIS and run Tomcat on port 80 by changing the conf\server.xml file to Connector className=org.apache.tomcat.service.PoolTcpConnector Parameter name=handler value=org.apache.tomcat.service.http.HttpConnectionHandler/ Parameter name=port value=80/ /Connector (IIS uses port 80 as the default port so you need to either stop the service or change the port number) after restarting the Tomcat engine it should respond to requests like http://localhost/test/index.xml -Original Message- From: Kevin Queen [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 26, 2001 2:20 PM To: Tomcat-User@Jakarta. Apache. Org Subject: IIS won't Integrate (Revisited) Thank you for the advice Randy, but now I have a directory listing (good) but can't get Tomcat to start the servlet (bad). Here is an example of what I want vs. what I am getting: What I want: http://localhost/test/index.xml to invoke a servlet that is mapped to the context test (in web.xml) What I get: http://localhost/test/index.xml gives me a 404 File not found error. Am I just trying to do something that I just can't do or am I just slow in seeing my error? please see the relevant portions of the web.xml and uriworkermap.properties below: WEB.XML == servlet servlet-nametestEngine/servlet-name servlet-class com.test.engine.EngineServlet /servlet-class servlet-mapping servlet-nametestEngine/servlet-name url-pattern/test/*/url-pattern /servlet-mapping /servlet URIWORKERMAP.PROPERTIES === /test/*=$(default.worker) Kevin Queen Software Developer AnyDevice ||__|| Atlanta, Ga [ -=.] http://www.anydevice.com ===:0~ (w) (404)260.4155 (e) [EMAIL PROTECTED] Ah, I see!, said the blind man to the deaf mute. -Unknown
Servlet HTTP path
Title: Servlet HTTP path Hi Id like to specify a specific sub folder path for a servlet however I am not having any luck doing so. I have defined the servlet in the web.xml file as servlet servlet-nameaccountingxmlServlet/servlet-name description Used for exchanging data between the web page and the servlet /description servlet-class com.lfi.accounting.servlet.xmlServlet /servlet-class /servlet and access this as http:\\foo:8080\bar\servlet\accountingxmlservlet. This works but what I would like to do is to define the servlet as servlet servlet-nameaccounting/xmlServlet/servlet-name description Used for exchanging data between the web page and the servlet /description servlet-class com.lfi.accounting.servlet.xmlServlet /servlet-class /servlet and access it as http:\\foo:8080\bar\servlet\accounting\xmlservlet but this doesnt work. Is there something Im missing or is this not possible ? any suggestion or help would be appreciated... My setup is Tomcat 3.2 , WinNT SP6 IIS 5 Thanks
RE: User IP Address
Should be able to query the HTTPServletRequest object to get this information, try looking there -Original Message-From: Mark Muffett [mailto:[EMAIL PROTECTED]]Sent: Friday, June 22, 2001 9:50 AMTo: [EMAIL PROTECTED]Subject: User IP Address Anyone know if it's possible to use JSP / Tomcat to get user IP addresses (for logging)? - or any other user info that might go to the server (like referrer)? Ideas and sample code would be very welcome... Thanks Mark
RE: session timeout handling
Title: RE: session timeout handling Timeout will not send anyone anywhere. When the session expires it cleans up all the objects in the session's attributes. If the objects are of type HttpSessionBindingListener then an event is thrown against them. The best way to handle timed out users is to attach an object of HttpSessionBindingListener to their session, When that object recieves the unbound event do whatever is needed to be done to clean up. Note - (I got burned on this) at the unbound event the session object no longer references any attributes (or maybe it is just some) so the object of the above type should have enough intelligence in it to handle the actions you want to perform at the end. for example you had a session attribute storing the logged in user name, dont expect that attribute to be available after the unbound event. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, June 22, 2001 3:51 PM To: [EMAIL PROTECTED] Subject: session timeout handling When a Tomcat session times out does it send you to a preset error page? What is the mechanism there? What is the best way to handle timed out users?
RE: session timeout handling
Title: RE: session timeout handling configure something on the page sent to the client which times out after the length of time that your session objects timeout at Something like .. meta http-equiv=Refresh content=lengthOfTimeInSeconds URL=sorryYouTimedOut.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, June 22, 2001 4:18 PM To: [EMAIL PROTECTED] Subject: RE: session timeout handling We carry a userid and a shopping cart in the session thu out the app. If the user goes to lunch and comes back, we would like to give them sort of friendly error if their session times out. At 04:19 PM 6/22/2001 -0400, you wrote: When a Tomcat session times out does it send you to a preset error page? No. not unless you throw an exception due to dependence on something from session. You could develop an entire webapp without ever using the session and despite the fact you never use it it will still be instantiated. For obvious reasons. What is the mechanism there? No mechanism! What is the best way to handle timed out users? Depends. Do you have a security concern(if so you should be implementing Realms of some sort which manage the session timeout for you)? Are you requiring something to exist in the session for certain portions of your app? ... It all depends on what you specs and app requirements state. --- Michael Wentzel Software Developer Software As We Think - http://www.aswethink.com