Thanks to all,
I made it with:
1. getResource("/weasis-connector.properties");
2. putting weasis-connector.properties in metadata
On Mon, Nov 21, 2011 at 8:50 AM, Jeremy Keiper <[email protected]> wrote:
> Form Entry uses getResources() in several places to grab files from the
> classpath, so you should be able to see there how to use it in a module
> effectively.
>
> Jeremy Keiper
> OpenMRS Core Developer
> AMPATH / IU-Kenya Support
>
>
>
> On Mon, Nov 21, 2011 at 6:34 AM, Ben Wolfe <[email protected]> wrote:
>
>> Check your omod to make sure that file is getting into the root of it.
>>
>> You could try using the OpenmrsClassLoader.getInstance().getResource()
>> method as well. Perhaps your class is being loaded straight by the
>> WebappClassLoader and so it doesn't know how to find it?
>>
>> Once you get that URL you can use OpenmrsUtil.url2file(url) to get the
>> actual File object.
>>
>> Ben
>>
>>
>> On Sat, Nov 19, 2011 at 3:17 AM, Darius Jazayeri <[email protected]
>> > wrote:
>>
>>> Hola,
>>>
>>> I haven't looked at the code, but I'd speculate that the reason this
>>> isn't working is because module servlets are "fake", i.e. there's actually
>>> a "ModuleServlet" in core that delegates to the servlets you'd define in
>>> your module's config.xml file.
>>>
>>> One way to get a resource is to put it in your module's "resources"
>>> folder, and get it via ModuleUtil.getPathForResource().
>>>
>>> If you go that route, could you please add a code snippet to the Module
>>> Resources wiki page (https://wiki.openmrs.org/x/PA8z) describing how to
>>> do it?
>>>
>>> -Darius
>>>
>>> 2011/11/18 Juan David Pastás Rivera <[email protected]>
>>>
>>>> Hi,
>>>>
>>>> I am defining a servlet in my module config file.
>>>>
>>>> And using this code in the servlet class:
>>>>
>>>> config =
>>>> this.getClass().getResource("weasis-connector.properties");
>>>>
>>>> I have weasis-connector.properties file inside the servlet class
>>>> folder, and in metadata, but the resource does not get found.
>>>>
>>>> Where do I have to put weasis-connector.properties file or what string
>>>> should I put to the resource be found? or other thing?
>>>>
>>>> Thanks
>>>> ------------------------------
>>>> Click here to
>>>> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-devel-l>from
>>>> OpenMRS Developers' mailing list
>>>
>>>
>>> ------------------------------
>>> Click here to
>>> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-devel-l>from
>>> OpenMRS Developers' mailing list
>>>
>>
>> ------------------------------
>> Click here to
>> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-devel-l>from
>> OpenMRS Developers' mailing list
>>
>
> ------------------------------
> Click here to
> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-devel-l>from
> OpenMRS Developers' mailing list
>
_________________________________________
To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to
[email protected] with "SIGNOFF openmrs-devel-l" in the body (not
the subject) of your e-mail.
[mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]