{"id":23996,"date":"2015-06-10T11:00:34","date_gmt":"2015-06-10T08:00:34","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=23996"},"modified":"2019-04-10T13:15:32","modified_gmt":"2019-04-10T10:15:32","slug":"jetty-tutorial-beginners","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/","title":{"rendered":"Jetty Tutorial for Beginners"},"content":{"rendered":"<p>In this article, we will give brief information about&nbsp;Jetty and provide examples of&nbsp;&nbsp; Java application deployment on Jetty. Our examples will consist of both standalone and Embedded modes of Jetty.<\/p>\n<p>Jetty is a Servlet container and &nbsp;Web Server which is known to be &nbsp;portable, lightweight, robust, flexible, extensible and easy to integrate.<\/p>\n<p>Jetty can be deployed as a standalone server and also can be embedded in an existing application. In addition to these, a &nbsp;Maven Jetty &nbsp;plugin is available in order to run applications in your development environment.<\/p>\n<p>SPDY, WebSocket, OSGi, JMX, JNDI, JAAS are some of the technologies that Jetty integrates nicely.<\/p>\n<p>Today, Jetty is widely used in many platforms both for development and production. Small to large enterprise applications. SaaS (such as Zimbra), Cloud Applications( such as Google AppEngine), Applications Servers(such as Apache Geronimo) and tools (such as SoapUI) are powered by Jetty.<\/p>\n<p>Jetty is open source, hosted by Eclipse Foundation. &nbsp;Current version (as of June 2015) is 9.2.x. &nbsp;You can more detailed information on <a href=\"http:\/\/www.eclipse.org\/jetty\/\">Jetty Home Page<\/a>.\n<\/p>\n<h2>1.Jetty as a Standalone server<\/h2>\n<p>In the first part, we will configure Jetty as a Standalone Server.<\/p>\n<h3>1.1 Downloading &nbsp;and Installing Jetty<\/h3>\n<p>You can visit the <a href=\"http:\/\/download.eclipse.org\/jetty\/\" target=\"_blank\" rel=\"noopener noreferrer\">downloads<\/a> page and download the latest version (v9.2.11 currently) as an archive file in zip or tar.gz format. Size&nbsp;is about 13 MBs.<\/p>\n<p>There is no installation procedure for Jetty. Just drop it to a folder as you wish and uncompress the downloaded archive file.<\/p>\n<h3>1.2 Prerequisites<\/h3>\n<p>The only prerequisite for Jetty 9 is having installed Java 7 in your environment. You can downgrade&nbsp;to Jetty 8 if you have Java 6. &nbsp;A complete Jetty-Java compatibility information can be viewed <a href=\"https:\/\/wiki.eclipse.org\/Jetty\/Starting\/Jetty_Version_Comparison_Table\">here<\/a>.<\/p>\n<h3>1.3 Running Jetty<\/h3>\n<p>Running Jetty on the default configuration is as simple as following two steps:<\/p>\n<ol>\n<li>Navigate to the directory where you unpacked the downloaded archive. I will call it <b><i>JETTY_HOME <\/i><\/b>from now on.<\/li>\n<li>Run the following command:\n<pre>java -jar start.jar<\/pre>\n<\/li>\n<\/ol>\n<p>When Jetty starts running successfully; it produces the a line in the log similar to the following:<\/p>\n<pre class=\"brush:bash\">2015-06-04 14:27:27.555:INFO:oejs.Server:main: Started @11245ms\n<\/pre>\n<p>By default, Jetty runs on port 8080, but we will see how to configure&nbsp;it in the next sections of this tutorial.<\/p>\n<p>You can also check via the browser typing <a href=\"http:\/\/localhost:8080\">http:\/\/localhost:8080<\/a> as the URL. You will see a 404 error, since no application is deployed in the root context.<\/p>\n<p>The response is as below:<\/p>\n<p><figure id=\"attachment_24157\" aria-describedby=\"caption-attachment-24157\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/jettyTutorial-1.jpg\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/jettyTutorial-1.jpg\" alt=\"Server response when Jetty runs successfully\" width=\"800\" height=\"388\" class=\"size-full wp-image-24157\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/jettyTutorial-1.jpg 800w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/jettyTutorial-1-300x146.jpg 300w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><figcaption id=\"caption-attachment-24157\" class=\"wp-caption-text\">Server response when Jetty runs successfully<\/figcaption><\/figure><\/p>\n<h3>1.4 Changing the server port<\/h3>\n<p>As mentioned above, default port jetty is 8080. If you need to change it, you can apply following steps:<\/p>\n<ol>\n<li>Navigate to the <b><i>JETTY_HOME<\/i><\/b>.<\/li>\n<li>Open the <em>start.ini<\/em> file with a text editor.<\/li>\n<li>Navigate to the line where the parameter<em> jetty.port<\/em> is configured.<\/li>\n<li>Change the parameter to the desired port number.<\/li>\n<li>Start Jetty again.<\/li>\n<\/ol>\n<p>In the following segment, &nbsp;we set the Jetty port to 7070 instead of 8080<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre>## HTTP port to listen on\njetty.port=7070\n<\/pre>\n<p>After we restart&nbsp;&nbsp;our server&nbsp;will run on port <em>7070<\/em>.<\/p>\n<h3>1.5 Deploying Web Applications on Jetty<\/h3>\n<p>The procedure to deploy web applications on Jetty is &nbsp;as follows:<\/p>\n<ol>\n<li>Navigate to your <i>JETTY_HOME<\/i> folder.<\/li>\n<li>There is a directory named as <b><i>webapps <\/i><\/b>under<em><strong> JETTY_HOME. &nbsp;<\/strong><\/em>Navigate there<em><strong>.<\/strong><\/em><\/li>\n<li>Drop your&nbsp;WAR file in that folder.<\/li>\n<\/ol>\n<p>The application is initialized immediately, you do not need to restart Jetty since the <em><strong>webapps<\/strong><\/em> directory is continuously monitored by the server.<\/p>\n<p>There are a sample web applications under <i><strong>JETTY_HOME\/demo-base\/webapps\/<\/strong>. <\/i>You can pick one of them<i>(for<\/i> example<strong> async-rest.war<\/strong>) and copy to the webapps directory. As you copy the WAR file, the application will be initialized.<\/p>\n<p>When you type <a href=\"http:\/\/localhost:7070\/async-rest\">http:\/\/localhost:7070\/async-rest<\/a> , you can see the application initialized.<\/p>\n<p><figure id=\"attachment_24158\" aria-describedby=\"caption-attachment-24158\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/jettyTutorial-2.jpg\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/jettyTutorial-2.jpg\" alt=\"The application async-rest deployed on Jetty\" width=\"800\" height=\"439\" class=\"size-full wp-image-24158\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/jettyTutorial-2.jpg 800w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/jettyTutorial-2-300x165.jpg 300w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><figcaption id=\"caption-attachment-24158\" class=\"wp-caption-text\">The application async-rest deployed on Jetty<\/figcaption><\/figure><\/p>\n<h3>1.6 Changing Webapps Directory<\/h3>\n<p><i><strong>JETTY_HOME\/webapps<\/strong> <\/i>is the default directory to deploy your applications. But there are cases that you need to change the deployment directory. In order to do that, you should proceed as follows:<\/p>\n<ol>\n<li>Open the <em>start.ini<\/em> file under<em><strong> JETTY_HOME<\/strong><\/em>.<\/li>\n<li>Remove the comment before the parameter <i>jetty.deploy.monitoredDirName.<\/i><\/li>\n<li>Change this parameter as you wish. Remember that the path should be relative to <em><strong>JETTY_HOME<\/strong><\/em> directory.<\/li>\n<\/ol>\n<pre>jetty.deploy.monitoredDirName=..\/jcgwebapps<\/pre>\n<p>Now we can put our WARS in the <i>jcgwebapps<\/i> directory, which is at the same level as our <em><strong>JETTY_HOME.<\/strong><\/em><\/p>\n<h2>2. Embedding Jetty in Your Application<\/h2>\n<p>Until now, we have skimmed through Jetty as a standalone server. However Jetty provides another great feature. Motto of Jetty is : <em>\u201cDon&#8217;t deploy your application in Jetty, deploy Jetty in your application\u201d<\/em>. It means that, you can embed jetty in your existing (most probably non-web) applications easily. On this purpose a very convenient API is provided to the developers. In the following sections, we will see how we can accomplish this.<\/p>\n<h3>2.1 Environment<\/h3>\n<p>In this example, following programming environment is used:<\/p>\n<ul>\n<li>Java 8 (Java 7 will&nbsp;also do fine.)<\/li>\n<li>Apache Maven 3.x.y<\/li>\n<li>Eclipse 4.4 (Luna)<\/li>\n<\/ul>\n<h3>2.2 Creating the Maven Project<\/h3>\n<ol>\n<li>Go to File -&gt; New -&gt;Other -&gt; Maven Project<\/li>\n<li>Tick Create a simple project and press \u201cNext\u201d.<\/li>\n<li>Enter groupId as : <em>com.javacodegeeks.snippets.enterprise<\/em><\/li>\n<li>Enter artifactId as : <em>embedded-jetty-example<\/em><\/li>\n<li>Press \u201cFinish\u201d.<\/li>\n<\/ol>\n<p>Now our maven project is created.<\/p>\n<p><figure id=\"attachment_24159\" aria-describedby=\"caption-attachment-24159\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/jettyTutorial-3.jpg\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/jettyTutorial-3.jpg\" alt=\"Creating simple Maven project in Eclipse\" width=\"800\" height=\"698\" class=\"size-full wp-image-24159\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/jettyTutorial-3.jpg 800w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/jettyTutorial-3-300x262.jpg 300w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><figcaption id=\"caption-attachment-24159\" class=\"wp-caption-text\">Creating simple Maven project in Eclipse<\/figcaption><\/figure><\/p>\n<h3>2.3 Adding dependencies for Embedded Jetty<\/h3>\n<p>Following Maven dependencies have to be added in the project:[ulp id=&#8217;xFHGZUmgemwCMrAR&#8217;]<\/p>\n<ul>\n<li>jetty-server : Core Jetty Utilities<\/li>\n<li>jetty-servlet: Jetty Servlet Utilities<\/li>\n<\/ul>\n<p>You have to&nbsp;&nbsp;add these dependencies to your pom.xml. After the dependencies are added, &nbsp;your<em> pom.xml<\/em> seems as follows:<\/p>\n<pre class=\"brush:xml\">&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n\txsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\n\t&lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\n\t&lt;groupId&gt;com.javacodegeeks.snippets.enterprise&lt;\/groupId&gt;\n\t&lt;artifactId&gt;embedded-jetty-example&lt;\/artifactId&gt;\n\t&lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\n\t\n\t&lt;dependencies&gt;\n\n\t\t&lt;!--Jetty  dependencies start here--&gt;\n\t\t&lt;dependency&gt;\n\t\t\t&lt;groupId&gt;org.eclipse.jetty&lt;\/groupId&gt;\n\t\t\t&lt;artifactId&gt;jetty-server&lt;\/artifactId&gt;\n\t\t\t&lt;version&gt;9.2.11.v20150529&lt;\/version&gt;\n\t\t&lt;\/dependency&gt;\n\n\t\t&lt;dependency&gt;\n\t\t\t&lt;groupId&gt;org.eclipse.jetty&lt;\/groupId&gt;\n\t\t\t&lt;artifactId&gt;jetty-servlet&lt;\/artifactId&gt;\n\t\t\t&lt;version&gt;9.2.11.v20150529&lt;\/version&gt;\n\t\t&lt;\/dependency&gt;\n\t\t&lt;!--Jetty  dependencies end here--&gt;\n\n\t&lt;\/dependencies&gt;\n&lt;\/project&gt;\n<\/pre>\n<p>Now our project configuration is complete and we are ready to go.<\/p>\n<h3>2.4 Creating Embedded Jetty Server Programmatically<\/h3>\n<p>Now we are going to create an Embedded Jetty Server programmatically. In order to keep things simple, we will create the Server in the main() method of our application.<\/p>\n<p>In order to this, you can proceed as follows:<\/p>\n<ol>\n<li>Create package <em>com.javacodegeeks.snippets.enterprise.embeddedjetty.<\/em><\/li>\n<li>Create a class named <em>EmbeddedJettyMain<\/em>.<\/li>\n<li>Add a main method to this class.<\/li>\n<\/ol>\n<p>The code that creates and starts and Embedded Jetty is as follows:<\/p>\n<p><span style=\"text-decoration: underline\"><em>EmbeddedJettyMain.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.snippets.enterprise.embeddedjetty;\n\nimport org.eclipse.jetty.server.Server;\nimport org.eclipse.jetty.servlet.ServletContextHandler;\n\nimport com.javacodegeeks.snippets.enterprise.embeddedjetty.servlet.ExampleServlet;\n\npublic class EmbeddedJettyMain {\n\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tServer server = new Server(7070);\n\t\tServletContextHandler handler = new ServletContextHandler(server, \"\/example\");\n\t\thandler.addServlet(ExampleServlet.class, \"\/\");\n\t\tserver.start();\n\n\t}\n\n}\n\n<\/pre>\n<ol>\n<li>In the first line(Line 12), we create a Server on port <strong><em>7070<\/em><\/strong>.<\/li>\n<li>In the next line(Line 13), we create a ServletContextHandler with the context path<em><strong> \/example<\/strong><\/em><\/li>\n<li>In Line 14, we bind the servlet class <em>ExampleServlet<\/em> (which is described below) to this servlet context handler created in the previous line.<\/li>\n<li>On the last line, we start the server.<\/li>\n<\/ol>\n<pre class=\"brush:java\"><em>ServletContextHandler<\/em> is a powerful facility enabling creation and configuration of Servlets and Servlet Filters programatically.<\/pre>\n<p><em>ExampleServlet<\/em> is a simple HttpServlet, does nothing but returning a constant output <em>\u201cEmbeddedJetty\u201d<\/em> as the response.<\/p>\n<p><span style=\"text-decoration: underline\"><em>ExampleServlet.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.snippets.enterprise.embeddedjetty.servlet;\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\nimport org.eclipse.jetty.http.HttpStatus;\n\npublic class ExampleServlet extends HttpServlet {\n\n\t@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp)\n\t\t\tthrows ServletException, IOException {\n\n\t\tresp.setStatus(HttpStatus.OK_200);\n\t\tresp.getWriter().println(\"EmbeddedJetty\");\n\t}\n}\n\n\n<\/pre>\n<h3>2.5 Running Embedded Jetty<\/h3>\n<p>Run the <em>EmbeddedJettyMain<\/em> class through the Eclipse Run, Embedded Jetty starts to run on the defined port(7070).<\/p>\n<p>You can access the application through your browser on the following URL:<br \/>\n<a href=\"http:\/\/localhost:7070\/example\">http:\/\/localhost:7070\/example<\/a><\/p>\n<p>Here you can see the response below:<\/p>\n<p><figure id=\"attachment_24155\" aria-describedby=\"caption-attachment-24155\" style=\"width: 655px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/jettyTutorial4.jpg\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/jettyTutorial4.jpg\" alt=\"ExampleServlet response\" width=\"655\" height=\"393\" class=\"size-full wp-image-24155\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/jettyTutorial4.jpg 655w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/jettyTutorial4-300x180.jpg 300w\" sizes=\"(max-width: 655px) 100vw, 655px\" \/><\/a><figcaption id=\"caption-attachment-24155\" class=\"wp-caption-text\">ExampleServlet response<\/figcaption><\/figure><\/p>\n<h2>3. Conclusion<\/h2>\n<p>In this article, we have provided brief information on Jetty and discussed&nbsp;the steps to create standalone and Embedded Jetty servers.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the source code for Embedded Jetty example here:<br \/>\n<a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/06\/embedded-jetty-example.zip\"><strong>EmbeddedJettyExample<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will give brief information about&nbsp;Jetty and provide examples of&nbsp;&nbsp; Java application deployment on Jetty. Our examples will consist of both standalone and Embedded modes of Jetty. Jetty is a Servlet container and &nbsp;Web Server which is known to be &nbsp;portable, lightweight, robust, flexible, extensible and easy to integrate. Jetty can be &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":[762,1052],"class_list":["post-23996","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jetty","tag-httpserver","tag-servlet"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Jetty Tutorial for Beginners - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this article, we will give brief information about&nbsp;Jetty and provide examples of&nbsp;&nbsp; Java application deployment on Jetty. Our examples\" \/>\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-tutorial-beginners\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Jetty Tutorial for Beginners - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this article, we will give brief information about&nbsp;Jetty and provide examples of&nbsp;&nbsp; Java application deployment on Jetty. Our examples\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/\" \/>\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-06-10T08:00:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-04-10T10:15:32+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-tutorial-beginners\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/\"},\"author\":{\"name\":\"Ibrahim Tasyurt\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/b2b2c4a3762c4d2e0072b831fb6900f5\"},\"headline\":\"Jetty Tutorial for Beginners\",\"datePublished\":\"2015-06-10T08:00:34+00:00\",\"dateModified\":\"2019-04-10T10:15:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/\"},\"wordCount\":1167,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/codehaus-jetty-logo.jpg\",\"keywords\":[\"HttpServer\",\"servlet\"],\"articleSection\":[\"jetty\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/\",\"name\":\"Jetty Tutorial for Beginners - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/codehaus-jetty-logo.jpg\",\"datePublished\":\"2015-06-10T08:00:34+00:00\",\"dateModified\":\"2019-04-10T10:15:32+00:00\",\"description\":\"In this article, we will give brief information about&nbsp;Jetty and provide examples of&nbsp;&nbsp; Java application deployment on Jetty. Our examples\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/#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-tutorial-beginners\/#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 Tutorial for Beginners\"}]},{\"@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 Tutorial for Beginners - Java Code Geeks","description":"In this article, we will give brief information about&nbsp;Jetty and provide examples of&nbsp;&nbsp; Java application deployment on Jetty. Our examples","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-tutorial-beginners\/","og_locale":"en_US","og_type":"article","og_title":"Jetty Tutorial for Beginners - Java Code Geeks","og_description":"In this article, we will give brief information about&nbsp;Jetty and provide examples of&nbsp;&nbsp; Java application deployment on Jetty. Our examples","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2015-06-10T08:00:34+00:00","article_modified_time":"2019-04-10T10:15:32+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-tutorial-beginners\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/"},"author":{"name":"Ibrahim Tasyurt","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/b2b2c4a3762c4d2e0072b831fb6900f5"},"headline":"Jetty Tutorial for Beginners","datePublished":"2015-06-10T08:00:34+00:00","dateModified":"2019-04-10T10:15:32+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/"},"wordCount":1167,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/codehaus-jetty-logo.jpg","keywords":["HttpServer","servlet"],"articleSection":["jetty"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/","name":"Jetty Tutorial for Beginners - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/codehaus-jetty-logo.jpg","datePublished":"2015-06-10T08:00:34+00:00","dateModified":"2019-04-10T10:15:32+00:00","description":"In this article, we will give brief information about&nbsp;Jetty and provide examples of&nbsp;&nbsp; Java application deployment on Jetty. Our examples","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jetty\/jetty-tutorial-beginners\/#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-tutorial-beginners\/#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 Tutorial for Beginners"}]},{"@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\/23996","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=23996"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/23996\/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=23996"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=23996"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=23996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}