[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-2427) Email rendering from async method/event fails to find web resources

Pete Muir (JIRA) jira-events at lists.jboss.org
Thu May 15 11:29:22 EDT 2008


    [ http://jira.jboss.com/jira/browse/JBSEAM-2427?page=comments#action_12412897 ] 
            
Pete Muir commented on JBSEAM-2427:
-----------------------------------

Unfortunately we can't rely on the servlet context being available for non web based calls, therefore we use a MockServletContext.

> Email rendering from async method/event fails to find web resources
> -------------------------------------------------------------------
>
>                 Key: JBSEAM-2427
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-2427
>             Project: Seam
>          Issue Type: Bug
>          Components: Mail
>    Affects Versions: 2.0.0.GA
>            Reporter: Allon Rauer
>         Assigned To: Pete Muir
>            Priority: Minor
>             Fix For: 2.1.x
>
>
> Our system sometimes renders emails (system status, etc.) triggered by a periodic async event.
> In this context, the email renderer cannot find the xhtml email templates that reside in the web resources directory.
> Solution: in org.jboss.seam.ui.facelet.FaceletsRenderer
> modify this block (to propagate the servlet context)....
> from:
>          // If a FacesContext isn't available, set one up
>          if (FacesContext.getCurrentInstance() == null)
>          {
>             MockFacesContext mockFacesContext = new MockFacesContext(new MockExternalContext())
>                      .setCurrent();
>             mockFacesContext.createViewRoot();
>          }
> to:
>          // If a FacesContext isn't available, set one up
>          if (FacesContext.getCurrentInstance() == null)
>          {
>             MockFacesContext mockFacesContext = new MockFacesContext(new MockExternalContext(ServletLifecycle.getServletContext()))
>                      .setCurrent();
>             mockFacesContext.createViewRoot();
>          }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list