So, if I am understanding right, what you want to do is:- 1. Client calls http://localhost:8080/home.jsp and there html code in there: <a href="/file.xml">a xml file</a> 2. Client then calls http://localhost:8080/file.xml and you want to intercept this and redirect to a servlet http://localhost:8080/servlet/myServlet (which you have done?) 3. Now this is where you are stuck?? "How do I know that file.xml has been redirected?" 4. Do stuff and return file.xml.
Is this right? Well if it is, back in step one you can have the link specify <a href="/servlet/myServlet?xmlFile=/file.xml">a xml file</a>. But if you just want to be able to type in http://localhost:8080/file.xml and do you what you want, then you need to find out where you have come from, (been redirected from), you might be able to use 'request.getRequestURL()' this would only work however, if tomcat redirects without sending a proper 'response.sendRedirect()'. Other than that I don't know of a way to do what you want, hope this all helps somehow. Nicholas Orr -----Original Message----- From: Aaron Chan [mailto:[EMAIL PROTECTED]] Sent: Friday, 27 September 2002 5:27 PM To: 'Tomcat Users List' Subject: RE: How to write a servlet that handle request for .xml documents Hi, I am trying to have all the request to .xml documents to be pass to a servlet, so that I can dynamically change the documents before sending it back to the client. Thanks. -----Original Message----- From: Nicholas Orr [mailto:[EMAIL PROTECTED]] Sent: Friday, September 27, 2002 2:55 PM To: 'Tomcat Users List' Subject: RE: How to write a servlet that handle request for .xml documents Hi, What exactly are you trying to do?? Nicholas Orr -----Original Message----- From: Aaron Chan [mailto:[EMAIL PROTECTED]] Sent: Friday, 27 September 2002 4:34 PM To: 'Tomcat Users List' Subject: RE: How to write a servlet that handle request for .xml documents Hi, thanks for ur reply. I already know how to write basic servlet, just that I am not sure when the tomcat redirect the request of .xml file to the servlet, which method inside the servlet gets to handle it? doGet or doPost? I even tried service() but can't do it. Also how can I get the requested file names? Thanks in advance Btw.. I agree that it is a good book I have it here :) -----Original Message----- From: Andreas Probst [mailto:[EMAIL PROTECTED]] Sent: Friday, September 27, 2002 2:22 PM To: Tomcat Users List Subject: Re: How to write a servlet that handle request for .xml documents > Hi, I have setup the web.xml to direct request to .xml to my servlet > > However, I do not know how to write the servlet inorder to have it > perform jobs I want it to do. Anyone know of any guides on writing it or > know how to write it? Thanks in advance. The sun site has a tutorial. Search www.javasoft.com. O'Reilly's Java Servlet Programming is a good book on Java servlets. Andreas -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> ********************************************************************** The information contained in this e-mail is confidential and is intended only for the use of the addressee(s). If you receive this e-mail in error, any use, distribution or copying of this e-mail is not permitted. You are requested to forward unwanted e-mail and address any problems to the MIM Holdings Limited Support Centre. For general enquires: ++61 7 3833 8000 Support Centre e-mail: [EMAIL PROTECTED] Support Centre phone: Australia 1800500646 International ++61 7 38338042 ********************************************************************** -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
