void start(BundleContext::Ptr pContext)
	{
		MediaTypeMapper::Ptr pMediaTypeMapper = new MediaTypeMapper;
		std::auto_ptr<std::istream> pStream(pContext->thisBundle()->getResource("mime.types"));
		if (pStream.get())
		{
			pMediaTypeMapper->load(*pStream);
		}
		_pMediaTypeMapperSvc = pContext->registry().registerService(MediaTypeMapper::SERVICE_NAME, pMediaTypeMapper, Properties());
		ServiceRef::Ptr pPrefsSvcRef = pContext->registry().findByName("osp.core.preferences");

		std::string authServiceName(pContext->thisBundle()->properties().getString("authServiceName", ""));
		bool cacheResources(pContext->thisBundle()->properties().getBool("cacheResources", false));
		bool compressResponse(pContext->thisBundle()->properties().getBool("compressResponses", false));
		std::string compressedMediaTypesString(pContext->thisBundle()->properties().getString("compressedMediaTypes", ""));
		std::string sessionCookiePersistence(pContext->thisBundle()->properties().getString("cookiePersistence", "persistent"));
		if (pPrefsSvcRef)
		{
			Poco::AutoPtr<PreferencesService> pPrefsSvc = pPrefsSvcRef->castedInstance<PreferencesService>();
			authServiceName = pPrefsSvc->configuration()->getString("osp.web.authServiceName", authServiceName);
			cacheResources = pPrefsSvc->configuration()->getBool("osp.web.cacheResources", cacheResources);
			compressResponse = pPrefsSvc->configuration()->getBool("osp.web.compressResponses", compressResponse);
			compressedMediaTypesString = pPrefsSvc->configuration()->getString("osp.web.compressedMediaTypes", compressedMediaTypesString);
			sessionCookiePersistence = pPrefsSvc->configuration()->getString("osp.web.sessionManager.cookiePersistence", sessionCookiePersistence);
		}

		Poco::StringTokenizer tok(compressedMediaTypesString, ",", Poco::StringTokenizer::TOK_TRIM | Poco::StringTokenizer::TOK_IGNORE_EMPTY);
		std::set<std::string> compressedMediaTypes(tok.begin(), tok.end());
		
		AutoPtr<WebServerDispatcher> pWebServerDispatcher = new WebServerDispatcher(pContext, pMediaTypeMapper, authServiceName, compressResponse, compressedMediaTypes, cacheResources);
		_pWebServerDispatcherSvc = pContext->registry().registerService(WebServerDispatcher::SERVICE_NAME, pWebServerDispatcher, Properties());
		
		WebSessionManager::CookiePersistence cookiePersistence = WebSessionManager::COOKIE_PERSISTENT;
		if (sessionCookiePersistence == "transient")
			cookiePersistence = WebSessionManager::COOKIE_TRANSIENT;
		else if (sessionCookiePersistence != "persistent")
			pContext->logger().warning(Poco::format("Ignoring invalid value for osp.web.sessionManager.cookiePersistence: '%s'. Valid values are 'transient' or 'persistent'.", sessionCookiePersistence));
		
		AutoPtr<WebSessionManager> pWebSessionManager = new WebSessionManager;
		pWebSessionManager->setCookiePersistence(cookiePersistence);
		_pWebSessionManagerSvc = pContext->registry().registerService(WebSessionManager::SERVICE_NAME, pWebSessionManager, Properties());

		ServiceRef::Ptr pXPSRef = pContext->registry().findByName("osp.core.xp");
		if (pXPSRef)
		{
			AutoPtr<ExtensionPointService> pXPS = pXPSRef->castedInstance<ExtensionPointService>();
			_pWebServerExtensionPoint = new WebServerExtensionPoint(pContext, pWebServerDispatcher);
			pXPS->registerExtensionPoint(pContext->thisBundle(), WebServerExtensionPoint::EXTPOINT_DIRECTORY, _pWebServerExtensionPoint);
			pXPS->registerExtensionPoint(pContext->thisBundle(), WebServerExtensionPoint::EXTPOINT_HANDLER, _pWebServerExtensionPoint);
			_pWebFilterExtensionPoint = new WebFilterExtensionPoint(pContext, pWebServerDispatcher);
			pXPS->registerExtensionPoint(pContext->thisBundle(), WebFilterExtensionPoint::EXTPOINT_FILTER, _pWebFilterExtensionPoint);
		}
		else
		{
			pContext->logger().error("The ExtensionPointService is not available.");
		}		
	}
	void start(BundleContext::Ptr pContext)
	{
		// find ExtensionPointService using the Service Registry
		ServiceRef::Ptr pXPSRef = pContext->registry().findByName("osp.core.xp");
		if (pXPSRef)
		{
			// ExtensionPointService is available
			AutoPtr<ExtensionPointService> pXPS = pXPSRef->castedInstance<ExtensionPointService>();
			
			// Create an ExtensionPoint
			ExtensionPoint::Ptr pXP = new TestExtensionPoint(pContext);
			
			// Register ExtensionPoint
			pXPS->registerExtensionPoint(pContext->thisBundle(), "com.appinf.osp.unit.test", pXP);
		}
		else
		{
			// The service is not available
			pContext->logger().error("The ExtensionPointService is not available.");
		}
	}