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