本文整理了Java中org.eclipse.jetty.server.Server.setAttribute()
方法的一些代码示例,展示了Server.setAttribute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.setAttribute()
方法的具体详情如下:
包路径:org.eclipse.jetty.server.Server
类名称:Server
方法名:setAttribute
暂无
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
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);
}
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
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);
}
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
/** 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;
}
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
context.getServer().setAttribute(CACHED_CONTAINER_RESOURCES, metaInfResourceCache);
context.getServer().setAttribute(CACHED_CONTAINER_FRAGMENTS, metaInfFragmentCache);
context.getServer().setAttribute(CACHED_CONTAINER_TLDS, metaInfTldCache);
代码示例来源:origin: org.apache.juneau/juneau-microservice-server
/**
* 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;
}
代码示例来源:origin: apache/juneau
/**
* 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;
}
代码示例来源:origin: harbby/sylph
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();
}
代码示例来源:origin: jenkinsci/winstone
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);
}
代码示例来源:origin: jenkinsci/winstone
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);
}
代码示例来源:origin: org.codehaus.openxma/dsl-platform-jsf
JettyApplication.SERVER.setAttribute(
"org.mortbay.jetty.Request.maxFormContentSize", 0);
JettyApplication.SERVER.setStopAtShutdown(true);
代码示例来源:origin: org.eclipse.jetty.osgi/jetty-osgi-boot
Object value = props.get(key);
properties.put(key, value.toString());
if (server != null) server.setAttribute(key, value);
代码示例来源:origin: addthis/hydra
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;
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
/** 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;
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
/** 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;
}
代码示例来源:origin: jenkinsci/winstone
/** 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;
}
代码示例来源:origin: rancher/cattle
http.setPort(Integer.parseInt(getHttpPort()));
s.setConnectors(new Connector[] {http});
s.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", -1);
代码示例来源:origin: jenkinsci/winstone
context.getServer().setAttribute(CACHED_CONTAINER_RESOURCES, metaInfResourceCache);
context.getServer().setAttribute(CACHED_CONTAINER_FRAGMENTS, metaInfFragmentCache);
context.getServer().setAttribute(CACHED_CONTAINER_TLDS, metaInfTldCache);
代码示例来源:origin: com.linkedin.parseq/parseq-tracevis-server
server.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", -1);
代码示例来源:origin: sonian/elasticsearch-jetty
server.setAttribute(TRANSPORT_ATTRIBUTE, JettyHttpServerTransport.this);
代码示例来源:origin: Comcast/cmb
cqsServer.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", MAX_REQUEST_LENGTH);
cnsServer.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", MAX_REQUEST_LENGTH);
内容来源于网络,如有侵权,请联系作者删除!