I got it!
But the solution is rather low-level.
First, I had to modify my form listener to return an ILink:
public ILink onSubmit()
Then, I had to create the ILink using LinkFactoryImpl:
@InjectObject("service:tapestry.globals.WebRequest")
public abstract WebRequest getWebRequest();
@InjectObject("engine-service:direct")
public abstract IEngineService getService();
// Somewhere in the page class:
Map<String, Object> params = new HashMap<String, Object>(1);
params.put(ServiceConstants.PARAMETER,
getRequestCycle().getListenerParameters());
LinkFactoryImpl linkFactory = new LinkFactoryImpl();
DataSqueezerImpl dataSqueezer = new DataSqueezerImpl();
dataSqueezer.register(new StringAdaptor());
linkFactory.setDataSqueezer(dataSqueezer);
linkFactory.setContributions(Collections.EMPTY_LIST);
linkFactory.setContextPath(getWebRequest().getContextPath());
ErrorLog errorLog = new ErrorLogImpl(new DefaultErrorHandler(), LogFactory
.getLog(MyPageClass.class));
linkFactory.setErrorLog(errorLog);
linkFactory.setRequest(getWebRequest());
linkFactory.setRequestCycle(getRequestCycle());
linkFactory.setServletPath(getWebRequest().getActivationPath());
linkFactory.initializeService();
ILink iLink = linkFactory.constructLink(getService(), false, params, false);
That was a lot of code don't you think?
But here's a question: how do you make sure this 'original' ILink is not
lost/overridden betwing requests, especially if your page uses validators? I
found a solution for that too. If you need help with this, drop me a line
and I'll gladly help.
Regards!