Hi all, I have a class in my web app that runs in a separate thread. It's responsibility is to re-index the site every x minutes (I am using Lucene for site searches). It recursively loops over the relevant files within the web app folder and attempts to index each one (the web app must be exploded at this stage). I have this working for HTML and plain text resources. However, I would like to include JSPs in my index. Of course, I need to request each JSP to get any meaningful information for the index.
I have a class that implements the ServletContextListener interface and stores a global reference to the ServletContext object. Originally I thought this would be all I needed to dynamically request JSPs. I figured you could retrieve the servlet context path from the ServletContext object in order to construct a URL to request - how silly of me! It seems you cannot retrieve the context path from anywhere other than the HttpServletRequest interface. Besides being a major design flaw (?), this complicates things for me. I cannot dynamically construct a request URL because I don't know the context path and my application must be able to run under any context path including the default one. I thought about using the ServletContext.getRequestDispatcher() method. However, I needed an implementation of HttpServletRequest and HttpServletResponse in order to use the dispatcher. HttpServletRequest, as I just mentioned, defines the getContextPath() method which I obviously can't implement. The JSPs in my application already rely on this method returning the correct context path. Hence, this was not an option. I also thought of having a servlet that loads on start-up set a global variable containing the context path. However, I would need the servlet to be requested in order to obtain an instance of HttpServletRequest from which I could extract the context path - the parameters to the init() method are of no help. A possible solution is to define an environment entry for the web app that duplicates the details of the context path. This is an awful solution and should not be necessary. Can anyone shed some light on this? Am I missing something embarrassingly obvious here? Thanks, Kent --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]