You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ben Anderson <be...@gmail.com> on 2005/03/11 14:42:58 UTC
org.apache.cocoon.environment.Context in flow
Hi,
what's the best way to get the
org.apache.cocoon.environment.Context in flow? I'd like to call the
method getResourceAsStream() which I don't see as a method in any of
the objects already in flow's scope.
Thanks,
Ben
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: org.apache.cocoon.environment.Context in flow
Posted by Irv Salisbury <ir...@gmail.com>.
You have access to it by using cocoon.context variable that is setup.
If you are trying to read something, you may want to get a
SourceResolver. I grabbed this off a Google search.
importClass( Packages.org.apache.excalibur.source.SourceResolver );
importClass( Packages.org.apache.excalibur.source.Source );
importClass( Packages.org.apache.cocoon.components.source.SourceUtil );
var resolver = null;
var source = null;
try {
resolver = cocoon.getComponent( SourceResolver.ROLE );
source = resolver.resolveURI(
"module:request:inputStream" );
var document = SourceUtil.toDOM( source );
return document;
} finally {
if ( resolver != null ) {
if ( source != null )
resolver.release( source );
cocoon.releaseComponent( resolver );
}
}
}
On Fri, 11 Mar 2005 08:42:58 -0500, Ben Anderson
<be...@gmail.com> wrote:
> Hi,
> what's the best way to get the
> org.apache.cocoon.environment.Context in flow? I'd like to call the
> method getResourceAsStream() which I don't see as a method in any of
> the objects already in flow's scope.
> Thanks,
> Ben
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org