Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to register a servlet exetension point in program code without xml?
How to register a servlet exetension point in program code without xml? [message #666962] Mon, 25 April 2011 06:20 Go to next message
David Song is currently offline David SongFriend
Messages: 217
Registered: April 2011
Senior Member
How to register a servlet exetension point in program code without xml?
just like registering a service handle:
RWT.getServiceManager().registerServiceHandler(SERVICE_HANDL ER, new ImageServiceHandler());
Re: How to register a servlet exetension point in program code without xml? [message #667115 is a reply to message #666962] Tue, 26 April 2011 19:18 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi,

sorry, I didn't understand what you're trying to do. Could explain your
problem a bit more precisely?

Ralf

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: How to register a servlet exetension point in program code without xml? [message #667136 is a reply to message #667115] Wed, 27 April 2011 01:05 Go to previous messageGo to next message
David Song is currently offline David SongFriend
Messages: 217
Registered: April 2011
Senior Member
Thanks for your reply, Sternberg,
I mean that now we can register a rap servlet in extensions tab page in the file plugin.xml and add a extension point, but
if we can register a servlet in programming code just like we register a service handle?
thank you again
David
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 Go to previous messageGo to next message
Cole Markham is currently offline Cole MarkhamFriend
Messages: 150
Registered: July 2009
Location: College Station, TX
Senior Member

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
Re: How to register a servlet exetension point in program code without xml? [message #667154 is a reply to message #667138] Wed, 27 April 2011 06:56 Go to previous message
David Song is currently offline David SongFriend
Messages: 217
Registered: April 2011
Senior Member
thanks very much, I am greatly illuminated by the discussion!
Previous Topic:Display#addFilter
Next Topic:Login
Goto Forum:
  


Current Time: Fri Apr 19 01:49:21 GMT 2024

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

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

Back to the top