org.mortbay.jetty.webapp.WebAppContext.setDefaultsDescriptor()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.mortbay.jetty.webapp.WebAppContext.setDefaultsDescriptor()方法的一些代码示例,展示了WebAppContext.setDefaultsDescriptor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebAppContext.setDefaultsDescriptor()方法的具体详情如下:
包路径:org.mortbay.jetty.webapp.WebAppContext
类名称:WebAppContext
方法名:setDefaultsDescriptor

WebAppContext.setDefaultsDescriptor介绍

[英]The default descriptor is a web.xml format file that is applied to the context before the standard WEB-INF/web.xml
[中]默认描述符是web。应用于标准WEB-INF/WEB之前的上下文的xml格式文件。xml

代码示例

代码示例来源:origin: org.mortbay.jetty/jetty-embedded

public static void main(String[] args)
    throws Exception
  {
    String jetty_default=new java.io.File("./start.jar").exists()?".":"../..";;
    String jetty_home = System.getProperty("jetty.home",jetty_default);

    Server server = new Server();
    
    Connector connector=new SelectChannelConnector();
    connector.setPort(Integer.getInteger("jetty.port",8080).intValue());
    server.setConnectors(new Connector[]{connector});
    
    WebAppContext webapp = new WebAppContext();
    webapp.setContextPath("/");
    webapp.setWar(jetty_home+"/webapps/test");
    webapp.setDefaultsDescriptor(jetty_home+"/etc/webdefault.xml");
    
    server.setHandler(webapp);
    
    server.start();
    server.join();
  }
}

代码示例来源:origin: feroult/yawp

public WebAppContext createWebApp() {
  webapp = createWebAppContext();
  webapp.setDefaultsDescriptor(getWebDefaultXml());
  configureCustom();
  configureClassloader();
  configureHotDeploy();
  return webapp;
}

代码示例来源:origin: net.disy.legato/legato-testing

@Override
public void addWebAppContext(final String contextPath, final String location) {
 final WebAppContext webAppContext = new WebAppContext();
 webAppContext.setContextPath(contextPath);
 webAppContext.setConfigurationClasses(DEFAULT_CONFIGURATION_CLASSES);
 webAppContext.setWar(location);
 webAppContext
   .setDefaultsDescriptor("net/disy/legato/testing/server/jetty/webapp/webdefault.xml");
 // final ServletHolder servlet = webAppContext.getServletHandler()
 // .getServlet("default");
 // String aaa = servlet.getInitParameter("useFileMappedBuffer");
 // servlet.setInitParameter("useFileMappedBuffer", "true");
 server.addHandler(webAppContext);
}

代码示例来源:origin: io.hops/hadoop-common

private static WebAppContext createWebAppContext(String name,
  Configuration conf, AccessControlList adminsAcl, final String appDir) {
 WebAppContext ctx = new WebAppContext();
 ctx.setDefaultsDescriptor(null);
 ServletHolder holder = new ServletHolder(new DefaultServlet());
 Map<String, String> params = ImmutableMap. <String, String> builder()
     .put("acceptRanges", "true")
     .put("dirAllowed", "false")
     .put("gzip", "true")
     .put("useFileMappedBuffer", "true")
     .build();
 holder.setInitParameters(params);
 ctx.setWelcomeFiles(new String[] {"index.html"});
 ctx.addServlet(holder, "/");
 ctx.setDisplayName(name);
 ctx.setContextPath("/");
 ctx.setWar(appDir + "/" + name);
 ctx.getServletContext().setAttribute(CONF_CONTEXT_ATTRIBUTE, conf);
 ctx.getServletContext().setAttribute(ADMINS_ACL, adminsAcl);
 addNoCacheFilter(ctx);
 return ctx;
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

private static WebAppContext createWebAppContext(String name,
  Configuration conf, AccessControlList adminsAcl, final String appDir) {
 WebAppContext ctx = new WebAppContext();
 ctx.setDefaultsDescriptor(null);
 ServletHolder holder = new ServletHolder(new DefaultServlet());
 Map<String, String> params = ImmutableMap. <String, String> builder()
     .put("acceptRanges", "true")
     .put("dirAllowed", "false")
     .put("gzip", "true")
     .put("useFileMappedBuffer", "true")
     .build();
 holder.setInitParameters(params);
 ctx.setWelcomeFiles(new String[] {"index.html"});
 ctx.addServlet(holder, "/");
 ctx.setDisplayName(name);
 ctx.setContextPath("/");
 ctx.setWar(appDir + "/" + name);
 ctx.getServletContext().setAttribute(CONF_CONTEXT_ATTRIBUTE, conf);
 ctx.getServletContext().setAttribute(ADMINS_ACL, adminsAcl);
 addNoCacheFilter(ctx);
 return ctx;
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

private static WebAppContext createWebAppContext(String name,
  Configuration conf, AccessControlList adminsAcl, final String appDir) {
 WebAppContext ctx = new WebAppContext();
 ctx.setDefaultsDescriptor(null);
 ServletHolder holder = new ServletHolder(new DefaultServlet());
 Map<String, String> params = ImmutableMap. <String, String> builder()
     .put("acceptRanges", "true")
     .put("dirAllowed", "false")
     .put("gzip", "true")
     .put("useFileMappedBuffer", "true")
     .build();
 holder.setInitParameters(params);
 ctx.setWelcomeFiles(new String[] {"index.html"});
 ctx.addServlet(holder, "/");
 ctx.setDisplayName(name);
 ctx.setContextPath("/");
 ctx.setWar(appDir + "/" + name);
 ctx.getServletContext().setAttribute(CONF_CONTEXT_ATTRIBUTE, conf);
 ctx.getServletContext().setAttribute(ADMINS_ACL, adminsAcl);
 addNoCacheFilter(ctx);
 return ctx;
}

代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server

wah.setConfigurationClasses(_configurationClasses);
if (_defaultsDescriptor!=null)
  wah.setDefaultsDescriptor(_defaultsDescriptor);
wah.setExtractWAR(_extract);
wah.setWar(app.toString());

代码示例来源:origin: net.sf.portletunit/portletunit2

server = new Server(getPort());
WebAppContext webapp = new WebAppContext("src/main/webapp", "/" + contextName);
webapp.setDefaultsDescriptor("/WEB-INF/jetty-pluto-web-default.xml");

相关文章

WebAppContext类方法