[jboss-as7-dev] Loading resources through JBWeb context API

Jason T. Greene jason.greene at redhat.com
Wed Nov 2 14:12:55 EDT 2011


On 11/2/11 1:00 PM, Jason T. Greene wrote:
> On 11/2/11 2:39 AM, Remy Maucherat wrote:
>> On Tue, 2011-11-01 at 18:32 +0000, Thomas Diesler wrote:
>>> Hi Remy,
>>>
>>> I have a 3rd party servlet that uses this API
>>>
>>>          InputStream is = getServletContext().getResourceAsStream(propFile);
>>>
>>> How is it possible to hook into this call using the dynamic context API?
>>
>> You cannot replace the servlet context implementation.
>
> Thomas are you asking how to get the context to see the right resources?
>
> You can do:
> final Loader loader = new
>           WebCtxLoader(ThirdPartyClass.getClassLoader());
>
> ...
> context.setLoader(loader);
>

Oh duh I see what you mean. You want to be able to load resources 
*without* changing that call.

In that case you can just plug in your own DirContext impl.

-- 
Jason T. Greene
JBoss AS Lead / EAP Platform Architect
JBoss, a division of Red Hat


More information about the jboss-as7-dev mailing list