开发者

where should i put the configuration files in a webservice

Could some one help me on this problem. i have webservice , which reads data from configuration files. When i run this webservice from eclipse , i give absolute the path for these webservices of these configuration files , but when i shift the webser开发者_StackOverflow中文版vice in to server and run, it can not read the config file. so how can i solve this problem. is there a relative path that webservice can understand during run time.


You can put your configuration files in the root of the AAR archive or in the classes folder. Then use getResourceAsStream to read them.

ClassLoader loader = getClass().getClassLoader();
InputStream inputstream = loader.getResourceAsStream(sFilePath);


How are you deploying these configurations. If they're packed inside the .aar file I would expect them to reside in the classpath, and you could access them via Class.getResourceAsStream()

If they're deployed in the .aar file, however, they're going to be difficult to edit post deployment. In that case you may want to deploy them separately as files and put them in a location well-known to the application, and just read them as files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