{"id":25331,"date":"2015-07-22T15:00:49","date_gmt":"2015-07-22T12:00:49","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=25331"},"modified":"2019-04-10T13:12:49","modified_gmt":"2019-04-10T10:12:49","slug":"jetty-osgi-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/","title":{"rendered":"Jetty OSGi Example"},"content":{"rendered":"<p>The OSGi specification defines a modularization and component model for Java applications. Jetty leverages OSGi support providing an infrastructure that enables developers to deploy Jetty and web applications inside an OSGi container. One can deploy traditional Java Web Applications or Context Handlers on Jetty within the OSGi container; in addition to this, OSGi bundles can be deployed as web applications.<\/p>\n<p>In this example, we are going to show how we can deploy Web Applications on Jetty within an OSGi container. We are going to enable a Jetty Server on an OSGi container first, thereafter we are going to deploy a Servlet on our OSGi&nbsp;powered Jetty.<\/p>\n<h2>1.&nbsp;Environment and Prerequisites<\/h2>\n<p>In this example, we are going to use the following programming environment:<\/p>\n<ul>\n<li>Java 8 (Java 7 is also OK for this example )<\/li>\n<li>Eclipse for RCP and RAP Developers v4.5 (Mars)<\/li>\n<li>Equinox 3.10 OSGi implementation (v 3.9 is also fine) configured in Eclipse<\/li>\n<li>Jetty v9.2.11(We do not necessarily need Jetty installation, however having one will be handy)<\/li>\n<\/ul>\n<p>At this point, we are not going to detail Equinox configuration in Eclipse, which would be beyond scope of this example. We assume that it is already configured.\n<\/p>\n<h2>2. Adding Jetty dependencies to OSGi Target<\/h2>\n<h3>2.1 Jetty libraries<\/h3>\n<p>Jetty JAR files, which happen to exist under the <i>lib<\/i> folder of the Jetty installation contain appropriate manifest entries(MANIFEST.MF) for OSGi deployment. All we have to do is, to copy the necessary JARs under our OSGi target.<\/p>\n<p>The necessary libraries are as follows:<\/p>\n<ul>\n<li>jetty-util<\/li>\n<li>jetty-http<\/li>\n<li>jetty-io<\/li>\n<li>jetty-security<\/li>\n<li>jetty-server<\/li>\n<li>jetty-servlet<\/li>\n<li>jetty-webapp<\/li>\n<li>jetty-deploy<\/li>\n<li>jetty-xml<\/li>\n<li>jetty-osgi-servlet-api<\/li>\n<\/ul>\n<p>We have to place&nbsp;these libraries in&nbsp;a location that our OSGi container is aware of. We can wither copy to an existing location, or create a new location. In this example, we have copied to an existing OSGi target location.<\/p>\n<h3>2.2 jetty-osgi-boot Bundle<\/h3>\n<p>After copying Jetty dependencies, we have to add the jetty-osgi-boot bundle to the OSGi target. jetty-osgi-boot is the bundle that performs the initialization of the Jetty server. This bundle is not included in the Jetty installation, but can be easily obtained from <a href=\"http:\/\/central.maven.org\/maven2\/org\/eclipse\/jetty\/osgi\/jetty-osgi-boot\/\">Maven Central Repository<\/a>.<\/p>\n<p>Once we have downloaded the bundle, we should&nbsp;copy it to the OSGi target location.<\/p>\n<h3>2.3 Reloading OSGi Target<\/h3>\n<p>After we have copied the Jetty libs and boot bundle, we have to refresh our container in Eclipse. This can be performed following the steps below:<\/p>\n<ol>\n<li>Open Eclipse &#8220;<em>Preferences<\/em>&#8221; from the Menu<\/li>\n<li>Search for \u201c<em>Target<\/em>\u201d from the search box on the top left.<\/li>\n<li>Select your OSGi target<\/li>\n<li>Press \u201c<em>Reload<\/em>\u201d.<\/li>\n<\/ol>\n<h2>3. Running the Jetty Server on the OSGi container<\/h2>\n<p>jetty-osgi-boot bundle provides two options for the server initialization one of which must be configured:<\/p>\n<ul>\n<li>Setting jetty.home.bundle<\/li>\n<li>Setting jetty home<\/li>\n<\/ul>\n<p>The first option stipulates that Jetty runs with the predefined XML files coming with the bundle JAR. The second option requires setting a Jetty home with the necessary configuration files. In this example, we will take the second option.<\/p>\n<p>This can be accomplished as follows:<\/p>\n<ol>\n<li>Create a folder named \u201c<em>osgi-jetty-home<\/em>\u201d (You can name is as you wish.)<\/li>\n<li>Create the folder \u201c<em>osgi-jetty-home\/etc<\/em>\u201d<\/li>\n<li>Include <em>jetty.xml, jetty-selector.xml and jetty-deploy.xml<\/em> files under <em>\u201cosgi-jetty-home\/etc<\/em>\u201d. (Alternatively, you can copy from <i>jetty-osgi-boot<\/i> JAR or jetty installation)<\/li>\n<li>Add the following JVM parameter to run configuration of your OSGi container: <em>-Djetty.home=\/path\/to\/your\/osgi-jetty-home<\/em><\/li>\n<\/ol>\n<p>When you run the OSGi container, you will see that Jetty has started on port 8080. You can check via your browser navigating to <a href=\"http:\/\/localhost:8080\">http:\/\/localhost:8080<\/a>.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><figure id=\"attachment_25365\" aria-describedby=\"caption-attachment-25365\" style=\"width: 809px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/osgi1_2.jpg\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/osgi1_2.jpg\" alt=\"OSGi powered Jetty\" width=\"809\" height=\"492\" class=\"size-full wp-image-25365\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/osgi1_2.jpg 809w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/osgi1_2-300x182.jpg 300w\" sizes=\"(max-width: 809px) 100vw, 809px\" \/><\/a><figcaption id=\"caption-attachment-25365\" class=\"wp-caption-text\">OSGi powered Jetty<\/figcaption><\/figure><\/p>\n<h2>4. Deploying a Servlet on the OSGi Jetty<\/h2>\n<p>In this part, we will show how to deploy a simple servlet on the Jetty which runs in our OSGi container. The example can be extended to include web apps, resource handlers or other configuration.<\/p>\n<p>In this example we are going to create a simple OSGi bundle, in the activator of which, we will configure a Servlet and register its handler as an OSGi component.<\/p>\n<h3>4.1 Creating the Eclipse Project<\/h3>\n<p>We start with creating the Eclipse project. The steps needed are as follows:<\/p>\n<ol>\n<li>Click on \u201c<i>File&#8211;&gt;New-&gt;Plug-in Project\u201d.<\/i><\/li>\n<li>Type project name as <i>\u201cjetty-osgi-example<\/i>\u201d.<\/li>\n<li>Select<em> \u201can OSGi framework\u201d<\/em> as the target platform.<\/li>\n<li>Press <em>\u201cNext&#8221;<\/em>.<\/li>\n<li>Check the option:\u201dGenerate an Activator\u2026.\u201d.<\/li>\n<li>Press <em>\u201cFinish\u201d<\/em>.<\/li>\n<li>\n<p><figure id=\"attachment_25370\" aria-describedby=\"caption-attachment-25370\" style=\"width: 678px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/osgi2_11.jpg\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/osgi2_11.jpg\" alt=\"Creating the Eclipse project\" width=\"678\" height=\"813\" class=\"size-full wp-image-25370\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/osgi2_11.jpg 678w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/osgi2_11-250x300.jpg 250w\" sizes=\"(max-width: 678px) 100vw, 678px\" \/><\/a><figcaption id=\"caption-attachment-25370\" class=\"wp-caption-text\">Creating the Eclipse project<\/figcaption><\/figure><\/li>\n<\/ol>\n<h3>4.2 Adding Required Plugins<\/h3>\n<p>After we have created our project, we have to add Jetty dependencies as Required Plugins in the <i>MANIFEST.MF<\/i> file. We can do it through Eclipse as follows:<\/p>\n<ol>\n<li>Open \u201c<i>META-INF\/MANIFEST.MF<\/i>\u201d file with Eclipse Editor<\/li>\n<li>On the \u201c<em>Dependencies<\/em>\u201d, click on \u201cAdd\u201d button on the \u201c<em>Required Plug-ins<\/em>&#8221; section.<\/li>\n<li>Type \u201c<em>Jetty<\/em>\u201d in the search box and add all the Jetty plugins that are available in the OSGi container.<\/li>\n<li>Press \u201c<em>OK<\/em>\u201d.<\/li>\n<\/ol>\n<p>Now, the Jetty dependencies are ready. Our <i>MANIFEST.MF<\/i> file looks like:<\/p>\n<p><span style=\"text-decoration: underline\"><em>MANIFEST.MF<\/em><\/span><\/p>\n<pre class=\"brush:xml\">Manifest-Version: 1.0\nBundle-ManifestVersion: 2\nBundle-Name: Jetty-osgi-example\nBundle-SymbolicName: jetty-osgi-example\nBundle-Version: 1.0.0.qualifier\nBundle-Activator: jetty_osgi_example.Activator\nBundle-RequiredExecutionEnvironment: JavaSE-1.8\nImport-Package: org.osgi.framework;version=\"1.3.0\"\nBundle-ActivationPolicy: lazy\nRequire-Bundle: org.eclipse.jetty.server;bundle-version=\"9.2.11\",\n org.eclipse.jetty.osgi-servlet-api;bundle-version=\"3.1.0\",\n org.eclipse.jetty.servlet;bundle-version=\"9.2.11\",\n org.eclipse.jetty.deploy;bundle-version=\"9.2.11\",\n org.eclipse.jetty.http;bundle-version=\"9.2.11\",\n org.eclipse.jetty.io;bundle-version=\"9.2.11\",\n org.eclipse.jetty.osgi.boot;bundle-version=\"9.2.11\",\n org.eclipse.jetty.security;bundle-version=\"9.2.11\",\n org.eclipse.jetty.util;bundle-version=\"9.2.11\",\n org.eclipse.jetty.webapp;bundle-version=\"9.2.11\",\n org.eclipse.jetty.xml;bundle-version=\"9.2.11\"\n\n<\/pre>\n<h3>4.3&nbsp;Wiring our Servlet to OSGI and Jetty<\/h3>\n<p>After setting the dependencies, we are going deploy a simple Servlet on our OSGi powered Jetty. Our Servlet is named as <i>JcgServlet<\/i> and very simple as follows:[ulp id=&#8217;xFHGZUmgemwCMrAR&#8217;]<\/p>\n<p><span style=\"text-decoration: underline\"><em>JcgServlet.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package jetty_osgi_example;\n\nimport java.io.IOException;\n\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\npublic class JcgServlet extends HttpServlet{\n\n\t@Override\n\tprotected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tresp.getWriter().println(\"Hello JCG, Hello OSGi\");\n\t}\n\t\n\tpublic JcgServlet() {\n\t\tsuper();\n\t}\n}\n\n<\/pre>\n<p>Now we are going to wire this Servlet to our Jetty. As you remember, while creating the Eclipse Project, we had checked the option \u201c<i>Generate an Activator..<\/i>.\u201d. This selection creates a class<em> jetty_osgi_example.Activator<\/em>. In this class, we can register our components to OSGi once the bundle is activated. Now we are going to register our Servlet Handler, so that it will be available to the Jetty.<\/p>\n<p>We are going to implement the <em>activate()<\/em> method of the Activator. Below you can see the <em>Activator<\/em> class decorated with source code comments.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Activator.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package jetty_osgi_example;\n\nimport java.util.Hashtable;\n\nimport org.eclipse.jetty.server.handler.ContextHandler;\nimport org.eclipse.jetty.servlet.ServletContextHandler;\nimport org.eclipse.jetty.servlet.ServletHandler;\nimport org.osgi.framework.BundleActivator;\nimport org.osgi.framework.BundleContext;\n\npublic class Activator implements BundleActivator {\n\n\tprivate static BundleContext context;\n\n\tstatic BundleContext getContext() {\n\t\treturn context;\n\t}\n\n\t\n\tpublic void start(BundleContext bundleContext) throws Exception {\n\t\tActivator.context = bundleContext;\n\t\t\n\t\t\/\/1. We create a Servlet Handler\n\t\tServletHandler handler = new ServletHandler();\n\n\t\t\/\/2. We register our Servlet and its URL mapping\n\t\thandler.addServletWithMapping(JcgServlet.class, \"\/*\");\n\n\t\t\/\/3. We are creating a Servlet Context handler\n\t\tServletContextHandler ch= new ServletContextHandler();\n\t\t\n\t\t\/\/4. We are defining the context path\n\t\tch.setContextPath(\"\/jcgservletpath\");\n\t\t\n\t\t\/\/5. We are attaching our servlet handler\n\t\tch.setServletHandler(handler);\n\t\t\n\t\t\/\/6. We are creating an empty Hashtable as the properties\n\t\tHashtable props = new Hashtable();\n\t\t\n\t\t\/\/ 7. Here we register the ServletContextHandler as the OSGi service\n\t\tbundleContext.registerService(ContextHandler.class.getName(), ch, props);\n\n\t\tSystem.out.println(\"Registration Complete\");\n\t}\n\n\t\n\tpublic void stop(BundleContext bundleContext) throws Exception {\n\t\tActivator.context = null;\n\t}\n\n}\n\n<\/pre>\n<p>In the activator, we have first created a <i>ServletHandler<\/i> and registered our <i>Servlet<\/i> along with a&nbsp;mapping. Thereafter we appended it to a <i>ServletContextHandler<\/i> with a context path. Lastly we have registered our <i>ServletContextHandler<\/i> as an OSGi component. Now our Jetty Server will find our <i>ServletContextHandler <\/i>as its context handler.<\/p>\n<p>Please note that, the the components are resolved by name, therefore the component name <i>ContextHandler.class.getName()<\/i> shouldn\u2019t be replaced with an arbitrary name.<\/p>\n<p>After we implemented our bundle, we can run our OSGi container. when we try to access <a href=\"http:\/\/localhost:8080\/jcgservletpath\/\">http:\/\/localhost:8080\/jcgservletpath\/<\/a>, we will see that our request is handled by our Servlet with the following response:<\/p>\n<p><figure id=\"attachment_25371\" aria-describedby=\"caption-attachment-25371\" style=\"width: 876px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/osgi3_1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-25371\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/osgi3_1.jpg\" alt=\"Servlet Response\" width=\"876\" height=\"436\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/osgi3_1.jpg 876w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/osgi3_1-300x149.jpg 300w\" sizes=\"(max-width: 876px) 100vw, 876px\" \/><\/a><figcaption id=\"caption-attachment-25371\" class=\"wp-caption-text\">Servlet Response<\/figcaption><\/figure><\/p>\n<p>Now we have a Servlet running on the Jetty within an OSGI container. This example can be tried with different Handler and web application configurations. Jetty promises full support for&nbsp;OSGi.<\/p>\n<h2>4. Conclusion<\/h2>\n<p>Jetty provides full support for OSGi containers in order to leverage modularity. In this example, we have deployed Jetty in an OSGi container thereafter we have deployed a Servlet on this Jetty, in which we have defined our <i>ServletContextHandler<\/i> as an OSGi service.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here : <strong> <a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/07\/jetty-osgi-example.zip\">Jetty OSGi Example<\/a><\/strong><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The OSGi specification defines a modularization and component model for Java applications. Jetty leverages OSGi support providing an infrastructure that enables developers to deploy Jetty and web applications inside an OSGi container. One can deploy traditional Java Web Applications or Context Handlers on Jetty within the OSGi container; in addition to this, OSGi bundles can &hellip;<\/p>\n","protected":false},"author":54,"featured_media":1239,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[1156,1000],"class_list":["post-25331","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jetty","tag-eclipse","tag-osgi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Jetty OSGi Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"The OSGi specification defines a modularization and component model for Java applications. Jetty leverages OSGi support providing an infrastructure that\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Jetty OSGi Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"The OSGi specification defines a modularization and component model for Java applications. Jetty leverages OSGi support providing an infrastructure that\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2015-07-22T12:00:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-04-10T10:12:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/codehaus-jetty-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ibrahim Tasyurt\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@itasyurt\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ibrahim Tasyurt\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/\"},\"author\":{\"name\":\"Ibrahim Tasyurt\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/b2b2c4a3762c4d2e0072b831fb6900f5\"},\"headline\":\"Jetty OSGi Example\",\"datePublished\":\"2015-07-22T12:00:49+00:00\",\"dateModified\":\"2019-04-10T10:12:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/\"},\"wordCount\":1144,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/codehaus-jetty-logo.jpg\",\"keywords\":[\"Eclipse\",\"OSGi\"],\"articleSection\":[\"jetty\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/\",\"name\":\"Jetty OSGi Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/codehaus-jetty-logo.jpg\",\"datePublished\":\"2015-07-22T12:00:49+00:00\",\"dateModified\":\"2019-04-10T10:12:49+00:00\",\"description\":\"The OSGi specification defines a modularization and component model for Java applications. Jetty leverages OSGi support providing an infrastructure that\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/codehaus-jetty-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/codehaus-jetty-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"jetty\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/jetty\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Jetty OSGi Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/b2b2c4a3762c4d2e0072b831fb6900f5\",\"name\":\"Ibrahim Tasyurt\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/Ibrahim-Tasyurt-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/Ibrahim-Tasyurt-96x96.jpg\",\"caption\":\"Ibrahim Tasyurt\"},\"description\":\"Ibrahim is a Senior Software Engineer residing in Ankara,Turkey. He holds BSc and MS degrees in Computer Engineering from Middle East Technical University(METU). Throughout his professional carrier, he has worked in Enterprise Web Application projects for public sector and telecommunications domains. Java EE, Web Services and Enterprise Application Integration are the areas he is primarily involved with.\",\"sameAs\":[\"http:\/\/www.javacodegeeks.com\/\",\"https:\/\/x.com\/itasyurt\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/ibrahim-tasyurt\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Jetty OSGi Example - Java Code Geeks","description":"The OSGi specification defines a modularization and component model for Java applications. Jetty leverages OSGi support providing an infrastructure that","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/","og_locale":"en_US","og_type":"article","og_title":"Jetty OSGi Example - Java Code Geeks","og_description":"The OSGi specification defines a modularization and component model for Java applications. Jetty leverages OSGi support providing an infrastructure that","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2015-07-22T12:00:49+00:00","article_modified_time":"2019-04-10T10:12:49+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/codehaus-jetty-logo.jpg","type":"image\/jpeg"}],"author":"Ibrahim Tasyurt","twitter_card":"summary_large_image","twitter_creator":"@itasyurt","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Ibrahim Tasyurt","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/"},"author":{"name":"Ibrahim Tasyurt","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/b2b2c4a3762c4d2e0072b831fb6900f5"},"headline":"Jetty OSGi Example","datePublished":"2015-07-22T12:00:49+00:00","dateModified":"2019-04-10T10:12:49+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/"},"wordCount":1144,"commentCount":1,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/codehaus-jetty-logo.jpg","keywords":["Eclipse","OSGi"],"articleSection":["jetty"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/","name":"Jetty OSGi Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/codehaus-jetty-logo.jpg","datePublished":"2015-07-22T12:00:49+00:00","dateModified":"2019-04-10T10:12:49+00:00","description":"The OSGi specification defines a modularization and component model for Java applications. Jetty leverages OSGi support providing an infrastructure that","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/codehaus-jetty-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/codehaus-jetty-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-osgi-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/"},{"@type":"ListItem","position":4,"name":"jetty","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/jetty\/"},{"@type":"ListItem","position":5,"name":"Jetty OSGi Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/b2b2c4a3762c4d2e0072b831fb6900f5","name":"Ibrahim Tasyurt","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/Ibrahim-Tasyurt-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/Ibrahim-Tasyurt-96x96.jpg","caption":"Ibrahim Tasyurt"},"description":"Ibrahim is a Senior Software Engineer residing in Ankara,Turkey. He holds BSc and MS degrees in Computer Engineering from Middle East Technical University(METU). Throughout his professional carrier, he has worked in Enterprise Web Application projects for public sector and telecommunications domains. Java EE, Web Services and Enterprise Application Integration are the areas he is primarily involved with.","sameAs":["http:\/\/www.javacodegeeks.com\/","https:\/\/x.com\/itasyurt"],"url":"https:\/\/examples.javacodegeeks.com\/author\/ibrahim-tasyurt\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/25331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/54"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=25331"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/25331\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1239"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=25331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=25331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=25331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}