Browse Source

set Tiles 2.2 ELAttributeEvaluator on RendererFactory as well (SPR-7251)

pull/1234/head
Juergen Hoeller 15 years ago
parent
commit
65655b949f
  1. 12
      org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/tiles2/TilesConfigurer.java

12
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/tiles2/TilesConfigurer.java

@ -31,6 +31,7 @@ import javax.servlet.jsp.JspFactory; @@ -31,6 +31,7 @@ import javax.servlet.jsp.JspFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tiles.TilesApplicationContext;
import org.apache.tiles.TilesContainer;
import org.apache.tiles.TilesException;
import org.apache.tiles.awareness.TilesApplicationContextAware;
import org.apache.tiles.context.AbstractTilesApplicationContextFactory;
@ -54,6 +55,7 @@ import org.apache.tiles.impl.mgmt.CachingTilesContainer; @@ -54,6 +55,7 @@ import org.apache.tiles.impl.mgmt.CachingTilesContainer;
import org.apache.tiles.locale.LocaleResolver;
import org.apache.tiles.preparer.BasicPreparerFactory;
import org.apache.tiles.preparer.PreparerFactory;
import org.apache.tiles.renderer.RendererFactory;
import org.apache.tiles.servlet.context.ServletUtil;
import org.apache.tiles.startup.BasicTilesInitializer;
import org.apache.tiles.startup.TilesInitializer;
@ -533,6 +535,16 @@ public class TilesConfigurer implements ServletContextAware, InitializingBean, D @@ -533,6 +535,16 @@ public class TilesConfigurer implements ServletContextAware, InitializingBean, D
Object baefValue = baefCtor.newInstance(evaluator);
Method setter = container.getClass().getMethod("setAttributeEvaluatorFactory", aef);
setter.invoke(container, baefValue);
Method getRequestContextFactory = BasicTilesContainer.class.getDeclaredMethod("getRequestContextFactory");
getRequestContextFactory.setAccessible(true);
Method createRendererFactory = BasicTilesContainerFactory.class.getDeclaredMethod("createRendererFactory",
TilesApplicationContext.class, TilesRequestContextFactory.class, TilesContainer.class, aef);
createRendererFactory.setAccessible(true);
BasicTilesContainerFactory tcf = new BasicTilesContainerFactory();
RendererFactory rendererFactory = (RendererFactory) createRendererFactory.invoke(
tcf, container.getApplicationContext(), getRequestContextFactory.invoke(container),
container, baefValue);
container.setRendererFactory(rendererFactory);
}
catch (Exception ex) {
throw new IllegalStateException("Cannot activate ELAttributeEvaluator", ex);

Loading…
Cancel
Save