From: Heiko K. <Hei...@gm...> - 2004-10-06 08:51:08
|
Hmmm, declaring a different action for a different content-generator is a rather technical than user-friendly solution. I guess we will end up with something like: [foo] content-generator = TT [foo_soap] content-generator = SOAP [foo_wap] content-genertor = WAP [foo_pdf] content-genertor = GS-PDF and we will have to write a lots of stuff for each of these action. Since a action is more of a class or namespace for a method, I don't see why it needs to include the content generator. [foo_soap] needs a SOAP response and request generator. The soap API user will think its very strange that all namespaces have _soap included. [foo_pdf] and [foo_wap] will most likely have a request for something ending with .pdf as an ending. (At least, nobody would think it's strange when you require this.) Without having looked closely at the code yet, I would make the request generator determine the content-type. After setting some default (most likely to .html), when the request ends with .pdf to pdf and with .wap to wap. SOAP has a different request-generator, so it will be very easy to set the content-type to soap there. The only situation, where you will need different actions is when you want to present the same content-type (html) with different html-content-generators - IMHO not a very common situation in production. (In testing, sure this will happen, but for test-pages I want to have the possibilty to switch between foo_TT and foo_HTMLTemplate.) So, if it makes sense, it is a feature request to implement several content-generator determined by content-type per action: [foo] content-generator default = TT content-generator soap = SOAP content-generator pdf = GS-PDF ... (don't know if this is parseable by the .ini-reader) Best regards, Heiko Chris Winters wrote: >>I'm currently trying out Martin Kutters SOAP add on for OpenInteract2. >>My idea is to use soap as remote API for OI2. Thus I would like to have >>two content-generators for all packages, one giving the usual >>html-response, and the other one giving a soap response. > > > That's been my idea for SOAP as well. > > >>When I understand the current implementation of OI correct, then it is >>in principle possible to have several content generators in OI, but one >>action has exactly one content generator, defined by the action.ini >>file, not by the Response-type. I hope I'm wrong with this assumption, >>so my question is, how do I enable different content-generators for one >>action? Or is my understanding of an 'action' wrong? > > > Your understanding is right. But I think what's missing is you can map > multiple action specifications to the same class. For instance in an > action.ini you might have: > > [foo] > class = OpenInteract2::Action::Foo > content_generator = TT > > [bar] > class = OpenInteract2::Action::Foo > content_generator = SOAP > > The same data are retrieved from the action + task, but they're passed off > to a different content generator depending on how they were invoked. Make > sense? > > The 'news' package has some commented-out examples of doing this with > Text::Template and HTML::Template. > > >>And in some packages, I haven't seen the content_generator flag in the >>action.ini. Where is the default defined? > > > In server.ini: > > [action_info default] > controller = tt-template > content_generator = TT > > Hope this helps, > > Chris > |