Howdy, >I don't think this is possible, but I'm giving it a shot anyway. :) > >I'd like to get ahold of a servlet reference from within a filter. Is >there a way?
Your intuition is right in this case -- the above is impossible (using only the Servlet APIs -- it IS possible [though not trivial] using server-specific code, but you don't want to do that). Tim's multiple filter definition suggestion is one way to accomplish what you want. >I have a filter that creates objects and places them within the request >scope, but it does it differently for each end-result servlet. I'd like >the filter to look at the URI, determine the servlet, and grab the >servlet. Then, it can either grab its init-params or just call a >special method to get the data it needs. But if the requests have different URIs, wouldn't that be enough to determine what to put into the request in your filter? Or do you actually need the Servlet class reference to call methods on it? Another interesting idea is to use ServletContext.getResource on the request URI -- that would return the URL that will serve the request, i.e. the URL to your servlet. Would that be helpful? Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]