axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Grimm, Markus" <Gr...@juris.de>
Subject READ a resource inside an aar
Date Thu, 18 Sep 2008 13:17:32 GMT
Hi all,

a question similar to this message-context [1]

[1]
http://www.nabble.com/Path-to-a-resource-inside-an-aar-tp19506606p195083
56.html


I followed Deepal's link to http://wso2.org/library/259
and tried to read a file inside the service-archive (*.aar). 
the file is in the same folder as the ServiceImpl-class and
the SerciveImpl-class wants to read the file as an inutStream.

I tried both ways:

> 	MessageContext ctx = MessageContext.getCurrentMessageContext();
> 	AxisService svc = ctx.getAxisService();
> 	ClassLoader loader = svc.getClassLoader();
> 	String filename = (String)svc.getParameterValue("file.txt");
> 	InputStream is = loader.getResourceAsStream(filename);

and

>getClass().getClassLoader().getResourceAsStream("file.txt");

Both ways don't find the file. If I debug my read-method, the loader
shows in both cases:

WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@cd5f8b

So, if I put the 'file.txt' to the /WEB-INF/classes/ -folder, I can read
the file.
How can I get the classloader of the single service, so I can read a
resouce that resides inside of an archive ?

Thanks,
Markus

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message