[seam-dev] Let me know what you need for a first stab at the PDF/Mail port from Seam 2

Lincoln Baxter, III lincolnbaxter at gmail.com
Fri May 21 11:42:17 EDT 2010


Well let's see if we can get you started, then :)

Have no fear!

Let me know if this helps:

   - Create a JSF2 project. Here's a starting tutorial that takes about 5
   minutes to get the project running.

   http://www.javaserverfaces.org/get-started#TOC-Creating-a-JSF-2-and-CDI-project

   - Create a page that, when requested, calls a JSF Managed Bean action
   (You can start by doing this with <f:event type="PreRenderViewEvent"
   listener="#{myBean.mailListener}"> --
   https://javaserverfaces.dev.java.net/nonav/docs/2.0/pdldocs/facelets/index.html

   - In that listener method, try to use something like this:

   (HttpServletRequest)
   request.getRequestDispatcher("/path/to/mail/view.xhtml").forward(MockHttpRequestObject,
   MockHttpResponseObject);

   - Try to capture the output of that new MockHttpResponseObject when JSF
   has finished processing it .. the forward(...) method will actually start
   another JSF request in the background.

This may or may not work, but it's what I would try first. If capturing the
output from a "background" request works, then getting the mail rendering
set up will be pretty easy. This, of course, requires that JSF be running,
but -- that's not such a bad requirement to start with. We can worry about
starting it up later.


--Lincoln


> On Fri, May 21, 2010 at 9:24 AM, Lincoln Baxter, III
> <lincolnbaxter at gmail.com> wrote:
> > I think for now these should be the same module. "Seam Docs" -- There's
> also
> > been speculation on whether a Mock Framework could be used to boot-up JSF
> > and render documents.
> >
> >
> http://community.jboss.org/wiki/MockObjectsforTestDrivenJSFDevelopmentorgjbosstest-jsfjsf-mockproject
> >
> > Another alternative is to build a UIViewRoot, and replace it during the
> > PreRenderViewEvent (which specifically states that it can be used to
> replace
> > the UIViewRoot.)
> >
> > Or.. there's the possibility of simply creating a "fake" Request and
> > Response object, and doing an internal forward in order to capture output
> > and capture the output (via the faked response object) to be used in
> > generating the PDF or Mail document.
> >
> > This last option is probably where I would start. I'd start by simply
> trying
> > to create a new request and capture the output -- just try on a normal
> page,
> > we can worry about generating pages that look like email documents after
> > this basic functionality is working.
> >
> > --Lincoln
> >
> >
> > 2010/5/21 Cody Lerum <cody.lerum at gmail.com>
> >>
> >> So a seam-mail and a seam-reporting?
> >>
> >> -C
> >>
> >> 2010/5/21 Tomaž Cerar <cerar at parsek.com>:
> >> > Hi guys,
> >> >
> >> >
> >> >
> >> > Will pdf and mail be separate modules?
> >> >
> >> >
> >> >
> >> > I would also like to contribute to both modules.
> >> >
> >> > I have done some extensive research of existing mail module code while
> >> > tracking down JBSEAM-3555 and have found out that current approach to
> >> > using
> >> > JSF in seam mail error-prone J
> >> >
> >> > Currently seam just uses jsf that was initalized in web application
> and
> >> > that
> >> > is why there are some ugly hacks to make it work when you invoke seam
> >> > mail
> >> > from from non-web request (ejb,mdb,...)
> >> >
> >> >
> >> >
> >> > Pete has sugessted that new seam-mail modul should start its own
> >> > instance of
> >> > JSF.
> >> >
> >> > Main problem with jsf is that there is no standard api to
> programaticly
> >> > set-up jsf enviroment. Idea is that seam implements RI (Mojarra 2.0)
> >> > with
> >> > implementation specific api and possible others if they provide any
> >> > machins
> >> > for starting up.
> >> >
> >> >
> >> >
> >> > I would also like to contribute do pdf module as we have some in-house
> >> > improvments and also some friends are willing to contibute huge
> upgrade
> >> > to
> >> > seam-pdf(forms,etc,..) but it is currently seam 2.0.x based.
> >> >
> >> >
> >> >
> >> > As I have not yet had much time to dive deeply into CDI and Seam 3(but
> I
> >> > folow development closly) a kick start as setting up seam3 module
> would
> >> > be
> >> > much apreciated. Altough I can help to »rip out« any seam 2 module...
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > Cheers,
> >> >
> >> > Tomaž
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > From: seam-dev-bounces at lists.jboss.org
> >> > [mailto:seam-dev-bounces at lists.jboss.org] On Behalf Of Lincoln
> Baxter,
> >> > III
> >> > Sent: Thursday, May 20, 2010 4:57 PM
> >> > To: cody.lerum at gmail.com; Dan Allen; Seam Dev List
> >> > Subject: [seam-dev] Let me know what you need for a first stab at the
> >> > PDF/Mail port from Seam 2
> >> >
> >> >
> >> >
> >> > Hi Cody, you have my email address now.
> >> >
> >> > I'm actually not very familiar with Seam 2, which is one of the
> reasons
> >> > this
> >> > has been lower priority, but if you can "rip" that part out of Seam 2
> >> > and
> >> > make it a standalone maven project, I can help you get it set up as a
> >> > Seam 3
> >> > module and all that goodness :)
> >> >
> >> > seam-dev at lists.jboss.org (if you don't already know) is where we
> discuss
> >> > development, so you can also ask questions there --
> >> > https://lists.jboss.org/mailman/listinfo/seam-dev is where you can
> sign
> >> > up.
> >> >
> >> > Thanks for reaching out!
> >> > --
> >> > Lincoln Baxter, III
> >> > http://ocpsoft.com
> >> > http://scrumshark.com
> >> > "Keep it Simple"
> >> > !DSPAM:6,4bf54e13248112142088973!
> >
> >
> >
> > --
> > Lincoln Baxter, III
> > http://ocpsoft.com
> > http://scrumshark.com
> > "Keep it Simple"
> >
>



-- 
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/seam-dev/attachments/20100521/a4e4d776/attachment-0001.html 


More information about the seam-dev mailing list