Class FavIconHandler

  • All Implemented Interfaces:
    io.muserver.MuHandler

    public class FavIconHandler
    extends Object
    implements io.muserver.MuHandler
    This is a convenience class to make it easy to serve a favicon.ico file for your router. Place an .ico file on your classpath, then create a FavIconHandler with fromClassPath(String) and add it to your mu-server.
    • Method Detail

      • fromClassPath

        public static FavIconHandler fromClassPath​(String iconPath)
                                            throws IOException
        Creates a Mu Handler that serves a favicon file.
        Parameters:
        iconPath - The classpath path to your favicon.ico file, for example /web/favicon.ico
        Returns:
        A handler that you can add to MuServerBuilder.addHandler(MuHandler)
        Throws:
        IOException - Thrown if the icon doesn't exist or cannot be read
      • handle

        public boolean handle​(io.muserver.MuRequest req,
                              io.muserver.MuResponse resp)
                       throws Exception
        Specified by:
        handle in interface io.muserver.MuHandler
        Throws:
        Exception