Reply To: Can PrettyFaces be used in Quartz job?

Splash Forums PrettyFaces Users Can PrettyFaces be used in Quartz job? Reply To: Can PrettyFaces be used in Quartz job?



I’ve solved it 🙂

I’m using something like this:

// request -> HttpServletRequest
PrettyContext context = PrettyContext.getCurrentInstance(request);
UrlMapping mapping = context.getConfig().getMappingById(mappingId);
PrettyURLBuilder builder = new PrettyURLBuilder();
String targetURL =, false, params);

I can construct this way URL anywhere in webapp. I’m using Spring and when a job is a bean, i can use this:

public class SomethingJob extends QuartzJobBean{
    private ServletContext servletContext;

    protected void doExecute(ApplicationContext ctx, JobExecutionContext jobContext){
        MockHttpServletRequest request = new MockHttpServletRequest();
        MockHttpServletResponse response = new MockHttpServletResponse();     

        URL url = ... absolute URL of my application

        PrettyFilter prettyFilter = new PrettyFilter();
        try {
            prettyFilter.init(new MockFilterConfig(servletContext));
            prettyFilter.doFilter(request, response, new MockFilterChain());            
        } catch (Exception ex) {

        // Construct URL by PrettyFaces with code mentioned above

        // Place generated URL to email body and send it

This workaround is functional, but is there a better way?