Hi Shashi:
Here is my piece of code.
public class Activator implements BundleActivator {
private ServiceTracker httpServiceTracker;
String jspContext = "/jsps";
String jspFolder = "/web_files"; //the jsp folder your page in
public void start(BundleContext context) throws Exception {
httpServiceTracker = new HttpServiceTracker(context);
httpServiceTracker.open();
}
public void stop(BundleContext context) throws Exception {
httpServiceTracker.open();
}
private class HttpServiceTracker extends ServiceTracker {
public HttpServiceTracker(BundleContext context) {
super(context, HttpService.class.getName(), null);
}
public Object addingService(ServiceReference reference) {
final HttpService httpService = (HttpService) context
.getService(reference);
try {
HttpContext commonContext = new BundleEntryHttpContext(context
.getBundle(), jspFolder);
httpService.registerResources(jspContext, "/", commonContext);
Servlet adaptedJspServlet = new ContextPathServletAdaptor(
new JspServlet(context.getBundle(), jspFolder),
jspContext);
httpService.registerServlet(jspContext + "/*.jsp",
adaptedJspServlet, null, commonContext);
} catch (Exception e) {
e.printStackTrace();
}
return httpService;
}
public void removedService(ServiceReference reference, Object service) {
final HttpService httpService = (HttpService) service;
httpService.unregister(jspContext);
httpService.unregister(jspContext + "/*.jsp");
super.removedService(reference, service);
}
}
}
best regards.
2010-01-04
fox
发件人: Shashikant Kale
发送时间: 2009-12-22 17:26:24
收件人: Equinox development mailing list
抄送:
主题: RE: [equinox-dev] Regarding filters and listeners serversideequinoxwith
servlet bridge.
Thanks much Fox.
Do you have any example showing how to use the helper?
Thanks for your help,
Shashi
From: [email protected] [mailto:[email protected]]
On Behalf Of fox
Sent: Tuesday, December 22, 2009 2:52 PM
To: Equinox development mailing list
Subject: Re: [equinox-dev] Regarding filters and listeners server
sideequinoxwith servlet bridge.
Hi Shashi:
Here is the jar file of
org.eclipse.equinox.http.helper_1.0.0.200801161414.jar that you want,please
check it.
best regards.
2009-12-22
fox
发件人: Shashikant Kale
发送时间: 2009-12-22 17:10:15
收件人: [email protected]
抄送:
主题: [equinox-dev] Regarding filters and listeners server side equinoxwith
servlet bridge.
Hello,
We have a project wherein we embed a servlet container within OSGi and run a
web project. Now we need to extend this further and run within an application
server. I am planning to use equinox servlet bridge for this. However we have a
requirement to have filter and listener within the project. As per the OSGi
http specs these are not yet supported.
I would like to know if there are any alternatives to achieve this. I am taking
a look at https://bugs.eclipse.org/bugs/show_bug.cgi?id=128067 which talks
about filter support in OSGi http service however am unsure of how to use it.
Also I took a look at the comment from Simon Kaegi for achieving this
functionality in the bug above.
“If you want to look at an approach that works currently to support many of the
Filter and Listener use-cases take a look in the
equinox-incubator/org.eclipse.equinox.http.helper project.”
However I am not able to get the org.eclipse.equinox.http.helper project
anymore.
Could somebody please point to where I can find some more information regarding
this.
Thanks in advance,
Shashi
_______________________________________________
equinox-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/equinox-dev