Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 58685 invoked from network); 16 Dec 2008 00:32:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Dec 2008 00:32:44 -0000 Received: (qmail 30251 invoked by uid 500); 16 Dec 2008 00:32:49 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 30039 invoked by uid 500); 16 Dec 2008 00:32:48 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 30030 invoked by uid 99); 16 Dec 2008 00:32:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Dec 2008 16:32:48 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of deepalk@gmail.com designates 74.125.92.148 as permitted sender) Received: from [74.125.92.148] (HELO qw-out-1920.google.com) (74.125.92.148) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Dec 2008 00:32:34 +0000 Received: by qw-out-1920.google.com with SMTP id 9so594460qwj.28 for ; Mon, 15 Dec 2008 16:32:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=UCQbhKiCqtFQU6SCRm8Hn+MgHU0fkeVZHE14b3cl+/4=; b=iOfcReej41T4FpkQCNeDWFIgguYR7ofWoDFORXJsR8Bw825jT70oLZTSrV4p/otXj0 lOKmRehrDZ76x1jtL99tDQN1KRUhFVkX16ZlX5xvHNrg9Jv+RM574jdWe7K1qgXCgky0 USGA4m1Q9Tb/2qVna7sAAiQuxJBJSv39z8ofY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=YZBaLUxDPacsnSLM4s6LujkjnJJO7ZRSmBM+0M9m/8RNeIQ1VwkRK8UB+y3wPXjT7F Gih2DXWdhyBkGoFqH5WsbkOe/tfPM1tWASYTGG2uqIRNTralPuDspbYFuW0F7ZUPURCz c657MMKMIzurWLcY3ilrVQIfgeEWxUTTY+ZQM= Received: by 10.215.67.3 with SMTP id u3mr8567051qak.250.1229387533390; Mon, 15 Dec 2008 16:32:13 -0800 (PST) Received: from ?192.168.1.100? (adsl-152-212-97.asm.bellsouth.net [72.152.212.97]) by mx.google.com with ESMTPS id 33sm3961050yxr.32.2008.12.15.16.32.12 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 15 Dec 2008 16:32:12 -0800 (PST) Message-ID: <4946F70C.705@gmail.com> Date: Mon, 15 Dec 2008 19:32:12 -0500 From: Deepal jayasinghe User-Agent: Thunderbird 2.0.0.18 (Windows/20081105) MIME-Version: 1.0 To: axis-user@ws.apache.org Subject: Re: get Resource inside .aar? References: <21019445.post@talk.nabble.com> In-Reply-To: <21019445.post@talk.nabble.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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