Skip to main content



      Home
Home » Eclipse Projects » Equinox » Init-Params
Init-Params [message #79640] Tue, 19 December 2006 18:09 Go to next message
Eclipse UserFriend
Originally posted by: ridcully560.yahoo.com

Hello,

in a JSP of my webapp I need some init-params like the ones that are set
in a context.xml of a tomcat-webapp:

> <Parameter name="url" value="http://localhost/path/"/>

They are used in the JSP as follows:

> <c:if test="${not empty initParam['url']}">

I tried to set the init-params with the servlets used in the plugin.xml
of my bundle, but that doesn't seem to work.

> <extension
> id="servlet"
> point="org.eclipse.equinox.http.registry.servlets">
> <servlet
> alias="/Servlet"
> class="Servlet">
> <init-param
> name="url"
> value="http://localhost/path/"/>
> </servlet>
> </extension>

It doesn't look right, as it seems to me that it should be some kind of
init-param defined with the recources, and not with the servlets.

Is there a similar thing to those tomcat init-params?

Johannes
Re: Init-Params [message #79700 is a reply to message #79640] Wed, 20 December 2006 17:19 Go to previous message
Eclipse UserFriend
Hi Johannes,

I think you're looking for ServletContext init-params.
The OSGi Http Service has an HttpContext which is used as the underlying
basis of a ServletContext. Unfortunately the HttpContext doesn't support
init-params.

In the Equinox implementation we "could" do something to try and offer
support -- I might open a bug -- however this would be proprietary.

A more general but complex approach is when registering your servlet to wrap
your servlet around a ServletContext adapter that overrides
getInitParameter(...) and getInitParameterNames() giving access to
parameters you've pre-set. If you're determined this definitely will work.

HTH
-Simon



"Johannes" <ridcully560@yahoo.com> wrote in message
news:em9rde$3lj$1@utils.eclipse.org...
> Hello,
>
> in a JSP of my webapp I need some init-params like the ones that are set
> in a context.xml of a tomcat-webapp:
>
>> <Parameter name="url" value="http://localhost/path/"/>
>
> They are used in the JSP as follows:
>
>> <c:if test="${not empty initParam['url']}">
>
> I tried to set the init-params with the servlets used in the plugin.xml of
> my bundle, but that doesn't seem to work.
>
>> <extension
>> id="servlet"
>> point="org.eclipse.equinox.http.registry.servlets">
>> <servlet
>> alias="/Servlet"
>> class="Servlet">
>> <init-param
>> name="url"
>> value="http://localhost/path/"/>
>> </servlet>
>> </extension>
>
> It doesn't look right, as it seems to me that it should be some kind of
> init-param defined with the recources, and not with the servlets.
>
> Is there a similar thing to those tomcat init-params?
>
> Johannes
Previous Topic:RequestDispatcherAdaptor NullPointerException
Next Topic:Fake OSGi in enterprise applications?
Goto Forum:
  


Current Time: Fri Jul 04 02:15:46 EDT 2025

Powered by FUDForum. Page generated in 0.10135 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top