public static void addSystemClasses(Server server,String... pattern ) { if (pattern == null || pattern.length == 0) return; // look for a Server attribute with the list of System classes // to apply to every web application. If not present, use our defaults. Object o = server.getAttribute(SERVER_SYS_CLASSES); if (o instanceof ClasspathPattern) { ((ClasspathPattern)o).add(pattern); return; } String[] system_classes; if (o instanceof String[]) system_classes = (String[])o; else system_classes = __dftSystemClasses; int l = system_classes.length; system_classes = Arrays.copyOf(system_classes,l+pattern.length); System.arraycopy(pattern,0,system_classes,l,pattern.length); server.setAttribute(SERVER_SYS_CLASSES,system_classes); }
public static void addServerClasses(Server server,String... pattern ) { if (pattern == null || pattern.length == 0) return; // look for a Server attribute with the list of Server classes // to apply to every web application. If not present, use our defaults. Object o = server.getAttribute(SERVER_SRV_CLASSES); if (o instanceof ClasspathPattern) { ((ClasspathPattern)o).add(pattern); return; } String[] server_classes; if (o instanceof String[]) server_classes = (String[])o; else server_classes = __dftServerClasses; int l = server_classes.length; server_classes = Arrays.copyOf(server_classes,l+pattern.length); System.arraycopy(pattern,0,server_classes,l,pattern.length); server.setAttribute(SERVER_SRV_CLASSES,server_classes); }
/** Get/Set/Create the server default Configuration ClassList. * <p>Get the class list from: a Server bean; or the attribute (which can * either be a ClassList instance or an String[] of class names); or a new instance * with default configuration classes.</p> * <p>This method also adds the obtained ClassList instance as a dependent bean * on the server and clears the attribute</p> * @param server The server the default is for * @return the server default ClassList instance of the configuration classes for this server. Changes to this list will change the server default instance. */ public static ClassList setServerDefault(Server server) { ClassList cl=server.getBean(ClassList.class); if (cl!=null) return cl; cl=serverDefault(server); server.addBean(cl); server.setAttribute(ATTR,null); return cl; }
context.getServer().setAttribute(CACHED_CONTAINER_RESOURCES, metaInfResourceCache); context.getServer().setAttribute(CACHED_CONTAINER_FRAGMENTS, metaInfFragmentCache); context.getServer().setAttribute(CACHED_CONTAINER_TLDS, metaInfTldCache);
/** * Adds a servlet attribute to the Jetty server. * * @param name The server attribute name. * @param value The context path of the servlet. * @return This object (for method chaining). * @throws RuntimeException if {@link #createServer()} has not previously been called. */ public RestMicroservice addServletAttribute(String name, Object value) { getServer().setAttribute(name, value); return this; }
/** * Adds a servlet attribute to the Jetty server. * * @param name The server attribute name. * @param value The context path of the servlet. * @return This object (for method chaining). * @throws RuntimeException if {@link #createServer()} has not previously been called. */ public JettyMicroservice addServletAttribute(String name, Object value) { getServer().setAttribute(name, value); return this; }
public void start() throws Exception { //-------初始化------获取Context句柄------ int jettyPort = serverConfig.getServerPort(); int maxFormContentSize = serverConfig.getMaxFormContentSize(); // 创建Server this.server = new Server(jettyPort); server.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", maxFormContentSize); HandlerList handlers = loadHandlers(); //加载路由 server.setHandler(handlers); logger.info("web Server started... the port {}", jettyPort); server.start(); }
public static void addServerClasses(Server server,String... pattern ) { if (pattern == null || pattern.length == 0) return; // look for a Server attribute with the list of Server classes // to apply to every web application. If not present, use our defaults. Object o = server.getAttribute(SERVER_SRV_CLASSES); if (o instanceof ClasspathPattern) { ((ClasspathPattern)o).add(pattern); return; } String[] server_classes; if (o instanceof String[]) server_classes = (String[])o; else server_classes = __dftServerClasses; int l = server_classes.length; server_classes = Arrays.copyOf(server_classes,l+pattern.length); System.arraycopy(pattern,0,server_classes,l,pattern.length); server.setAttribute(SERVER_SRV_CLASSES,server_classes); }
public static void addSystemClasses(Server server,String... pattern ) { if (pattern == null || pattern.length == 0) return; // look for a Server attribute with the list of System classes // to apply to every web application. If not present, use our defaults. Object o = server.getAttribute(SERVER_SYS_CLASSES); if (o instanceof ClasspathPattern) { ((ClasspathPattern)o).add(pattern); return; } String[] system_classes; if (o instanceof String[]) system_classes = (String[])o; else system_classes = __dftSystemClasses; int l = system_classes.length; system_classes = Arrays.copyOf(system_classes,l+pattern.length); System.arraycopy(pattern,0,system_classes,l,pattern.length); server.setAttribute(SERVER_SYS_CLASSES,system_classes); }
JettyApplication.SERVER.setAttribute( "org.mortbay.jetty.Request.maxFormContentSize", 0); JettyApplication.SERVER.setStopAtShutdown(true);
Object value = props.get(key); properties.put(key, value.toString()); if (server != null) server.setAttribute(key, value);
private Server createServer(final Spawn spawn, SpawnServiceConfiguration configuration) throws Exception { Server server = new Server(); initServerConnectors(server, spawn, configuration); // for closing certain api resource, namely JobsResource, but new ones can be added final Closer closer = Closer.create(); ServletContextHandler context = createServletContextHandler(spawn, configuration, closer); Handler handler = createRootHandler(context); server.setAttribute("org.eclipse.jetty.Request.maxFormContentSize", 5000000); server.setHandler(handler); // this must be after server.setHandler(handler) because websocket configuration needs // the server object from servletContextHandler configureWebSocketServlet(context); server.addLifeCycleListener(new AbstractLifeCycle.AbstractLifeCycleListener() { @Override public void lifeCycleStopping(LifeCycle event) { super.lifeCycleStopping(event); try { closer.close(); } catch (IOException ex) { log.error("IOException while closing jetty resources: ", ex); } } }); return server; }
/** Get/Set/Create the server default Configuration ClassList. * <p>Get the class list from: a Server bean; or the attribute (which can * either be a ClassList instance or an String[] of class names); or a new instance * with default configuration classes.</p> * <p>This method also adds the obtained ClassList instance as a dependent bean * on the server and clears the attribute</p> * @param server The server the default is for * @return the server default ClassList instance of the configuration classes for this server. Changes to this list will change the server default instance. */ public static ClassList setServerDefault(Server server) { ClassList cl=server.getBean(ClassList.class); if (cl!=null) return cl; cl=serverDefault(server); server.addBean(cl); server.setAttribute(ATTR,null); return cl; }
/** Get/Set/Create the server default Configuration ClassList. * <p>Get the class list from: a Server bean; or the attribute (which can * either be a ClassList instance or an String[] of class names); or a new instance * with default configuration classes.</p> * <p>This method also adds the obtained ClassList instance as a dependent bean * on the server and clears the attribute</p> * @param server The server the default is for * @return the server default ClassList instance of the configuration classes for this server. Changes to this list will change the server default instance. */ public static ClassList setServerDefault(Server server) { ClassList cl=server.getBean(ClassList.class); if (cl!=null) return cl; cl=serverDefault(server); server.addBean(cl); server.setAttribute(ATTR,null); return cl; }
/** Get/Set/Create the server default Configuration ClassList. * <p>Get the class list from: a Server bean; or the attribute (which can * either be a ClassList instance or an String[] of class names); or a new instance * with default configuration classes.</p> * <p>This method also adds the obtained ClassList instance as a dependent bean * on the server and clears the attribute</p> * @param server The server the default is for * @return the server default ClassList instance of the configuration classes for this server. Changes to this list will change the server default instance. */ public static ClassList setServerDefault(Server server) { ClassList cl=server.getBean(ClassList.class); if (cl!=null) return cl; cl=serverDefault(server); server.addBean(cl); server.setAttribute(ATTR,null); return cl; }
http.setPort(Integer.parseInt(getHttpPort())); s.setConnectors(new Connector[] {http}); s.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", -1);
context.getServer().setAttribute(CACHED_CONTAINER_RESOURCES, metaInfResourceCache); context.getServer().setAttribute(CACHED_CONTAINER_FRAGMENTS, metaInfFragmentCache); context.getServer().setAttribute(CACHED_CONTAINER_TLDS, metaInfTldCache);
server.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", -1);
server.setAttribute(TRANSPORT_ATTRIBUTE, JettyHttpServerTransport.this);
cqsServer.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", MAX_REQUEST_LENGTH); cnsServer.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", MAX_REQUEST_LENGTH);