cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Velychko <v_pe...@ukr.net>
Subject Re: [Flowscript] Obtaining servlet context directory
Date Wed, 10 Dec 2003 12:49:31 GMT
Hi,

Excuse me I don't know about better way.
But my question is about context directory in case of application
works from WAR-archive.

In that case if I have
var sourceFile = Packages.org.apache.excalibur.source.SourceUtil.getFile(source);
the "sourceFile" is null.

Could anyone advice right way?

Thanks a lot in advance.

Andreas wrote:

AH> Hi Cocoon users,

AH> I'm looking for an easy way to obtain the directory
AH> of the servlet context in a flowscript. Is there any
AH> reason why context.getRealPath() in FOM_Cocoon is not
AH> (yet?) implemented?

AH> By now I'm doing


AH> var sourceResolver = cocoon.getComponent(
AH>      Packages.org.apache.excalibur.source.SourceResolver.ROLE);

AH> var source = sourceResolver.resolveURI("context:///");
AH> var sourceFile =
AH>      Packages.org.apache.excalibur.source.SourceUtil.getFile(source);
AH> var contextPath = sourceFile.getAbsolutePath();

AH> sourceResolver.release(source);
AH> cocoon.releaseComponent(sourceResolver);


AH> Is there something shorter and more elegant?

AH> Thanks in advance,
AH> -- Andreas


AH> ---------------------------------------------------------------------
AH> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
AH> For additional commands, e-mail: users-help@cocoon.apache.org


Best regards,
Peter Velychko                            
v_peter@ukr.net


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message