public static ConnectorFactory application() { final HttpConnectorFactory factory = new HttpConnectorFactory(); factory.port = 8080; return factory; }
/** * Sets the base resource for this context. * * @param baseResource The resource to be used as the base for all static content of this context. */ public void setBaseResource(Resource baseResource) { handler.setBaseResource(baseResource); }
/** * Sets the base resource for this context. * @param resourceBase A string representing the base resource for the context. Any * string accepted by Resource.newResource(String) may be passed * and the call is equivalent to {@link #setBaseResource(Resource)}} */ public void setResourceBase(String resourceBase) { handler.setResourceBase(resourceBase); }
/** * Set the security handler. * * @param securityHandler The securityHandler to set. */ public void setSecurityHandler(SecurityHandler securityHandler) { handler.setSecurityEnabled(securityHandler != null); handler.setSecurityHandler(securityHandler); }
/** * Add one or more servlet event listeners. * * @param listeners one or more listener instances that implement {@link * javax.servlet.ServletContextListener}, {@link javax.servlet.ServletContextAttributeListener}, * {@link javax.servlet.ServletRequestListener} or {@link * javax.servlet.ServletRequestAttributeListener} */ public void addServletListeners(EventListener... listeners) { for (EventListener listener : listeners) { handler.addEventListener(listener); } }
/** * Set the session handler. * * @param sessionHandler The sessionHandler to set. */ public void setSessionHandler(SessionHandler sessionHandler) { handler.setSessionsEnabled(sessionHandler != null); handler.setSessionHandler(sessionHandler); }
public RoutingHandler(Map<Connector, Handler> handlers) { this.entries = new Entry[handlers.size()]; int i = 0; for (Map.Entry<Connector, Handler> entry : handlers.entrySet()) { this.entries[i++] = new Entry(entry.getKey(), entry.getValue()); addBean(entry.getValue()); } setHandlers(handlers.values().toArray(new Handler[handlers.size()])); }
static BadMessageException handleException(String format, IOException e) throws IOException { if (e instanceof ZipException) { return buildBadDataException(format, e); } else if (e instanceof EOFException) { return buildPrematureEofException(format, e); } else { throw e; } }
/** * The SOMAXCONN value of the current machine. If failed to get the value, {@code 200} is used as a * default value for Windows or {@code 128} for others. */ public static int getTcpBacklog() { return getTcpBacklog(getDefaultTcpBacklog()); }
@Override protected HttpConfiguration buildHttpConfiguration() { final HttpConfiguration config = super.buildHttpConfiguration(); config.setSecureScheme("https"); config.setSecurePort(getPort()); config.addCustomizer(new SecureRequestCustomizer()); return config; }
/** * Set an initialization parameter. * * @param name Parameter name * @param value Parameter value */ public void setInitParameter(String name, String value) { handler.setInitParameter(name, value); }
public Jetty93InstrumentedConnectionFactory(ConnectionFactory connectionFactory, Timer timer) { this.connectionFactory = connectionFactory; this.timer = timer; addBean(connectionFactory); }
public NonblockingServletHolder(Servlet servlet) { super(servlet); setInitOrder(1); this.servlet = servlet; }
public static int getDefaultTcpBacklog() { return isWindows() ? DEFAULT_TCP_BACKLOG_WINDOWS : DEFAULT_TCP_BACKLOG_LINUX; }
/** * Set protected targets. * * @param targets Array of URL prefix. Each prefix is in the form /path and * will match either /path exactly or /path/anything */ public void setProtectedTargets(String... targets) { handler.setProtectedTargets(Arrays.copyOf(targets, targets.length)); }
@Override public int available() throws IOException { try { return delegate.available(); } catch (IOException e) { throw handleException(format, e); } }
/** * Set a mime mapping. * * @param extension Extension * @param type Mime type */ public void addMimeMapping(String extension, String type) { handler.getMimeTypes().addMimeMapping(extension, type); }
public static ConnectorFactory admin() { final HttpConnectorFactory factory = new HttpConnectorFactory(); factory.port = 8081; return factory; }
/** * Sets the base resources for this context. * * @param resources A list of strings representing the base resources to serve static * content for the context. Any string accepted by Resource.newResource(String) * may be passed and the call is equivalent to {@link #setBaseResource(Resource...)}} */ public void setBaseResource(String... resources) { handler.setBaseResource(new ResourceCollection(resources)); }