You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Andreas Hartmann <an...@apache.org> on 2003/08/14 12:00:00 UTC

How to use input modules in flow

Hi Cocoon developers,

I just updated from 2.1-M1 to 2.1 and noticed that the
inputModuleGetAttribute() function is no longer supported.

The purpose of the input module call was to obtain an
object from a custom Avalon component.

The FOM does not provide access to input modules, does it?
So, what is the recommended way to get an object from an
Avalon component? Or should I obtain the object from the
input module in the sitemap and pass it to the flow script?

Thank you very much!

Andreas



RE: Request URI in FOM [was: Re: How to use input modules in flow]

Posted by Reinhard Pötz <re...@gmx.net>.
From: news [mailto:news@sea.gmane.org]

> 
> Reinhard Pötz wrote:
> 
> [...]
> 
> > What about
> > 
> > 	resolveAccessController(Cocoon cocoon);
> > 
> > and in the component
> > 
> > 	public xxx resolveAccessController( Cocoon cocoon ) {
> > 		String uri = cocoon.getRequest().getRequestURI()
> >      }
> 
> 
> Thank you, I will try this.
> I guess you mean FOM_Cocoon instead of Cocoon?
> 
> BTW, is it a good approach regarding SoC to include 
> FlowScript support in custom components? Or would it be 
> better to implement a FOMAccessControllerResolver which calls 
> the actual AccessControllerResolver?

the second alternative sounds good. So your implementation can be easily
reused by other non FOM based applications.

Reinhard 


Re: Request URI in FOM [was: Re: How to use input modules in flow]

Posted by Andreas Hartmann <an...@apache.org>.
Reinhard Pötz wrote:

[...]

> What about
> 
> 	resolveAccessController(Cocoon cocoon);
> 
> and in the component
> 
> 	public xxx resolveAccessController( Cocoon cocoon ) {
> 		String uri = cocoon.getRequest().getRequestURI()
>      }


Thank you, I will try this.
I guess you mean FOM_Cocoon instead of Cocoon?

BTW, is it a good approach regarding SoC to include FlowScript
support in custom components? Or would it be better to
implement a FOMAccessControllerResolver which calls the
actual AccessControllerResolver?

Andreas



RE: Request URI in FOM [was: Re: How to use input modules in flow]

Posted by Reinhard Pötz <re...@gmx.net>.
On Behalf Of Andreas Hartmann

> Reinhard Pötz wrote:
> 
> >>The FOM request does not contain a getRequestURI() method.
> > 
> > Another question: What is your usecase?
> 
> It's about the administration of users, groups etc. in Lenya.
> 
> There is an Avalon component AccessControllerResolver which 
> resolves the access controller component that is responsible 
> to protect the current URL:
> 
>      resolveAccessController(String webappUrl)
> 
> We're using flowscript for the add/delete/modify user/group 
> forms. Usually, an access controller is assigned to a 
> publication, and a publication has an admin area where 
> users/groups etc. can be administrated. Therefore we want to 
> obtain the access controller based on the current URI.

What about

	resolveAccessController(Cocoon cocoon);

and in the component

	public xxx resolveAccessController( Cocoon cocoon ) {
		String uri = cocoon.getRequest().getRequestURI()
     }

Cheers,
Reinhard


Re: Request URI in FOM [was: Re: How to use input modules in flow]

Posted by Andreas Hartmann <an...@apache.org>.
Reinhard Pötz wrote:

>>The FOM request does not contain a getRequestURI() method.
> 
> Another question: What is your usecase?

It's about the administration of users, groups etc. in Lenya.

There is an Avalon component AccessControllerResolver which resolves
the access controller component that is responsible to protect
the current URL:

     resolveAccessController(String webappUrl)

We're using flowscript for the add/delete/modify user/group forms.
Usually, an access controller is assigned to a publication, and
a publication has an admin area where users/groups etc. can be
administrated. Therefore we want to obtain the access controller
based on the current URI.

Andreas



RE: Request URI in FOM [was: Re: How to use input modules in flow]

Posted by Reinhard Pötz <re...@gmx.net>.
From: news [mailto:news@sea.gmane.org] 

> The FOM request does not contain a getRequestURI() method.

Another question: What is your usecase?

Cheers,
Reinhard


Re: Request URI in FOM [was: Re: How to use input modules in flow]

Posted by Miles Elam <mi...@pcextremist.com>.
What makes it more special than getRequestMethod(), the hostname, or 
reading cookie data?  Those can be gathered in the sitemap and passed as 
parameters too can't they?

Not arguing, just trying to figure out the distinction.

- Miles Elam


