-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi ZK Team,
in the new ZK release (5.0.3) the default constructor for the DelegatingVariableResolver was changed from an empty
constrcutor to:
public DelegatingVariableResolver() { final Configuration conf = Executions.getCurrent().getDesktop() .getWebApp().getConfiguration(); final String value = conf.getPreference("org.zkoss.spring.VariableResolver", null); if (value != null) { String[] vrClss = value.split(","); for (int i = 0; i < vrClss.length; i++) { try { Object o = Classes.newInstanceByThread(vrClss<i >); if(!_variableResolvers.contains(o)) { _variableResolvers.add(o); } } catch (Exception e) { // do nothing } } } else { _variableResolvers.add(new DefaultDelegatingVariableResolver()); } }
With this new implementation you can not create an instance of DelegatingVariableResolver outside of a zk execution. For example: I am using an instance of DelegatingVariableResolver inside my SimpleUiFactory to attach a VariableResolver to all my pages:
public class DelegatingVariableResolverSerializableUiFactory extends SimpleUiFactory { private static final String SECURITY_TLD_URL = ""; private final FunctionMapper functionMapper; private final VariableResolver variableResolver; public DelegatingVariableResolverSerializableUiFactory() throws XelException, MalformedURLException { // init taglibMapper TaglibMapper taglibMapper = new TaglibMapper(); taglibMapper.load("sec", new URL(SECURITY_TLD_URL)); functionMapper = taglibMapper; // init VariableResolver variableResolver = new DelegatingVariableResolver(); } // more methods here... }
I am creating the VariableResolver inside the constructor of my SimpleUiFactory, cause i want all pages to use the same VariableResolver. So why are you now expecting a ZK execution inside the constructor of the DelegatingVariableResolver (5.0.3)?
Perhaps something like this would also work:
public DelegatingVariableResolver() { Configuration conf = null; String value = null; try { conf = Executions.getCurrent().getDesktop() .getWebApp().getConfiguration(); value = conf.getPreference("org.zkoss.spring.VariableResolver", null); } catch (Exception e) { // error handling } ... }
Best regards,
tom
It is a feature rather than a bug. I posted and implemented it. Refer here.
Asked: 2010-07-01 02:12:44 +0800
Seen: 312 times
Last updated: Aug 16 '10