[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.technology.equinox] Re: How to get resource using ServletContext ?

Hi Setya,

Your servlet is using the "org.eclipse.rap.httpcontext" httpcontext so that 
will be what the lookup uses. If you want the lookup to occur inside your 
bundle you can either declare your own httpContext extension or just get 
default behavior by removing the httpcontextId attribute.

HTH
-Simon

"Setya" <jsetya@xxxxxxxxx> wrote in message 
news:h2njq6$8q3$1@xxxxxxxxxxxxxxxxxxxx
> Hi all,
>
> I've registered a servlet as follows:
>
> <extension point="org.eclipse.equinox.http.registry.servlets">
>       <servlet alias="/myservlet"         class="com.mycompany.MyServlet"
>             httpcontextId="org.eclipse.rap.httpcontext"
>             load-on-startup="true">
>       </servlet>
> </extension>
>
> In the bundle root I have folder 'config' which contains foo.xml.
>
> Now the question is how can I access the foo.xml file from within servlet 
> MyServlet ? I've tried ServletContext#getResource("/config/foo.xml") or 
> ServletContext#getResourceAsStream("/config/foo.xml") but they always 
> return null.
>
> Any help would be greatly appreciated.
>
> Regards,
>
> Setya