>>The FOM request does not contain a getRequestURI() method.
>>In the wiki I've read that URI handling is not supported 
>>because this is not necessary. How should the request URI be obtained?
>>    
>>
>
>Your application should work without a certain uri ...
>
>If your need it you can work around it using an input module and pass
>its value to the flow using map:parameter.
>  
>



RE: Request URI in FOM [was: Re: How to use input modules in flow]

Posted by Reinhard Pötz <re...@gmx.net>.
From: news [mailto:news@sea.gmane.org]

> Thank you for your relies to my previous message!
> 
> 
> I have another question:
> 
> The FOM request does not contain a getRequestURI() method.
> In the wiki I've read that URI handling is not supported 
> because this is not necessary. How should the request URI be obtained?

Your application should work without a certain uri ...

If your need it you can work around it using an input module and pass
its value to the flow using map:parameter.

HTH
Reinhard


Request URI in FOM [was: Re: How to use input modules in flow]

Posted by Andreas Hartmann <an...@apache.org>.
Thank you for your relies to my previous message!


I have another question:

The FOM request does not contain a getRequestURI() method.
In the wiki I've read that URI handling is not supported
because this is not necessary. How should the request URI
be obtained?

Thanks!
Andreas



RE: How to use input modules in flow

Posted by Bruno Dumon <br...@outerthought.org>.
On Thu, 2003-08-14 at 12:37, Reinhard Pötz wrote:
> From: news [mailto:news@sea.gmane.org]
> 
> > Reinhard Pötz wrote:
> > 
> > >>The FOM does not provide access to input modules, does it? 
> > So, what is 
> > >>the recommended way to get an object from an Avalon component?
> > > 
> > > var myComp = cocoon.getComponent("myComp.ROLE");
> > > var myObj  = myComp.mymethod();
> > 
> > Thanks for your fast answer!
> > 
> > I guess the component is automatically released when the 
> > script terminates?
> 
> 
> Sorry, forget this. Auto-release hasn't been implemented yet or more
> precicly Chris wrote some experimental stuff but it hasn't been
> integrated into CVS. Maybe we can add this to the scratchpad? What do
> you think Chris? 
> Because of a lack of time I only had a brief look at it but couldn't
> test it more extensivly.
> 
> So back to your question - for now you have to call 
> 
> cocoon.releaseComponent( myComp );

yep, and don't forget to use a try-finally, something like this:

var myObj;
var myComp = cocoon.getComponent(Packages.myComp.ROLE);
try {
   myObj  = myComp.mymethod();
} finally {
   cocoon.releaseComponent( myComp );
}

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


RE: How to use input modules in flow

Posted by Reinhard Pötz <re...@gmx.net>.
From: news [mailto:news@sea.gmane.org]

> Reinhard Pötz wrote:
> 
> >>The FOM does not provide access to input modules, does it? 
> So, what is 
> >>the recommended way to get an object from an Avalon component?
> > 
> > var myComp = cocoon.getComponent("myComp.ROLE");
> > var myObj  = myComp.mymethod();
> 
> Thanks for your fast answer!
> 
> I guess the component is automatically released when the 
> script terminates?


Sorry, forget this. Auto-release hasn't been implemented yet or more
precicly Chris wrote some experimental stuff but it hasn't been
integrated into CVS. Maybe we can add this to the scratchpad? What do
you think Chris? 
Because of a lack of time I only had a brief look at it but couldn't
test it more extensivly.

So back to your question - for now you have to call 

cocoon.releaseComponent( myComp );

Cheers,
Reinhard


Re: How to use input modules in flow

Posted by Andreas Hartmann <an...@apache.org>.
Reinhard Pötz wrote:

>>The FOM does not provide access to input modules, does it?
>>So, what is the recommended way to get an object from an
>>Avalon component? 
> 
> var myComp = cocoon.getComponent("myComp.ROLE");
> var myObj  = myComp.mymethod();

Thanks for your fast answer!

I guess the component is automatically released when the script
terminates?

Andreas



RE: How to use input modules in flow

Posted by Reinhard Pötz <re...@gmx.net>.
From: news [mailto:news@sea.gmane.org

> Hi Cocoon developers,
> 
> I just updated from 2.1-M1 to 2.1 and noticed that the
> inputModuleGetAttribute() function is no longer supported.

Yep 
legacy support for cocoon.input("..") and cocoon.act("..") 
has not been implemented yet

> The purpose of the input module call was to obtain an
> object from a custom Avalon component.
> 
> The FOM does not provide access to input modules, does it?
> So, what is the recommended way to get an object from an
> Avalon component? 

var myComp = cocoon.getComponent("myComp.ROLE");
var myObj  = myComp.mymethod();

Cheers,
Reinhard