{"id":136,"date":"2022-07-23T06:25:57","date_gmt":"2022-07-23T06:25:57","guid":{"rendered":"https:\/\/valerio.nu\/?p=136"},"modified":"2022-07-23T06:25:58","modified_gmt":"2022-07-23T06:25:58","slug":"java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver","status":"publish","type":"post","link":"https:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/","title":{"rendered":"Java 18&#8217;s embedded HTTP server, here&#8217;s how to use the new SimpleFileServer"},"content":{"rendered":"\n<p>In this tutorial we cover a brand new Java 18 feature, an HTTP server embedded in the JDK. This tutorial is about understanding and implementing web user profiles using Java 18&#8217;s SimpleFileServer class.<\/p>\n\n\n\n<p><strong>What is SimpleFileServer?<\/strong><\/p>\n\n\n\n<p>According to <a href=\"https:\/\/download.java.net\/java\/early_access\/loom\/docs\/api\/jdk.httpserver\/com\/sun\/net\/httpserver\/SimpleFileServer.html\" target=\"_blank\" rel=\"noreferrer noopener\">the official documentation<\/a>, this HTTP file server and its components are intended for testing, development, and debugging purposes only. This isn&#8217;t a full fledged production-ready server, but rather a tool intended to smooth out the experience of new (and old) Java developers that need to quickly have a web server up-and-running for development purposes. It is comprised of three main components;&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>an HttpServer that can be called at the base or given address,<\/li><li>an HttpHandler that serves files from a given directory path that the developer specified, and<\/li><li>an optional Filter that prints log messages related to the exchanges handled by the server.<\/li><\/ul>\n\n\n\n<p>Here is a few practical concepts on how to use SimpleFileServer to show static web pages, in this case user profiles.<\/p>\n\n\n\n<p><strong>Requirements to Use SimpleFileServer<\/strong><\/p>\n\n\n\n<p>The following is required to use the SimpleFileServer:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Java Development Kit (JDK 18) or above;<\/li><li>Basic Java Knowledge<\/li><\/ol>\n\n\n\n<p>JDK 18 can be downloaded from the <a href=\"https:\/\/www.oracle.com\/java\/technologies\/javase\/jdk18-archive-downloads.html\">JDK Download Page<\/a>. After downloading the JDK, perform the installation by following the wizard guide.<\/p>\n\n\n\n<p><strong>Creating our Application<\/strong><\/p>\n\n\n\n<p>This tutorial was done with IntelliJ IDEA Ultimate. But the general process is the same with any Java development platform.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Open your IDE and create a Java project with a class named SimpleBrowser inside the <strong>src <\/strong>directory, include the main method as shown below:<\/li><\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>public class SimpleBrowser {\n    public static void main(String&#91;] args) {\n    }\n}<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\"><li>Create another directory inside the project folder with the name Pages. The project directory should have the following structure:<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/qav3vqjgPIAH0A9klnPQ3fCpApxEK-00wUUqOevD6uYdwSndQjtNcgPgYpVWpUmWAji1hzF-MW0einc36tYFDw_0bGkp2XlxB_8koTa5J67m6TDRvmGOyPdvEaFyHSX7D0Fdhoe-RpYEz5pfmKNnW3Q\" alt=\"\"\/><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\"><li>Add static content to the Pages folder. To effectively use the Pages folder, simply add static contents such as profile.html, style.css, style.js, and carbrands.js as shown in the image below:<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/Zy70mKL3GAY144Q-dAGM6640HtFsAYd079GDcVuxpFECs7-0o_vDWZdmBghIwolpXxgzFiaout4aw-_JxcaHX1U9sTn5QE3d05xsozytAlKXwYc1RTE7glWsUXHWrebgf0xkfLLjlsTHaRCFMUkfHcY\" alt=\"\"\/><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"4\"><li>Use SimpleFileServer.createFileServer method. The createFileServer static method returns an HttpServer. The response comes from a specified file server path as shown in the code snippet below:<\/li><\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>import com.sun.net.httpserver.SimpleFileServer;\nimport java.io.File;\nimport java.net.InetSocketAddress;\nimport java.nio.file.Path;\n\npublic class SimpleBrowser {\n    public static void main(String&#91;] args) {\n        \/\/ parameters\n        Integer port = 8080;\n        File myFile = new File(\"Pages\");\n        String path = myFile.getAbsolutePath();\n        System.out.println(path);\n        SimpleFileServer.OutputLevel outputLevel = SimpleFileServer.OutputLevel.VERBOSE;\n\n        \/\/ create the server\n        var server = SimpleFileServer.createFileServer(\n                new InetSocketAddress(port),\n                Path.of(path),\n                outputLevel));\n\n        \/\/ start the server\n        server.start();\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>In this code, we explicitly assign a port number and  the directory of the static files to be served. Line 16 is where the createFileServer method is called to setup the HttpServer. Line 22 is used to start the server.<\/p>\n\n\n\n<p>After starting the server, the files are served at the specified port on localhost which can be accessed from a web browser. An example is shown below:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/W1rBHkqquuEY02Y-ST6ng-CXOwmGKDOlOakM5tW-2qOt4yEr5Q7hN6S6W3bFFDekwJt-sSWRWqepJcHciAfC-jOs_UdBgAzhb9a1dWNCtiVdCd_hh84bcFptSicfghp57vlwK7CyTv1budJ3VPM2ZI8\" alt=\"\"\/><\/figure>\n\n\n\n<p>The code used in this tutorial <a href=\"https:\/\/github.com\/valerio-nu\/tutorial_simple_file_server\" target=\"_blank\" rel=\"noreferrer noopener\">is available here<\/a>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial we cover a brand new Java 18 feature, an HTTP server embedded in the JDK. This tutorial is about understanding and implementing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-136","post","type-post","status-publish","format-standard","hentry","category-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java 18&#039;s embedded HTTP server, here&#039;s how to use the new SimpleFileServer - Andy&#039;s blog \u2935\ufe0f<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java 18&#039;s embedded HTTP server, here&#039;s how to use the new SimpleFileServer - Andy&#039;s blog \u2935\ufe0f\" \/>\n<meta property=\"og:description\" content=\"In this tutorial we cover a brand new Java 18 feature, an HTTP server embedded in the JDK. This tutorial is about understanding and implementing [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/\" \/>\n<meta property=\"og:site_name\" content=\"Andy&#039;s blog \u2935\ufe0f\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-23T06:25:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-23T06:25:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/lh3.googleusercontent.com\/qav3vqjgPIAH0A9klnPQ3fCpApxEK-00wUUqOevD6uYdwSndQjtNcgPgYpVWpUmWAji1hzF-MW0einc36tYFDw_0bGkp2XlxB_8koTa5J67m6TDRvmGOyPdvEaFyHSX7D0Fdhoe-RpYEz5pfmKNnW3Q\" \/>\n<meta name=\"author\" content=\"andy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"andy\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2022\\\/07\\\/23\\\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2022\\\/07\\\/23\\\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\\\/\"},\"author\":{\"name\":\"andy\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/#\\\/schema\\\/person\\\/da69cc3da309893b0d3bc8fcef75f128\"},\"headline\":\"Java 18&#8217;s embedded HTTP server, here&#8217;s how to use the new SimpleFileServer\",\"datePublished\":\"2022-07-23T06:25:57+00:00\",\"dateModified\":\"2022-07-23T06:25:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2022\\\/07\\\/23\\\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\\\/\"},\"wordCount\":417,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2022\\\/07\\\/23\\\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/lh3.googleusercontent.com\\\/qav3vqjgPIAH0A9klnPQ3fCpApxEK-00wUUqOevD6uYdwSndQjtNcgPgYpVWpUmWAji1hzF-MW0einc36tYFDw_0bGkp2XlxB_8koTa5J67m6TDRvmGOyPdvEaFyHSX7D0Fdhoe-RpYEz5pfmKNnW3Q\",\"articleSection\":[\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2022\\\/07\\\/23\\\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2022\\\/07\\\/23\\\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\\\/\",\"url\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2022\\\/07\\\/23\\\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\\\/\",\"name\":\"Java 18's embedded HTTP server, here's how to use the new SimpleFileServer - Andy&#039;s blog \u2935\ufe0f\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2022\\\/07\\\/23\\\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2022\\\/07\\\/23\\\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/lh3.googleusercontent.com\\\/qav3vqjgPIAH0A9klnPQ3fCpApxEK-00wUUqOevD6uYdwSndQjtNcgPgYpVWpUmWAji1hzF-MW0einc36tYFDw_0bGkp2XlxB_8koTa5J67m6TDRvmGOyPdvEaFyHSX7D0Fdhoe-RpYEz5pfmKNnW3Q\",\"datePublished\":\"2022-07-23T06:25:57+00:00\",\"dateModified\":\"2022-07-23T06:25:58+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/#\\\/schema\\\/person\\\/da69cc3da309893b0d3bc8fcef75f128\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2022\\\/07\\\/23\\\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2022\\\/07\\\/23\\\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2022\\\/07\\\/23\\\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\\\/#primaryimage\",\"url\":\"https:\\\/\\\/lh3.googleusercontent.com\\\/qav3vqjgPIAH0A9klnPQ3fCpApxEK-00wUUqOevD6uYdwSndQjtNcgPgYpVWpUmWAji1hzF-MW0einc36tYFDw_0bGkp2XlxB_8koTa5J67m6TDRvmGOyPdvEaFyHSX7D0Fdhoe-RpYEz5pfmKNnW3Q\",\"contentUrl\":\"https:\\\/\\\/lh3.googleusercontent.com\\\/qav3vqjgPIAH0A9klnPQ3fCpApxEK-00wUUqOevD6uYdwSndQjtNcgPgYpVWpUmWAji1hzF-MW0einc36tYFDw_0bGkp2XlxB_8koTa5J67m6TDRvmGOyPdvEaFyHSX7D0Fdhoe-RpYEz5pfmKNnW3Q\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/2022\\\/07\\\/23\\\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/valerio.nu\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java 18&#8217;s embedded HTTP server, here&#8217;s how to use the new SimpleFileServer\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/#website\",\"url\":\"https:\\\/\\\/valerio.nu\\\/\",\"name\":\"Andy&#039;s blog \u2935\ufe0f\",\"description\":\"Abandon all hope, ye who enter here\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/valerio.nu\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/valerio.nu\\\/#\\\/schema\\\/person\\\/da69cc3da309893b0d3bc8fcef75f128\",\"name\":\"andy\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g\",\"caption\":\"andy\"},\"sameAs\":[\"https:\\\/\\\/valerio.nu\"],\"url\":\"https:\\\/\\\/valerio.nu\\\/index.php\\\/author\\\/giuseppe\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java 18's embedded HTTP server, here's how to use the new SimpleFileServer - Andy&#039;s blog \u2935\ufe0f","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:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/","og_locale":"en_US","og_type":"article","og_title":"Java 18's embedded HTTP server, here's how to use the new SimpleFileServer - Andy&#039;s blog \u2935\ufe0f","og_description":"In this tutorial we cover a brand new Java 18 feature, an HTTP server embedded in the JDK. This tutorial is about understanding and implementing [&hellip;]","og_url":"https:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/","og_site_name":"Andy&#039;s blog \u2935\ufe0f","article_published_time":"2022-07-23T06:25:57+00:00","article_modified_time":"2022-07-23T06:25:58+00:00","og_image":[{"url":"https:\/\/lh3.googleusercontent.com\/qav3vqjgPIAH0A9klnPQ3fCpApxEK-00wUUqOevD6uYdwSndQjtNcgPgYpVWpUmWAji1hzF-MW0einc36tYFDw_0bGkp2XlxB_8koTa5J67m6TDRvmGOyPdvEaFyHSX7D0Fdhoe-RpYEz5pfmKNnW3Q","type":"","width":"","height":""}],"author":"andy","twitter_card":"summary_large_image","twitter_misc":{"Written by":"andy","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/#article","isPartOf":{"@id":"https:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/"},"author":{"name":"andy","@id":"https:\/\/valerio.nu\/#\/schema\/person\/da69cc3da309893b0d3bc8fcef75f128"},"headline":"Java 18&#8217;s embedded HTTP server, here&#8217;s how to use the new SimpleFileServer","datePublished":"2022-07-23T06:25:57+00:00","dateModified":"2022-07-23T06:25:58+00:00","mainEntityOfPage":{"@id":"https:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/"},"wordCount":417,"commentCount":0,"image":{"@id":"https:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/#primaryimage"},"thumbnailUrl":"https:\/\/lh3.googleusercontent.com\/qav3vqjgPIAH0A9klnPQ3fCpApxEK-00wUUqOevD6uYdwSndQjtNcgPgYpVWpUmWAji1hzF-MW0einc36tYFDw_0bGkp2XlxB_8koTa5J67m6TDRvmGOyPdvEaFyHSX7D0Fdhoe-RpYEz5pfmKNnW3Q","articleSection":["Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/","url":"https:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/","name":"Java 18's embedded HTTP server, here's how to use the new SimpleFileServer - Andy&#039;s blog \u2935\ufe0f","isPartOf":{"@id":"https:\/\/valerio.nu\/#website"},"primaryImageOfPage":{"@id":"https:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/#primaryimage"},"image":{"@id":"https:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/#primaryimage"},"thumbnailUrl":"https:\/\/lh3.googleusercontent.com\/qav3vqjgPIAH0A9klnPQ3fCpApxEK-00wUUqOevD6uYdwSndQjtNcgPgYpVWpUmWAji1hzF-MW0einc36tYFDw_0bGkp2XlxB_8koTa5J67m6TDRvmGOyPdvEaFyHSX7D0Fdhoe-RpYEz5pfmKNnW3Q","datePublished":"2022-07-23T06:25:57+00:00","dateModified":"2022-07-23T06:25:58+00:00","author":{"@id":"https:\/\/valerio.nu\/#\/schema\/person\/da69cc3da309893b0d3bc8fcef75f128"},"breadcrumb":{"@id":"https:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/#primaryimage","url":"https:\/\/lh3.googleusercontent.com\/qav3vqjgPIAH0A9klnPQ3fCpApxEK-00wUUqOevD6uYdwSndQjtNcgPgYpVWpUmWAji1hzF-MW0einc36tYFDw_0bGkp2XlxB_8koTa5J67m6TDRvmGOyPdvEaFyHSX7D0Fdhoe-RpYEz5pfmKNnW3Q","contentUrl":"https:\/\/lh3.googleusercontent.com\/qav3vqjgPIAH0A9klnPQ3fCpApxEK-00wUUqOevD6uYdwSndQjtNcgPgYpVWpUmWAji1hzF-MW0einc36tYFDw_0bGkp2XlxB_8koTa5J67m6TDRvmGOyPdvEaFyHSX7D0Fdhoe-RpYEz5pfmKNnW3Q"},{"@type":"BreadcrumbList","@id":"https:\/\/valerio.nu\/index.php\/2022\/07\/23\/java-18s-embedded-http-server-heres-how-to-use-the-new-simplefileserver\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/valerio.nu\/"},{"@type":"ListItem","position":2,"name":"Java 18&#8217;s embedded HTTP server, here&#8217;s how to use the new SimpleFileServer"}]},{"@type":"WebSite","@id":"https:\/\/valerio.nu\/#website","url":"https:\/\/valerio.nu\/","name":"Andy&#039;s blog \u2935\ufe0f","description":"Abandon all hope, ye who enter here","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/valerio.nu\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/valerio.nu\/#\/schema\/person\/da69cc3da309893b0d3bc8fcef75f128","name":"andy","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4852a025c6250c852814d4017f646677730a23c1ec14eb5ca36b69dcce5135a5?s=96&d=mm&r=g","caption":"andy"},"sameAs":["https:\/\/valerio.nu"],"url":"https:\/\/valerio.nu\/index.php\/author\/giuseppe\/"}]}},"_links":{"self":[{"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/posts\/136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/comments?post=136"}],"version-history":[{"count":10,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/posts\/136\/revisions"}],"predecessor-version":[{"id":154,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/posts\/136\/revisions\/154"}],"wp:attachment":[{"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/media?parent=136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/categories?post=136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/valerio.nu\/index.php\/wp-json\/wp\/v2\/tags?post=136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}