public void start(BundleContext bc) throws Exception {
		webContainerRef = bc.getServiceReference(WebContainer.class);
		if (webContainerRef != null) {
			final WebContainer webContainer = bc.getService(webContainerRef);
			if (webContainer != null) {
				// create a default context to share between registrations
				final HttpContext httpContext = webContainer
						.createDefaultHttpContext();
				// webContainer.begin(httpContext);
				// register jsp support
				Bundle bundle = bc.getBundle();
				Enumeration<?> entries = bundle.findEntries(JSP, "*", true);
				if (entries != null) {
					while (entries.hasMoreElements()) {
						URL entry = (URL) entries.nextElement();
						String jspFile = entry.toExternalForm().substring(
								entry.toExternalForm().lastIndexOf('/') + 1);
						String urlPattern = JSPC + "/" + jspFile;
						String jspcClassName = DEFAULT_PACKAGE
								+ convertPath(entry.toExternalForm()) + "."
								+ JspUtil.makeJavaIdentifier(jspFile);
						@SuppressWarnings("unchecked")
						Class<Servlet> precompiledClass = (Class<Servlet>) getClass()
								.getClassLoader().loadClass(jspcClassName);
						webContainer.registerServlet(precompiledClass,
								new String[]{urlPattern}, null, httpContext);
					}
				}
				webContainer.registerJsps(new String[]{JSP + "/*"}, // url
						// patterns
						httpContext // http context
				);
				// register images as resources
				webContainer.registerResources("/images", "/images",
						httpContext);
				// webContainer.end(httpContext);
			}
		}
	}
public void start ( BundleContext bc ) throws Exception { webContainerRef = bc . getServiceReference ( WebContainer . class ) ; if ( webContainerRef != null ) { final WebContainer webContainer = bc . getService ( webContainerRef ) ; if ( webContainer != null ) { final HttpContext httpContext = webContainer . createDefaultHttpContext ( ) ; Bundle bundle = bc . getBundle ( ) ; Enumeration < ? > entries = bundle . findEntries ( JSP , "*" , true ) ; if ( entries != null ) { while ( entries . hasMoreElements ( ) ) { URL entry = ( URL ) entries . nextElement ( ) ; String jspFile = entry . toExternalForm ( ) . substring ( entry . toExternalForm ( ) . lastIndexOf ( '/' ) + 1 ) ; String urlPattern = JSPC + "/" + jspFile ; String jspcClassName = DEFAULT_PACKAGE + convertPath ( entry . toExternalForm ( ) ) + "." + JspUtil . makeJavaIdentifier ( jspFile ) ; @ SuppressWarnings ( "unchecked" ) Class < Servlet > precompiledClass = ( Class < Servlet > ) getClass ( ) . getClassLoader ( ) . loadClass ( jspcClassName ) ; webContainer . registerServlet ( precompiledClass , new String [ ] { urlPattern } , null , httpContext ) ; } } webContainer . registerJsps ( new String [ ] { JSP + "/*" } , httpContext ) ; webContainer . registerResources ( "/images" , "/images" , httpContext ) ; } } }
Called when the OSGi framework starts our bundle