本文整理了Java中org.eclipse.jetty.server.Server.getAttribute()
方法的一些代码示例,展示了Server.getAttribute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getAttribute()
方法的具体详情如下:
包路径:org.eclipse.jetty.server.Server
类名称:Server
方法名:getAttribute
暂无
代码示例来源: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
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
if (useCaches)
metaInfResourceCache = (ConcurrentHashMap<Resource, Resource>)context.getServer().getAttribute(CACHED_CONTAINER_RESOURCES);
if (metaInfResourceCache == null)
context.getServer().setAttribute(CACHED_CONTAINER_RESOURCES, metaInfResourceCache);
metaInfFragmentCache = (ConcurrentHashMap<Resource, Resource>)context.getServer().getAttribute(CACHED_CONTAINER_FRAGMENTS);
if (metaInfFragmentCache == null)
context.getServer().setAttribute(CACHED_CONTAINER_FRAGMENTS, metaInfFragmentCache);
metaInfTldCache = (ConcurrentHashMap<Resource, Collection<URL>>)context.getServer().getAttribute(CACHED_CONTAINER_TLDS);
if (metaInfTldCache == null)
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
protected void loadSystemClasses()
{
if (_systemClasses != null)
return;
//look for a Server attribute with the list of System classes
//to apply to every web application. If not present, use our defaults.
Server server = getServer();
if (server != null)
{
Object systemClasses = server.getAttribute(SERVER_SYS_CLASSES);
if (systemClasses instanceof String[])
_systemClasses = new ClasspathPattern((String[])systemClasses);
else if (systemClasses instanceof ClasspathPattern)
_systemClasses = new ClasspathPattern(((ClasspathPattern)systemClasses).getPatterns());
}
if (_systemClasses == null)
_systemClasses = new ClasspathPattern(__dftSystemClasses);
}
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
protected void loadServerClasses()
{
if (_serverClasses != null)
{
return;
}
// look for a Server attribute with the list of Server classes
// to apply to every web application. If not present, use our defaults.
Server server = getServer();
if (server != null)
{
Object serverClasses = server.getAttribute(SERVER_SRV_CLASSES);
if (serverClasses instanceof String[])
_serverClasses = new ClasspathPattern((String[])serverClasses);
else if (serverClasses instanceof ClasspathPattern)
_serverClasses = new ClasspathPattern(((ClasspathPattern)serverClasses).getPatterns());
}
if (_serverClasses == null)
{
_serverClasses = new ClasspathPattern(__dftServerClasses);
}
}
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
/** Get/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.
* @param server The server the default is for
* @return A copy of the server default ClassList instance of the configuration classes for this server. Changes to the returned list will not change the server default.
*/
public static ClassList serverDefault(Server server)
{
ClassList cl=null;
if (server!=null)
{
cl= server.getBean(ClassList.class);
if (cl!=null)
return new ClassList(cl);
Object attr = server.getAttribute(ATTR);
if (attr instanceof ClassList)
return new ClassList((ClassList)attr);
if (attr instanceof String[])
return new ClassList((String[])attr);
}
return new ClassList();
}
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
@Override
public void preConfigure(final WebAppContext context) throws Exception
{
boolean useContainerCache = DEFAULT_USE_CONTAINER_METAINF_CACHE;
if (context.getServer() != null)
{
Boolean attr = (Boolean)context.getServer().getAttribute(USE_CONTAINER_METAINF_CACHE);
if (attr != null)
useContainerCache = attr.booleanValue();
}
if (LOG.isDebugEnabled()) LOG.debug("{} = {}", USE_CONTAINER_METAINF_CACHE, useContainerCache);
//pre-emptively create empty lists for tlds, fragments and resources as context attributes
//this signals that this class has been called. This differentiates the case where this class
//has been called but finds no META-INF data from the case where this class was never called
if (context.getAttribute(METAINF_TLDS) == null)
context.setAttribute(METAINF_TLDS, new HashSet<URL>());
if (context.getAttribute(METAINF_RESOURCES) == null)
context.setAttribute(METAINF_RESOURCES, new HashSet<Resource>());
if (context.getAttribute(METAINF_FRAGMENTS) == null)
context.setAttribute(METAINF_FRAGMENTS, new HashMap<Resource, Resource>());
//always scan everything from the container's classpath
scanJars(context, context.getMetaData().getContainerResources(), useContainerCache, __allScanTypes);
//only look for fragments if web.xml is not metadata complete, or it version 3.0 or greater
List<String> scanTypes = new ArrayList<>(__allScanTypes);
if (context.getMetaData().isMetaDataComplete() || (context.getServletContext().getEffectiveMajorVersion() < 3) && !context.isConfigurationDiscovered())
scanTypes.remove(METAINF_FRAGMENTS);
scanJars(context, context.getMetaData().getWebInfJars(), false, scanTypes);
}
代码示例来源:origin: org.eclipse.jetty.osgi/jetty-osgi-boot
private File getFile (String file, File bundleInstall)
{
if (file == null)
return null;
if (file.startsWith("/") || file.startsWith("file:/")) //absolute location
return new File(file);
else
{
//relative location
//try inside the bundle first
File f = new File (bundleInstall, file);
if (f.exists()) return f;
String jettyHome = (String)getDeploymentManager().getServer().getAttribute(OSGiServerConstants.JETTY_HOME);
if (jettyHome != null)
return new File(jettyHome, file);
}
return null;
}
}
代码示例来源:origin: sonian/elasticsearch-jetty
@Override
protected void doStart() throws Exception {
super.doStart();
Server server = getServer();
// JettyHttpServerTransport can be either set explicitly in jetty.xml or obtained from server
if (transport == null) {
JettyHttpServerTransport transport = (JettyHttpServerTransport) server.getAttribute(JettyHttpServerTransport.TRANSPORT_ATTRIBUTE);
if (transport == null) {
throw new IllegalArgumentException("Transport is not specified");
}
setTransport(transport);
}
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
@Override
public void setServer(Server server)
{
super.setServer(server);
//if we haven't been given a set of configuration instances to
//use, and we haven't been given a set of configuration classes
//to use, use the configuration classes that came from the
//Server (if there are any)
if (!_configurationsSet && !_configurationClassesSet && server != null)
{
String[] serverConfigs = (String[])server.getAttribute(SERVER_CONFIG);
if (serverConfigs != null)
setConfigurationClasses(serverConfigs);
}
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp
@Override
public void setServer(Server server)
{
super.setServer(server);
//if we haven't been given a set of configuration instances to
//use, and we haven't been given a set of configuration classes
//to use, use the configuration classes that came from the
//Server (if there are any)
if (!_configurationsSet && !_configurationClassesSet && server != null)
{
String[] serverConfigs = (String[])server.getAttribute(SERVER_CONFIG);
if (serverConfigs != null)
setConfigurationClasses(serverConfigs);
}
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus
@Override
public void setServer(Server server)
{
super.setServer(server);
//if we haven't been given a set of configuration instances to
//use, and we haven't been given a set of configuration classes
//to use, use the configuration classes that came from the
//Server (if there are any)
if (!_configurationsSet && !_configurationClassesSet && server != null)
{
String[] serverConfigs = (String[])server.getAttribute(SERVER_CONFIG);
if (serverConfigs != null)
setConfigurationClasses(serverConfigs);
}
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
protected void loadSystemClasses()
{
if (_systemClasses != null)
return;
//look for a Server attribute with the list of System classes
//to apply to every web application. If not present, use our defaults.
Server server = getServer();
if (server != null)
{
Object systemClasses = server.getAttribute(SERVER_SYS_CLASSES);
if (systemClasses != null && systemClasses instanceof String[])
_systemClasses = new ClasspathPattern((String[])systemClasses);
}
if (_systemClasses == null)
_systemClasses = new ClasspathPattern(__dftSystemClasses);
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
protected void loadSystemClasses()
{
if (_systemClasses != null)
return;
//look for a Server attribute with the list of System classes
//to apply to every web application. If not present, use our defaults.
Server server = getServer();
if (server != null)
{
Object systemClasses = server.getAttribute(SERVER_SYS_CLASSES);
if (systemClasses != null && systemClasses instanceof String[])
_systemClasses = new ClasspathPattern((String[])systemClasses);
}
if (_systemClasses == null)
_systemClasses = new ClasspathPattern(__dftSystemClasses);
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
protected void loadSystemClasses()
{
if (_systemClasses != null)
return;
//look for a Server attribute with the list of System classes
//to apply to every web application. If not present, use our defaults.
Server server = getServer();
if (server != null)
{
Object systemClasses = server.getAttribute(SERVER_SYS_CLASSES);
if (systemClasses != null && systemClasses instanceof String[])
_systemClasses = new ClasspathPattern((String[])systemClasses);
}
if (_systemClasses == null)
_systemClasses = new ClasspathPattern(__dftSystemClasses);
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp
protected void loadSystemClasses()
{
if (_systemClasses != null)
return;
//look for a Server attribute with the list of System classes
//to apply to every web application. If not present, use our defaults.
Server server = getServer();
if (server != null)
{
Object systemClasses = server.getAttribute(SERVER_SYS_CLASSES);
if (systemClasses != null && systemClasses instanceof String[])
_systemClasses = new ClasspathPattern((String[])systemClasses);
}
if (_systemClasses == null)
_systemClasses = new ClasspathPattern(__dftSystemClasses);
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus
protected void loadSystemClasses()
{
if (_systemClasses != null)
return;
//look for a Server attribute with the list of System classes
//to apply to every web application. If not present, use our defaults.
Server server = getServer();
if (server != null)
{
Object systemClasses = server.getAttribute(SERVER_SYS_CLASSES);
if (systemClasses != null && systemClasses instanceof String[])
_systemClasses = new ClasspathPattern((String[])systemClasses);
}
if (_systemClasses == null)
_systemClasses = new ClasspathPattern(__dftSystemClasses);
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
/** Get/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.
* @param server The server the default is for
* @return A copy of the server default ClassList instance of the configuration classes for this server. Changes to the returned list will not change the server default.
*/
public static ClassList serverDefault(Server server)
{
ClassList cl=server.getBean(ClassList.class);
if (cl!=null)
return new ClassList(cl);
Object attr = server.getAttribute(ATTR);
if (attr instanceof ClassList)
return new ClassList((ClassList)attr);
if (attr instanceof String[])
return new ClassList((String[])attr);
return new ClassList();
}
代码示例来源:origin: jenkinsci/winstone
protected void loadSystemClasses()
{
if (_systemClasses != null)
return;
//look for a Server attribute with the list of System classes
//to apply to every web application. If not present, use our defaults.
Server server = getServer();
if (server != null)
{
Object systemClasses = server.getAttribute(SERVER_SYS_CLASSES);
if (systemClasses instanceof String[])
_systemClasses = new ClasspathPattern((String[])systemClasses);
else if (systemClasses instanceof ClasspathPattern)
_systemClasses = new ClasspathPattern(((ClasspathPattern)systemClasses).getPatterns());
}
if (_systemClasses == null)
_systemClasses = new ClasspathPattern(__dftSystemClasses);
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
/** Get/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.
* @param server The server the default is for
* @return A copy of the server default ClassList instance of the configuration classes for this server. Changes to the returned list will not change the server default.
*/
public static ClassList serverDefault(Server server)
{
ClassList cl=server.getBean(ClassList.class);
if (cl!=null)
return new ClassList(cl);
Object attr = server.getAttribute(ATTR);
if (attr instanceof ClassList)
return new ClassList((ClassList)attr);
if (attr instanceof String[])
return new ClassList((String[])attr);
return new ClassList();
}
内容来源于网络,如有侵权,请联系作者删除!