/** * Create output stream. * * @param port the port * @param path the path * @param mimeType the mime type * @return the output stream * @throws IOException the io exception */ @javax.annotation.Nonnull public static FileNanoHTTPD create(final int port, @Nonnull final File path, final String mimeType) throws IOException { return new FileNanoHTTPD(path, port).init(); }
/** * Create output stream. * * @param port the port * @param path the path * @param mimeType the mime type * @return the output stream * @throws IOException the io exception */ @javax.annotation.Nonnull public static FileNanoHTTPD create(final int port, @Nonnull final File path, final String mimeType) throws IOException { return new FileNanoHTTPD(path, port).init(); }
@Override @javax.annotation.Nonnull public StreamNanoHTTPD init() throws IOException { super.init(); if (!GraphicsEnvironment.isHeadless() && Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) new Thread(() -> { try { Thread.sleep(100); if (null != gatewayUri && isAutobrowse()) Desktop.getDesktop().browse(gatewayUri); } catch (@javax.annotation.Nonnull final Exception e) { e.printStackTrace(); } }).start(); return this; }
@Override @javax.annotation.Nonnull public StreamNanoHTTPD init() throws IOException { super.init(); if (!GraphicsEnvironment.isHeadless() && Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) new Thread(() -> { try { Thread.sleep(100); if (null != gatewayUri && isAutobrowse()) Desktop.getDesktop().browse(gatewayUri); } catch (@javax.annotation.Nonnull final Exception e) { e.printStackTrace(); } }).start(); return this; }
if (null != httpd) { try { httpd.init(); } catch (Throwable e) { log.warn("Error starting web server", e);
if (null != httpd) { try { httpd.init(); } catch (Throwable e) { log.warn("Error starting web server", e);