Jerome Louvel schrieb:
Hi Frank,
I'm not sure either how to achieve this, normally you would specify a
context-param on your ServerServlet. Can't you specify that in OSGi Servlet
service?
I got it. Instead of the extension point, I register the ServerSevlet
with the HttpService. The registerServlet method allows me to pass in
initparams and a http context.
public void start(BundleContext bundleContext) throws Exception {
Hashtable initparams = new Hashtable();
initparams.put(
"org.restlet.application",
FirstStepsApplication.class.getName());
ServiceReference serviceReference = bundleContext
.getServiceReference(HttpService.class.getName());
if (serviceReference != null) {
HttpService httpService;
httpService = (HttpService) bundleContext
.getService(serviceReference);
if (httpService != null) {
httpService.registerServlet(
"/alias", new ServerServlet(),
initparams, httpContext);
}
}
System.out.println("started");
}
}
Otherwise, you might want to check this upcoming presentation on Restlet at
EclipseCon:
"RESTful OSGI Web Applications Tutorial"
http://www.eclipsecon.org/2008/index.php?page=sub/&id=462
I saw that already. "Unfortunately" I will be giving a tutorial on
Eclipse Data Binding at excatly the same time, in another room, at
EclpseCon.
Frank.