axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Seem <sim...@gmx.de>
Subject Re: get Resource inside .aar?
Date Tue, 16 Dec 2008 15:42:31 GMT

Thanks to everybody, especially to Deepal for your unlimited patience.
Finally everything is working fine, with all different possibilies ;-)!

I had some problems with Eclipse, Classpath and invoking everything at the
service_startup with the ServiceLifeCycle technique...

I didn't see the wood for the trees.


Deepal Jayasinghe-2 wrote:
> 
> Seem wrote:
>> Hi,
>>
>> I still have problems to access a file inside an .aar. I tried to extend
>> the
>> simple "quickstart" example from the axis2 repository, but I won't get
>>   
> Try this
> 
> MessageContext.getCurrentMessageContext().getAxisService().getClassLoader().getResourceAsSteam();
> 
> Thank you!
> Deepal
>> access?!?!?!
>>
>> The .aar folder structure is
>> META-INF/
>> samples/...
>> res/stock.txt
>>
>>
>> here is my code:
>>
>> #########################################
>> package samples.quickstart.service.pojo;
>>
>> import java.io.BufferedReader;
>> import java.io.IOException;
>> import java.io.InputStream;
>> import java.io.InputStreamReader;
>> import java.util.HashMap;
>>
>>
>> public class StockQuoteService
>> {
>>     private HashMap map = new HashMap();
>>
>>     public double getPrice(String symbol) {
>> 		StockQuoteService i = new StockQuoteService();
>>     	InputStream a =
>> i.getClass().getClassLoader().getResourceAsStream("res/stock.txt");
>>     	
>> //    	Thread thread = Thread.currentThread();
>> //    	ClassLoader loader = thread.getContextClassLoader();
>> //    	thread.setContextClassLoader(i.getClass().getClassLoader());
>> //    	InputStream a =
>> Thread.currentThread().getContextClassLoader().getResourceAsStream("res/stock.txt");
>>     	
>>
>>     	return Double.valueOf(i.convertStreamToString(a)).doubleValue();
>>     }
>>       
>>     private String convertStreamToString(InputStream a)
>> 	{
>> 	BufferedReader reader = new BufferedReader(new InputStreamReader(a));
>>     .....}
>>
>> }
>> #########################################
>>   
> 
> 
> -- 
> Thank you!
> 
> 
> http://blogs.deepal.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/get-Resource-inside-.aar--tp21019445p21035519.html
Sent from the Axis - User mailing list archive at Nabble.com.


Mime
View raw message