本文整理了Java中org.eclipse.jetty.webapp.WebAppContext.setServerClasses()
方法的一些代码示例,展示了WebAppContext.setServerClasses()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebAppContext.setServerClasses()
方法的具体详情如下:
包路径:org.eclipse.jetty.webapp.WebAppContext
类名称:WebAppContext
方法名:setServerClasses
[英]Set the server classes patterns.
Server classes/packages are classes used to implement the server and are hidden from the context. If the context needs to load these classes, it must have its own copy of them in WEB-INF/lib or WEB-INF/classes. A ClasspathPattern is used to match the server classes.
[中]设置服务器类模式。
服务器类/包是用于实现服务器的类,对上下文隐藏。如果上下文需要加载这些类,它必须在WEB-INF/lib或WEB-INF/classes中有自己的副本。ClasspathPattern用于匹配服务器类。
代码示例来源:origin: apache/nifi
webappContext.setServerClasses(serverClasses.toArray(new String[0]));
webappContext.setDefaultsDescriptor(WEB_DEFAULTS_XML);
代码示例来源:origin: apache/nifi-minifi
webappContext.setServerClasses(serverClasses.toArray(new String[0]));
webappContext.setDefaultsDescriptor(WEB_DEFAULTS_XML);
代码示例来源:origin: apache/cxf
protected void run() {
System.setProperty("java.naming.factory.url", "org.eclipse.jetty.jndi");
System.setProperty("java.naming.factory.initial", "org.eclipse.jetty.jndi.InitialContextFactory");
server = new Server(port);
try {
if (resourcePath == null) {
// Register and map the dispatcher servlet
final ServletHolder servletHolder = new ServletHolder(new CXFCdiServlet());
final ServletContextHandler context = new ServletContextHandler();
context.setContextPath(contextPath);
context.addEventListener(listener);
context.addServlet(servletHolder, "/rest/*");
server.setHandler(context);
} else {
final WebAppContext context = new WebAppContext();
context.setContextPath(contextPath);
context.setWar(getClass().getResource(resourcePath).toURI().getPath());
context.setServerClasses(new String[] {
"org.eclipse.jetty.servlet.ServletContextHandler.Decorator"
});
HandlerCollection handlers = new HandlerCollection();
handlers.setHandlers(new Handler[] {context, new DefaultHandler()});
server.setHandler(handlers);
}
server.start();
} catch (final Exception ex) {
ex.printStackTrace();
fail(ex.getMessage());
}
}
代码示例来源:origin: org.apache.nifi.minifi/minifi-c2-jetty
webappContext.setServerClasses(serverClasses.toArray(new String[0]));
webappContext.setDefaultsDescriptor(WEB_DEFAULTS_XML);
代码示例来源:origin: org.apache.nifi.registry/nifi-registry-jetty
webappContext.setServerClasses(serverClasses.toArray(new String[0]));
webappContext.setDefaultsDescriptor(WEB_DEFAULTS_XML);
代码示例来源:origin: org.apache.cxf.systests/cxf-systests-cdi-base
protected void run() {
System.setProperty("java.naming.factory.url", "org.eclipse.jetty.jndi");
System.setProperty("java.naming.factory.initial", "org.eclipse.jetty.jndi.InitialContextFactory");
server = new Server(port);
try {
if (resourcePath == null) {
// Register and map the dispatcher servlet
final ServletHolder servletHolder = new ServletHolder(new CXFCdiServlet());
final ServletContextHandler context = new ServletContextHandler();
context.setContextPath(contextPath);
context.addEventListener(listener);
context.addServlet(servletHolder, "/rest/*");
server.setHandler(context);
} else {
final WebAppContext context = new WebAppContext();
context.setContextPath(contextPath);
context.setWar(getClass().getResource(resourcePath).toURI().getPath());
context.setServerClasses(new String[] {
"org.eclipse.jetty.servlet.ServletContextHandler.Decorator"
});
HandlerCollection handlers = new HandlerCollection();
handlers.setHandlers(new Handler[] {context, new DefaultHandler()});
server.setHandler(handlers);
}
server.start();
} catch (final Exception ex) {
ex.printStackTrace();
fail(ex.getMessage());
}
}
代码示例来源:origin: org.avaje.glue/jetty-runner
/**
* Create the WebAppContext with basic configurations set like context path etc.
*/
void createWebAppContext() {
webapp.setServerClasses(getServerClasses());
webapp.setContextPath(contextPath);
webapp.setTempDirectory(createTempDir("jetty-app-"));
webapp.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
setSecureCookies();
}
代码示例来源:origin: com.enioka.jqm/jqm-service
webAppContext.setServerClasses(exclusions);
代码示例来源:origin: enioka/jqm
webAppContext.setServerClasses(exclusions);
代码示例来源:origin: org.mortbay.jetty/jetty-maven-plugin
public void configure(WebAppContext context) throws Exception
{
JettyWebAppContext jwac = (JettyWebAppContext)context;
if (jwac.getClassPathFiles() != null)
{
if (LOG.isDebugEnabled()) LOG.debug("Setting up classpath ...");
//put the classes dir and all dependencies into the classpath
Iterator itor = jwac.getClassPathFiles().iterator();
while (itor.hasNext())
((WebAppClassLoader)context.getClassLoader()).addClassPath(((File)itor.next()).getCanonicalPath());
if (LOG.isDebugEnabled())
LOG.debug("Classpath = "+LazyList.array2List(((URLClassLoader)context.getClassLoader()).getURLs()));
}
super.configure(context);
// knock out environmental maven and plexus classes from webAppContext
String[] existingServerClasses = context.getServerClasses();
String[] newServerClasses = new String[2+(existingServerClasses==null?0:existingServerClasses.length)];
newServerClasses[0] = "org.apache.maven.";
newServerClasses[1] = "org.codehaus.plexus.";
System.arraycopy( existingServerClasses, 0, newServerClasses, 2, existingServerClasses.length );
if (LOG.isDebugEnabled())
{
LOG.debug("Server classes:");
for (int i=0;i<newServerClasses.length;i++)
LOG.debug(newServerClasses[i]);
}
context.setServerClasses( newServerClasses );
}
代码示例来源:origin: org.mule.transports/mule-transport-jetty
@Override
public ContextHandler createContextHandler(App app) throws Exception
{
WebAppContext webAppContext = (WebAppContext) super.createContextHandler(app);
if (webappsConfiguration.getServerClasses() != null)
{
webAppContext.setServerClasses(webappsConfiguration.getServerClasses());
}
if (webappsConfiguration.getSystemClasses() != null)
{
webAppContext.setSystemClasses(webappsConfiguration.getSystemClasses());
}
File workDir = new File(muleContext.getConfiguration().getWorkingDirectory(),
"_exploded_wars" + webAppContext.getContextPath());
workDir.mkdirs();
webAppContext.setTempDirectory(workDir);
webAppContext.setAttribute(MULE_CONTEXT_ATTRIBUTE, muleContext);
webAppContext.setVirtualHosts(new String[] {getVirtualHostName(jettyConnector)});
if (logger.isInfoEnabled())
{
String msg = String.format("Will deploy a web app at %s://%s%s%s",
"http", jettyConnector.getHost(),
jettyConnector.getPort() == 80 ? StringUtils.EMPTY : ":" + jettyConnector.getPort(),
webAppContext.getContextPath());
logger.info(StringMessageUtils.getBoilerPlate(msg, '*', 70));
}
return webAppContext;
}
};
代码示例来源:origin: nutzam/nutz-web
wac.setProtectedTargets(new String[]{"/java", "/javax", "/org", "/net", "/WEB-INF", "/META-INF"});
wac.setTempDirectory(new File("./tmp").getAbsoluteFile());
wac.setServerClasses(new String[] { "org.objectweb.asm.", // hide asm used by jetty
"org.eclipse.jdt.", // hide jdt used by jetty
"org.nutz" // hide nutz classes
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
try
context.setServerClasses(null);
if(LOG.isDebugEnabled())
LOG.debug("Configure: "+jetty);
context.setServerClasses(old_server_classes);
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
try
context.setServerClasses(null);
if(LOG.isDebugEnabled())
LOG.debug("Configure: "+jetty);
context.setServerClasses(old_server_classes);
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus
try
context.setServerClasses(null);
if(LOG.isDebugEnabled())
LOG.debug("Configure: "+jetty);
context.setServerClasses(old_server_classes);
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
try
context.setServerClasses(null);
if(LOG.isDebugEnabled())
LOG.debug("Configure: "+jetty);
context.setServerClasses(old_server_classes);
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp
try
context.setServerClasses(null);
if(LOG.isDebugEnabled())
LOG.debug("Configure: "+jetty);
context.setServerClasses(old_server_classes);
内容来源于网络,如有侵权,请联系作者删除!