We have functionality that needs to send an email of any changes
that occur in a record.  At first we were going to just send the
email when the transaction completes...but that will have issues
if the app is up and the mail server is down (or unreachable at the
moment).

So we're going to write the changes to the database and have
a job wake up and send the email.

I had a method that built the url on the page request, like this:

public String buildUrl(Class<? extends _BasePage> targetPageClass,
PageParameters pageParams)
        {
                String uri = urlFor(targetPageClass, pageParams).toString();
                String url = RequestUtils.toAbsolutePath(uri);          
                return url;
        }

The problem is the job won't have an IRequestCycle to access, or
even Component.  Those are the two places I found urlFor() implemented.

It's about a half dozen pages that can be linked to, so I thought of
making static strings and building them at startup.  I can then append
the params when the job runs (it's only one param, so that's easy).

I don't have an IRequestCycle when WebApplication.init() fires, though.
Is there a straight forward way of doing this that I'm missing?

Worst case scenario, I could build the urls when the record is updated and
persist it.  I'd like to avoid that, if possible.

Thanks very much.




-- 
View this message in context: 
http://www.nabble.com/Using-urlFor-tp21842522p21842522.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to