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

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

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

WebAppContext.setConfigurations介绍

暂无

代码示例

代码示例来源:origin: jersey/jersey

context.setDisplayName("JettyContext");
context.setContextPath(path);
context.setConfigurations(new Configuration[]{new WebXmlConfiguration()});
ServletHolder holder;
if (c != null) {

代码示例来源:origin: apache/shiro

ctx.setConfigurations(new Configuration[]{
    new WebInfConfiguration(),
    new WebXmlConfiguration(),

代码示例来源:origin: org.springframework.boot/spring-boot

Configuration[] configurations = getWebAppContextConfigurations(context,
    initializersToUse);
context.setConfigurations(configurations);
context.setThrowUnavailableOnStartupException(true);
configureSession(context);

代码示例来源:origin: stackoverflow.com

public class JettyServer {

  private static final Logger LOGGER = LoggerFactory.getLogger(JettyServer.class);

  public static void main(final String[] args) throws Exception {
    LOGGER.debug("Starting jetty server");
    int port = 8083;
    LOGGER.debug("Setting the port to {}", port);
    final Server server = new Server(port);
    final WebAppContext root = new WebAppContext();
    root.setContextPath("/");
    root.setResourceBase(".");
    EnvConfiguration envConfiguration = new EnvConfiguration();
    envConfiguration.setJettyEnvXml(JettyServer.class.getResource("/WEB-INF/jetty-env.xml").toURI().toURL());
    //Adding the actual classes instead of just the class names
    root.setConfigurations(new Configuration[]{envConfiguration, new PlusConfiguration(), new WebXmlConfiguration()});
    root.setDescriptor(JettyServer.class.getResource("/WEB-INF/web.xml").toString());
    server.setHandler(root);
    server.start();
    server.join();
  }
}

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) throws Exception
{
  String jetty_home = "..";
  int appli_port = 8080;
  Server server = new Server(appli_port);
  ProtectionDomain protectionDomain = Loader.class.getProtectionDomain();
  URL location = protectionDomain.getCodeSource().getLocation();
  WebAppContext webapp = new WebAppContext();
  webapp.setContextPath("/");
  webapp.setWar(location.toExternalForm());

  // setup JNDI
  EnvConfiguration envConfiguration = new EnvConfiguration();
  URL url = new File("path to jetty-env.xml").toURI().toURL();
  envConfiguration.setJettyEnvXml(url);
  webapp.setConfigurations(new Configuration[] {new WebInfConfiguration(), envConfiguration, new WebXmlConfiguration()});

  server.setHandler(webapp); 
  server.start();
  server.join();
}

代码示例来源:origin: com.github.skjolber.mockito-rest-spring/jetty

public Map<Class<?>, Object> add(List<Class<?>> mockTargetBeans, List<Class<?>> defaultContextBeans, URL url) throws Exception {
  WebAppContext webAppContext = new WebAppContext();
  webAppContext.setContextPath(url.getPath());
  MockitoSpringApplicationListener mockitoSpringConfiguration = new MockitoSpringApplicationListener(); 
  mockitoSpringConfiguration.setContextBeans(defaultContextBeans);
  mockitoSpringConfiguration.setMockTargetBeans(mockTargetBeans);
  JettyMockitoSpringConfiguration configuration = new JettyMockitoSpringConfiguration(mockitoSpringConfiguration);
  webAppContext.setConfigurations(new org.eclipse.jetty.webapp.Configuration[] { configuration });
  webAppContext.setParentLoaderPriority(true);
  Server server = new Server(url.getPort());
  server.setHandler(webAppContext);
  servers.add(server);
  server.start();
  return mockitoSpringConfiguration.getAll();
}

代码示例来源:origin: stackoverflow.com

context.setWar("src/main/webapp");
context.getMetaData().addContainerResource(new FileResource(new File("./target/classes").toURI()));
context.setConfigurations(new Configuration[]{
    new WebXmlConfiguration(),
    new AnnotationConfiguration()

代码示例来源:origin: stackoverflow.com

WebAppContext myWebAppContext= new WebAppContext();     
myWebAppContext.setConfigurations(new Configuration[] { new AnnotationConfiguration(), new WebInfConfiguration(),
      new WebXmlConfiguration(), new FragmentConfiguration(), new EnvConfiguration(), new PlusConfiguration(),
      new JettyWebXmlConfiguration() });

代码示例来源:origin: jenkinsci/jenkinsfile-runner

/**
 * Sets up Jetty without any actual TCP port serving HTTP.
 */
@Override
protected ServletContext createWebServer() throws Exception {
  QueuedThreadPool queuedThreadPool = new QueuedThreadPool(10);
  server = new Server(queuedThreadPool);
  WebAppContext context = new WebAppContext(bootstrap.warDir.getPath(), contextPath);
  context.setClassLoader(getClass().getClassLoader());
  context.setConfigurations(new Configuration[]{new WebXmlConfiguration()});
  context.addBean(new NoListenerConfiguration(context));
  server.setHandler(context);
  context.getSecurityHandler().setLoginService(configureUserRealm());
  context.setResourceBase(bootstrap.warDir.getPath());
  server.start();
  localPort = -1;
  setPluginManager(new PluginManagerImpl(context.getServletContext(), bootstrap.pluginsDir));
  return context.getServletContext();
}

代码示例来源:origin: stackoverflow.com

public class EmbedMe {
  public static void main(String[] args) throws Exception {
    int port = 8080;
    Server server = new Server(port);

    String wardir = "target/sample-webapp-1-SNAPSHOT";

    WebAppContext context = new WebAppContext();
    context.setResourceBase(wardir);
    context.setDescriptor(wardir + "WEB-INF/web.xml");
    context.setConfigurations(new Configuration[] {
        new AnnotationConfiguration(), new WebXmlConfiguration(),
        new WebInfConfiguration(), new TagLibConfiguration(),
        new PlusConfiguration(), new MetaInfConfiguration(),
        new FragmentConfiguration(), new EnvConfiguration() });

    context.setContextPath("/");
    context.setParentLoaderPriority(true);
    server.setHandler(context);
    server.start();
    server.join();
  }
}

代码示例来源:origin: io.jenkins.jenkinsfile-runner/setup

/**
 * Sets up Jetty without any actual TCP port serving HTTP.
 */
@Override
protected ServletContext createWebServer() throws Exception {
  QueuedThreadPool queuedThreadPool = new QueuedThreadPool(10);
  server = new Server(queuedThreadPool);
  WebAppContext context = new WebAppContext(bootstrap.warDir.getPath(), contextPath);
  context.setClassLoader(getClass().getClassLoader());
  context.setConfigurations(new Configuration[]{new WebXmlConfiguration()});
  context.addBean(new NoListenerConfiguration(context));
  server.setHandler(context);
  context.getSecurityHandler().setLoginService(configureUserRealm());
  context.setResourceBase(bootstrap.warDir.getPath());
  server.start();
  localPort = -1;
  setPluginManager(new PluginManagerImpl(context.getServletContext(), bootstrap.pluginsDir));
  return context.getServletContext();
}

代码示例来源:origin: jenkinsci/jenkins-test-harness

context.setConfigurations(new Configuration[]{new WebXmlConfiguration()});
context.addBean(new NoListenerConfiguration(context));
server.setHandler(context);

代码示例来源:origin: jenkinsci/jenkins-test-harness

context.setResourceBase(explodedWarDir.getPath());
context.setClassLoader(getClass().getClassLoader());
context.setConfigurations(new Configuration[]{new WebXmlConfiguration()});
context.addBean(new NoListenerConfiguration(context));
server.setHandler(context);

代码示例来源:origin: stackoverflow.com

webapp.setConfigurations(new Configuration[] { 
  new SelfConfiguration() 
});

代码示例来源:origin: com.carecon.fabric3/fabric3-container-web-jetty

private WebAppContext createWebAppContext(String contextPath, Map<String, List<Injector<?>>> injectors, List<URL> locations, ClassLoader parentClassLoader)
    throws IOException {
  WebAppContext context;
  if (locations.size() == 1) {
    context = new ManagedWebAppContext(locations.get(0).toExternalForm(), contextPath);
  } else {
    context = new ManagedWebAppContext(null, contextPath);
    // add the resource paths
    String[] paths = new String[locations.size()];
    for (int i = 0; i < locations.size(); i++) {
      URL location = locations.get(i);
      paths[i] = (location.toExternalForm());
    }
    ResourceCollection resources = new ResourceCollection(paths);
    context.setBaseResource(resources);
  }
  context.setParentLoaderPriority(true);
  InjectingDecorator decorator = new InjectingDecorator(injectors);
  context.getObjectFactory().addDecorator(decorator);
  WebAppClassLoader webAppClassLoader = new WebAppClassLoader(parentClassLoader, context);
  context.setClassLoader(webAppClassLoader);
  // don't extract the war since this has already been done by the WAR classpath processor
  context.setExtractWAR(false);
  Configuration[] configurations = createConfigurations();
  context.setConfigurations(configurations);
  return context;
}

代码示例来源:origin: org.fabric3/fabric3-container-web-jetty

private WebAppContext createWebAppContext(String contextPath, Map<String, List<Injector<?>>> injectors, List<URL> locations, ClassLoader parentClassLoader)
    throws IOException {
  WebAppContext context;
  if (locations.size() == 1) {
    context = new ManagedWebAppContext(locations.get(0).toExternalForm(), contextPath);
  } else {
    context = new ManagedWebAppContext(null, contextPath);
    // add the resource paths
    String[] paths = new String[locations.size()];
    for (int i = 0; i < locations.size(); i++) {
      URL location = locations.get(i);
      paths[i] = (location.toExternalForm());
    }
    ResourceCollection resources = new ResourceCollection(paths);
    context.setBaseResource(resources);
  }
  context.setParentLoaderPriority(true);
  InjectingDecorator decorator = new InjectingDecorator(injectors);
  context.getObjectFactory().addDecorator(decorator);
  WebAppClassLoader webAppClassLoader = new WebAppClassLoader(parentClassLoader, context);
  context.setClassLoader(webAppClassLoader);
  // don't extract the war since this has already been done by the WAR classpath processor
  context.setExtractWAR(false);
  Configuration[] configurations = createConfigurations();
  context.setConfigurations(configurations);
  return context;
}

代码示例来源:origin: com.enioka.jqm/jqm-service

webAppContext.setConfigurations(new Configuration[] { new WebInfConfiguration(), new WebXmlConfiguration(),
    new MetaInfConfiguration(), new FragmentConfiguration(), new AnnotationConfiguration() });

代码示例来源:origin: enioka/jqm

webAppContext.setConfigurations(new Configuration[] { new WebInfConfiguration(), new WebXmlConfiguration(),
    new MetaInfConfiguration(), new FragmentConfiguration(), new AnnotationConfiguration() });

代码示例来源:origin: apache/cxf

protected void run() {
  server = new Server(port);
  try {
    final WebAppContext context = new WebAppContext();
    context.setContextPath(contextPath);
    context.setConfigurations(new Configuration[] {
      new WebXmlConfiguration(),
      new AnnotationConfiguration()
    });
    for (final Resource resource: resources) {
      context.getMetaData().addContainerResource(resource);
    }
    configureContext(context);
    server.setHandler(context);
    configureServer(server);
    server.start();
  } catch (final Exception ex) {
    ex.printStackTrace();
    fail(ex.getMessage());
  }
}

代码示例来源:origin: jenkinsci/kubernetes-pipeline-plugin

context.setConfigurations(new Configuration[]{new WebXmlConfiguration()});
context.addBean(new NoListenerConfiguration(context));
server.setHandler(context);

相关文章

WebAppContext类方法