Hi guys, in TomEE I'd like to add a filter but after context filter are started (means filterStart() from StandardContext is called).
What I do today is: try { final Field def = StandardContext.class.getDeclaredField("filterDefs"); if (!def.isAccessible()) { def.setAccessible(true); } final Field config = StandardContext.class.getDeclaredField("filterConfigs"); if (!config.isAccessible()) { config.setAccessible(true); } final Object oldDefs = def.get(context); final Map<String, ApplicationFilterConfig> oldConfig = new HashMap<>((Map<String, ApplicationFilterConfig>) config.get(context)); try { final Map<String, FilterDef> tempDef = new HashMap<>(); tempDef.put(filterDef.getFilterName(), filterDef); def.set(context, tempDef); StandardContext.class.cast(context).filterStart(); // update configs oldConfig.putAll((Map<String, ApplicationFilterConfig>) config.get(context)); } finally { def.set(context, oldDefs); def.set(context, oldConfig); } } catch (final Exception e) { throw new IllegalStateException(e); } but it is really hacky just to get a ApplicationFilterConfig. Is there an easier way I miss or is it possible to make it a bit more easy? Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org