Skip to main content



      Home
Home » Eclipse Projects » Equinox » Custom HttpContext with org.eclipse.equinox.http.registry.httpcontexts Extension
Custom HttpContext with org.eclipse.equinox.http.registry.httpcontexts Extension [message #79775] Thu, 21 December 2006 18:16 Go to next message
Eclipse UserFriend
Hey,

I'm trying to develop a custom HttpContext to provide security via the
handleSecurity() method.
The idea being someone wanting to protect their resources/servlets would
just need to specify this custom SecureHttpContext when registering the
servlet/resource.

The problem I'm having is trying to figure out how to implement
getResource() when the HttpContext and servlet/resource are configured
as extensions.

When a HttpContext is configured as an extension, and the 'CLASS'
attribute for the extension is specified, then the creation of the
HttpContext is done via a call to
IConfigurationElement.createExecutableExtension(CLASS), in
org.eclipse.equinox.http.registry.internal.HttpContextManage r.added(IExtension
extension). Which means that the custom HttpContext doesn't receive a
reference to the loading bundle, or any path that may have been set in
the extension details, as the DefaultHttpContextImpl does. So I can't
figure out how to load any resources that are supplied by the bundle.

At the moment I've modified HttpContextManager to use reflection and
call setBundle() and setPath() on the context it creates if it has these
methods, but after doing this I figured either I must be missing
something or that I'd like to submit an enhancement request.

Can anyone help?

Cheers,
Shaun
Re: Custom HttpContext with org.eclipse.equinox.http.registry.httpcontexts Extension [message #79791 is a reply to message #79775] Thu, 21 December 2006 23:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: skaegi.sympatico.ca

Hi Shaun,

If your custom HttpContext needs access to the config information in the
extension have it implement org.eclipse.core.runtime.IExecutableExtension or
better use an IExecutableExtensionFactory.

One slight pain is to then get the associated Bundle as (at least when I
last looked) the registry does not provide direct support for going from the
Contributor to the contributing Bundle. You can do it with PackageAdmin
however it's a bit of work as you can see in HttpContextManager.

HTH
-Simon


"Shaun Forbes" <sforbes@sforbes.myip.org> wrote in message
news:emf4ke$l5g$1@utils.eclipse.org...
> Hey,
>
> I'm trying to develop a custom HttpContext to provide security via the
> handleSecurity() method.
> The idea being someone wanting to protect their resources/servlets would
> just need to specify this custom SecureHttpContext when registering the
> servlet/resource.
>
> The problem I'm having is trying to figure out how to implement
> getResource() when the HttpContext and servlet/resource are configured
> as extensions.
>
> When a HttpContext is configured as an extension, and the 'CLASS'
> attribute for the extension is specified, then the creation of the
> HttpContext is done via a call to
> IConfigurationElement.createExecutableExtension(CLASS), in
>
org.eclipse.equinox.http.registry.internal.HttpContextManage r.added(IExtensi
on
> extension). Which means that the custom HttpContext doesn't receive a
> reference to the loading bundle, or any path that may have been set in
> the extension details, as the DefaultHttpContextImpl does. So I can't
> figure out how to load any resources that are supplied by the bundle.
>
> At the moment I've modified HttpContextManager to use reflection and
> call setBundle() and setPath() on the context it creates if it has these
> methods, but after doing this I figured either I must be missing
> something or that I'd like to submit an enhancement request.
>
> Can anyone help?
>
> Cheers,
> Shaun
Re: Custom HttpContext with org.eclipse.equinox.http.registry.httpcontexts Extension [message #79804 is a reply to message #79791] Fri, 22 December 2006 01:20 Go to previous message
Eclipse UserFriend
Thanks Simon,

I knew there'd have to be a way to do it.

Obviously (now anyway) the IExecutableExtension was the way to got with
the path (30 seconds to fix that one).

And now I'll get my activator to track a package admin service and use
the contributor name in the setInitializationData() to find the bundle.

Too easy.

Cheers,
Shaun

Simon Kaegi wrote:
> Hi Shaun,
>
> If your custom HttpContext needs access to the config information in the
> extension have it implement org.eclipse.core.runtime.IExecutableExtension or
> better use an IExecutableExtensionFactory.
>
> One slight pain is to then get the associated Bundle as (at least when I
> last looked) the registry does not provide direct support for going from the
> Contributor to the contributing Bundle. You can do it with PackageAdmin
> however it's a bit of work as you can see in HttpContextManager.
>
> HTH
> -Simon
>
>
> "Shaun Forbes" <sforbes@sforbes.myip.org> wrote in message
> news:emf4ke$l5g$1@utils.eclipse.org...
>> Hey,
>>
>> I'm trying to develop a custom HttpContext to provide security via the
>> handleSecurity() method.
>> The idea being someone wanting to protect their resources/servlets would
>> just need to specify this custom SecureHttpContext when registering the
>> servlet/resource.
>>
>> The problem I'm having is trying to figure out how to implement
>> getResource() when the HttpContext and servlet/resource are configured
>> as extensions.
>>
>> When a HttpContext is configured as an extension, and the 'CLASS'
>> attribute for the extension is specified, then the creation of the
>> HttpContext is done via a call to
>> IConfigurationElement.createExecutableExtension(CLASS), in
>>
> org.eclipse.equinox.http.registry.internal.HttpContextManage r.added(IExtensi
> on
>> extension). Which means that the custom HttpContext doesn't receive a
>> reference to the loading bundle, or any path that may have been set in
>> the extension details, as the DefaultHttpContextImpl does. So I can't
>> figure out how to load any resources that are supplied by the bundle.
>>
>> At the moment I've modified HttpContextManager to use reflection and
>> call setBundle() and setPath() on the context it creates if it has these
>> methods, but after doing this I figured either I must be missing
>> something or that I'd like to submit an enhancement request.
>>
>> Can anyone help?
>>
>> Cheers,
>> Shaun
>
>
Previous Topic:Guidelines about plugin refactorization and OSGi services vs. extension points.
Next Topic:ClassLoader deadlock issues
Goto Forum:
  


Current Time: Tue Jul 22 13:05:16 EDT 2025

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

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

Back to the top