On Apr 12, 2011, at 2:25 PM, Paolo Sommaruga wrote: Hi,
I try to explain more. My web application is sort of cms. Basically the idea is simple.
Maybe a little too simple for what you want now. :-)
The main page displays an eoObject that has an attribute "text". The administrator can edit such "text" attribute via a java client application. He can insert anywhere in the "text" some special tag, like
[component myCustomComponent]
Real WO syntax, inline bindings, and WOComponent's String referenceName,
String anHTMLString,
String aDeclarationString,
NSArray aLanguageArray,
WOAssociationFactory associationFactory,
WOMLNamespaceProvider namespaceProvider) Might get you a lot closer to where you want to go. I think that is what most WO CMS applications use.
myCustomComponent is a component name, which lives in the web application, taken by a custom component library. Such custom component implement simple reusable behaviors for display only purpose, like products list, categories list, etc.
In the web application the "text" attribute binds to a method that parses the text. If the parse finds a special tag, it replaces such tag with the html generated by the component specified in the special tag. For this I use
WOResponse response = (WOApplication.application()).responseForComponentWithName(componentName, null, null, null, uriPrefix, null);
buf.append(response.contentString());
Such engine works very well with the stateless component.
I confess to not being sure what that method is for. But I don't think it is meant for what you are doing.
The problem is when the generated programmatically component need to access to some field in the session because the component generated with responseForComponentWithName lives in a new session.
I will guess that if it used the same session, that your app would deadlock. :-)
I would like to extend the engine in order to use some simple stateful component
Even if it does not deadlock, you are not going to be able to use stateful components and component actions using responseForComponentWithName. That runs in an whole new Request-Response loop with a new WOContext. WO won't know what to do with the result. I think...
Chuck
-- Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
|