I would like to repeat my request for additional hooks in Wicket, preferrably
allowing WebRequestCycle#invokeInterface() to be overriden.
I've written before that I don't like the current hooks
WebPage#beforeCallComponent() and WebPage#afterCallComponent() in scope of
dependecy injection, but I digress.
I'm looking for a generic solution to display validation errors that have
their origin outside of Wicket (e.g. an EJB call on a remote server):
public interface SearchService
{
public List search(Object example) throws ServiceValidationException;
}
add(button = new Button("saveButton")
{
protected void onSubmit() {
try
{
result = service.search(example);
}
catch (ServiceValidationException ex)
{
// TODO indicate validation
}
}
});
How the exception is indicated on Wicket components is *not* subject of this
mail - I'm currently experimenting with something.
What I want to get rid of is the try-catch block surrounding all my button and
link listeners, so I'd prefer something like:
add(button = new Button("saveButton")
{
protected void onSubmit()
{
result = service.search(example);
}
});
(Of course this requires ServiceValidationException to be a RuntimeException,
but that's no problem for me.)
What I would need for this to work is a hook in Wicket. Once again the method
invokeInterface() in WebRequestCycle would fit my needs, but regretfully it is
private:
@override
protected void invokeInterface(final Component component, final Method method,
final Page page)
{
try
{
super.invokeInterface(component, method, page);
} catch (ValidationException ex) {
// TODO indicate validation
}
}
Note that WebPage#beforeCallComponent() and WebPage#afterCallComponent() do not
help me as they are not able to catch exceptions.
So here are my questions:
- Could the visibility of invokeInterface() be changed to protected? If not,
why is invokeInterface() such a secret that this shouldn't be done.
- Is there already a hook in Wicket that I've missed? I know that I could write
subclasses of Button and Link containing this try-catch block, but I'd rather
have this in one central place outside of my pages.
- Are Wicket users utilizing other solution for this scenario?
Please note that I don't want to propose a general solution to be included in
Wicket (or its sub-projects).
I just need (more) hooks to extend Wicket the way I need to - regretfully my
previous plea for a protected invokeInterface() were not approved by this list.
Thanks
Sven
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user