cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Irv Salisbury <irv.salisb...@gmail.com>
Subject Re: org.apache.cocoon.environment.Context in flow
Date Sat, 12 Mar 2005 14:33:59 GMT
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
<benanderson.us@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


Mime
View raw message