Re: Resource loading using Class.getResource or Class.getClassLoader().getResource()
Re: Resource loading using Class.getResource or Class.getClassLoader().getResource()
- Subject: Re: Resource loading using Class.getResource or Class.getClassLoader().getResource()
- From: Larry Mills-Gahl <email@hidden>
- Date: Tue, 09 Nov 2010 17:01:23 -0500
Success.
The include patternset is indeed the right place for this. Thank you all
for that.
the "build.woframework" target refers to the following includefiles:
<includesfile name="woproject/classes.include.patternset" />
Modifying woproject/classes.include.patternset to include line like:
**/*.xsl
works fine now.
In Application.java
logger.debug("classLoader: " +
Application.class.getClassLoader().getResource(AccessDistributionXMLDocument.PDF_TRANSFORM_FILE));
now yields:
DEBUG - classLoader:
file:/Users/lmg42/Development/Eclipse.Workspaces/VascAlert_201009/Web6/VAJava_EOFramework/build/VAJava_EOFramework.framework/Resources/Java/com/vascalert/xml/xslt/AccessTypeDistribution_XML2FOP_Portrait.xsl
Which is exactly what it should be. I'm going to try a test deployment
to make sure that this makes the transition to deployment and jars
without issue, but at least now getResource is working.
Thank you all.
On 11/9/10 3:41 PM, John Huss wrote:
> I tried and could not get it to work. But this isn't my area of expertise
> so I may have been doing it wrong. But I had in the body of wocompile:
>
> <include name="**/*.csv" />
>
>
> and
>
>
> <patternset includes="**/*.csv" />
>
> On Tue, Nov 9, 2010 at 2:16 PM, Mike Schrag <email@hidden> wrote:
>
>> isn't wocompile just a subclass of the normal ant task? can't you add an
>> include pattern for it in your build.xml?
>>
>> On Nov 9, 2010, at 3:13 PM, John Huss wrote:
>>
>> I was getting the files into the "build" folder (incremental builds), but
>> not in the "bin" folder (ant install builds). Fortunately, that means it
>> only fails in production. :-( The "wocompile" task is the problem. I
>> don't see that wocompile evens reads the classes.include.patternset, at
>> least it doesn't in the build.xml.
>>
>> John
>>
>> On Tue, Nov 9, 2010 at 2:08 PM, Mike Schrag <email@hidden> wrote:
>>
>>> you should be able to modify the classes patternset (i think that's what
>>> it's called?) ... we used to include a krb5.conf in our builds like that.
>>>
>>> On Nov 9, 2010, at 3:03 PM, John Huss wrote:
>>>
>>> I had a similar problem. The resource files in Sources were not actually
>>> making it into the jar. There seems to be no way to get the standard build
>>> tools to include anything except .class files in the jars that it builds for
>>> WO applications. You could manually copy the file as part of the build
>>> process before the jar is created perhaps. I ended up just putting it in
>>> the Resources folder. Or you could create a separate independent jar and
>>> put it in there.
>>>
>>> John
>>>
>>> On Tue, Nov 9, 2010 at 1:46 PM, Larry Mills-Gahl <email@hidden> wrote:
>>>
>>>> I am having difficulty finding out why getResource and
>>>> getClassLoader().getResource will not work as expected in my WO app. I
>>>> want to load some XSLT from a jar on the classpath so that I can keep
>>>> the versions of the transform the same between command line tools and
>>>> the web application. I don't want to have a duplicate where
>>>> application().resourceManager() can get it and I don't want to have to
>>>> teach the command line utilities about the location of WO resouces
>>>> (since they already can find it on the classpath)
>>>>
>>>> If someone can nudge me in the right direction or point me toward some
>>>> documentation (or perhaps the proper incantation to please the resource
>>>> gods) I would appreciate it very much.
>>>>
>>>> Thank you.
>>>>
>>>> Larry Mills-Gahl
>>>
>>> _______________________________________________
>>>
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>>
>>>
>>>
>>
>>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden