Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] HttpService in embeded Jetty 7.2.2 equinox

Hi Hugues,

Servlet bridge is used when the equinox is embedded within the servlet container could be tomcat or jetty .

http://www.eclipse.org/equinox/server/http_in_container.php

http://angelozerr.wordpress.com/category/java/osgi/equinox/equinox-servletbridge/ 

But in my case is i have equinox bundles and within that i embedded jetty bundles 7.2.1 . I did not have standalone installation of web container where i can deploy the war file .

What my requirement is when i start all the bundles HttpServices is started and programmetically lookup for this httpservice and register my servlet

here is my example snippet .

public HttpServiceTracker(BundleContext context) {
super(context, HttpService.class.getName(), null);
}

public Object addingService(ServiceReference reference) {
HttpService httpService = (HttpService) context.getService(reference);
try {
httpService.registerResources("/helloworld.html", "/helloworld.html", null); //$NON-NLS-1$ //$NON-NLS-2$
httpService.registerServlet("/helloworld", new HelloWorldServlet(), null, null); //$NON-NLS-1$
} catch (Exception e) {
e.printStackTrace();
}
return httpService;
}
public void removedService(ServiceReference reference, Object service) {
HttpService httpService = (HttpService) service;
httpService.unregister("/helloworld.html"); //$NON-NLS-1$
httpService.unregister("/helloworld"); //$NON-NLS-1$
super.removedService(reference, service);
}

Best Regards,
mitul


On Wed, Feb 9, 2011 at 7:34 AM, Hugues Malphettes <hmalphettes@xxxxxxxxxxx> wrote:
Hi Mitul,
jetty-7 does have a lot many more jars than jetty-6.
It sounds like what you are looking for is jetty-osgi:
http://wiki.eclipse.org/Jetty/Feature/Jetty_OSGi#OSGi.27s_HttpService_via_equinox_servlet_bridge
I hope this helps,
Hugues

On Tue, Feb 8, 2011 at 11:07 PM, Mitul Adhia <mituladhia19@xxxxxxxxx> wrote:
> Hi All,
> Could anyone please let me now how can i achieve httpservice in jetty 7.2.2
> embeded in equinox container ??
> Which are all the bundles can be used to achieve this ??? I have few bundles
> with me which are listed down . Do let me know which are all missing bundles
> if any .
> 1) jetty-continuation-7.2.2.v20101205.jar
> 2) jetty-http-7.2.2.v20101205.jar
> 3) jetty-io-7.2.2.v20101205.jar
> 4) jetty-security-7.2.2.v20101205.jar
> 5) jetty-server-7.2.2.v20101205.jar
> 6) jetty-servlet-7.2.2.v20101205.jar
> 7) jetty-util-7.2.2.v20101205.jar
> 8) jetty-xml-7.2.2.v20101205.jar
> The requirement would be to use ServiceTracer class from osgi which would
> track the HttpService of embeded web container here jetty .
> I did achieve this using the org.eclipse.equinox.http.jetty when i was using
> jetty 6.1 from mortbay. In that i was using following 2 bundles from
> mortbay
> 1) org.mortbay.jetty.server
> 2) org.morbay.jetty.util.
> But now i have upgraded to jetty 7.2.2 and wanted to achieve the
> same behavior. Now while using jetty7.2.2 i have removed the morbay bundles
> as well the bundle from equinox i.e org.eclipse.equinox.http.jetty as this
> bundle is still pointing to morbay bundle 6.1 :(
>
> Best Regards,
> Mitul
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
>
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top