On 06/07/2020 21:23, Christopher Schultz wrote: > All, > > I'm looking at modifying the existing LoadBalancerDrainingValve to > also function as a Filter if necessary (my application uses a Filter > to establish authentication information, so I'd like the "valve" to > act *after* the filter if possible) and it looks like I need access to > some Tomcat internals. > > Specifically, I'd like to be able to get to the > org.apache.catalina.Context object for the request. Is this available > without reflection and/or other ugly things? > > Hmm. It looks like a Valve *cannot* be a Filter because of the > presence of the incompatible destroy() method. > > I still want to provide a Filter if possible, so the above question > still stands. > > If the Context isn't available, could it be added to the > ServletContext attributes, possibly under a non-reported hash key?
That would create security issues. A Filter equivalent to ContainerServlet could work - although that is a fairly invasive change for something that could be fixed more easily. How about a Valve that injects the necessary internal object(s) as request attributes? Alternatively, you could inject some custom object that held the references internally and just exposed the functionality you wanted to expose. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
