D2W, EditingContext, WORequest
D2W, EditingContext, WORequest
- Subject: D2W, EditingContext, WORequest
- From: mailinglists <email@hidden>
- Date: Fri, 27 Jan 2012 15:35:38 +0100
Help!
My ERD2W application needs to generate PDF-files for EOs. The EO has a method that calls a XML-Generator that generates the XML-input for Apache-FOP. For this I use the following code in the Document-EO (just a fragment)
I_XMLGeneratorInterface xmlGenerator = (I_XMLGeneratorInterface)WOApplication.application().pageWithName(generatorName, new WOContext(session.context().request()));
The problem is that pageWithName needs a WOContext and this needs a WORequest. The WORequest comes from the session. BUT EOs are not supposed to know about sessions. So I pass the session into that method when I call the document to generate the PDF data. Fine, works. But now I want to automate the generation of PDFs when any relevant object is saved. I have thus created my own EOEditingContext descendant where I override saveChanges(). Whenever I save a relevant object I check after success if that object has related documents and then call those to generate the PDF, passing in the session. My EditingContext has a session variable and in the session-constructor I manually create my editing context, stuff the session into it and install it as defaultEditingContext. But D2W creates editingContexts and knows nothing about feeding with session information. When my code runs session variable is null and no PDFs are created.
Any idea how to tackle this problem? HELP! Is my strategy ok? Can I fix the missing session somehow? Or would you recommend a different way to go?
Thanks a lot, this is an urgent one ---markus--- |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden