I am using Jetty embedded in my application as follows:
ResourceConfig rc = new PackagesResourceConfig("my.jersey.resources.package");
ServletHolder servletHolder = new ServletHolder(new ServletContainer(rc));
ServletContextHandler servletContextHandler =
new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
servletContextHandler.addServlet(servletHolder, "/" + customContextPath + "/*");
server.start();
Is there any way for me to add some kind of handling for a custom favicon.ico using the aforementioned setup?
Thanks
Put another way, running Jetty in embedded mode means putting an HTTP module into your application, rather than putting your application into an HTTP server.
Jetties protect the shoreline of a body of water by acting as a barrier against erosion from currents, tides, and waves. Jetties can also be used to connect the land with deep water farther away from shore for the purposes of docking ships and unloading cargo. This type of jetty is called a pier.
Jersey is an open source framework for developing RESTful Web Services in Java. It is a reference implementation of the Java API for RESTful Web Services (JAX-RS) specification. Jetty is a Java HTTP (Web) server and Java Servlet container.
Jetty has good support for asynchronous request processing.
Just adding the favicon.ico to the root directory doesn't work because the browser doesn't include the app's context when fetching the favicon. Add this to your HTML:
<link rel="shortcut icon" href="images/favicon.ico">
Be sure to provide a correct absolute or relative path to your favicon.
Have you tried adding favicon.ico to the root directory of where your content is located.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With