|
|
|
Re: How to register a servlet exetension point in program code without xml? [message #667138 is a reply to message #666962] |
Wed, 27 April 2011 02:12 |
|
David,
What you are looking for is OSGi HttpService. It will allow you to register a servlet programatically. The Equinox or OSGi communities may be able to find better support. I think most RAP users utilize ServiceHandler. A quick google search found the following example:
public class Activator implements BundleActivator
{
public void start(BundleContext context) throws Exception
{
ServiceReference sRef = context.getServiceReference(HttpService.class.getName());
if (sRef != null)
{
HttpService service = (HttpService) context.getService(sRef);
service.registerServlet("/date", new DateServlet(), null, null);
}
}
public void stop(BundleContext context) throws Exception
{
ServiceReference sRef = context.getServiceReference(HttpService.class.getName());
if (sRef != null)
{
HttpService service = (HttpService) context.getService(sRef);
service.unregister("/date");
}
}
}
From http://www.osgilook.com/2009/09/08/osgi-http-service-registe ring-servlets-on-the-fly/
Hope that helps,
Cole
|
|
|
|
Powered by
FUDForum. Page generated in 0.02164 seconds