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

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

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

WebAppContext.setExtraClasspath介绍

暂无

代码示例

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

@Override
public void addExtraJarsToClasspath(String extraClasspath) {
  extraClasspath = new StringBuilder(extraClasspath).append(",").append(systemEnvironment.configDir().getAbsoluteFile()).toString();
  webAppContext.setExtraClasspath(extraClasspath);
}

代码示例来源:origin: com.axway.ats.framework.agent.standalone/ats-agent-standalone-containerstarter

private static void setExtraClasspath( WebAppContext webApp, String jettyHome ) {
  final String lineSeparator = System.getProperty("line.separator");
  String jarFilesReference = getJarFilesReference(jettyHome + "/actions_dependencies");
  webApp.setExtraClasspath(jarFilesReference);
  log.debug("Additional libraries inserted into Jetty's classpath: " + lineSeparator
       + jarFilesReference.replaceAll(",;", lineSeparator));
}

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

@Override
public void start() throws Exception {
 // Set up the handler for the web application context.
 WebAppContext root = new WebAppContext();
 root.setExtraClasspath(extraClassPath);
 root.setDescriptor(new File(appDir, "WEB-INF/web.xml").getAbsolutePath());
 root.setWar(new File(appDir).getAbsolutePath());
 root.setContextPath(contextPath);
 root.setParentLoaderPriority(true);
 server.setHandler(root);
 server.start();
 System.out.println("Jetty server is started!");
}

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

WebAppContext context = new WebAppContext();
context.setContextPath("/");

switch (getOperationalMode())
{
  case PROD:
    // Configure as WAR
    context.setWar(basePath.toString());
    break;
  case DEV:
    // Configuring from Development Base
    context.setBaseResource(new PathResource(basePath.resolve("src/main/webapp")));
    // Add webapp compiled classes & resources (copied into place from src/main/resources)
    Path classesPath = basePath.resolve("target/thewebapp/WEB-INF/classes");
    context.setExtraClasspath(classesPath.toAbsolutePath().toString());
    break;
  default:
    throw new FileNotFoundException("Unable to configure WebAppContext base resource undefined");
}

代码示例来源:origin: pl.edu.icm.synat/synat-oai-server

public void startOAIServer() {
  
  server = new Server();
  
  final ServerConnector connector = new ServerConnector(server);
  connector.setPort(httpPort);
  
  server.setConnectors(new Connector[] {connector});
  
  final WebAppContext context = new WebAppContext();
  context.setDescriptor(descriptor);
  context.setContextPath("/");
  context.setParentLoaderPriority(true);
  context.setResourceBase(resourceBase);
  server.setHandler(context);
  
  context.setExtraClasspath(additionalResource);
  
  try {
    server.start();
  } catch (final Exception e) {
    logger.error("Exception reported", e);
  }
}

代码示例来源:origin: jenkinsci/maven-hpi-plugin

public void configureWebApplication() throws Exception {
  // Jetty tries to do this in WebAppContext.resolveWebApp but it failed to delete the directory.
  File t = webApp.getTempDirectory();
  if (t==null)    t = new File(getProject().getBuild().getDirectory(),"tmp");
  File extractedWebAppDir= new File(t, "webapp");
  if (isExtractedWebAppDirStale(extractedWebAppDir, webAppFile)) {
    FileUtils.deleteDirectory(extractedWebAppDir);
  }
  
  super.configureWebApplication();
  getWebAppConfig().setWar(webAppFile.getCanonicalPath());
  for (Artifact a : (Set<Artifact>) project.getArtifacts()) {
    if (a.getGroupId().equals("org.jenkins-ci.main") && a.getArtifactId().equals("jenkins-core")) {
      File coreBasedir = pluginWorkspaceMap.read(a.getId());
      if (coreBasedir != null) {
        String extraCP = new File(coreBasedir, "src/main/resources").toURI() + "," + new File(coreBasedir, "target/classes").toURI();
        getLog().info("Will load directly from " + extraCP);
        getWebAppConfig().setExtraClasspath(extraCP);
      }
    }
  }
  // cf. https://wiki.jenkins-ci.org/display/JENKINS/Jetty
  HashLoginService hashLoginService = (new HashLoginService("Jenkins Realm"));
  hashLoginService.setConfig(System.getProperty("jetty.home", "work") + "/etc/realm.properties");
  getWebAppConfig().getSecurityHandler().setLoginService(hashLoginService);
}

代码示例来源:origin: shentar/jAlbum

context.setExtraClasspath(extraPath.toString());

代码示例来源:origin: kumuluz/kumuluzee

appContext.setAttribute(JettyAttributes.jarPattern, ClasspathAttributes.jar);
appContext.setExtraClasspath(JettyJarClasspathUtil.getExtraClasspath(scanLibraries));

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

webAppContext.setExtraClasspath("conf/jqm.properties");
webAppContext.setInitParameter("jqmnode", node.getName());
webAppContext.setInitParameter("jqmnodeid", node.getId().toString());

代码示例来源:origin: pl.edu.icm.synat/synat-platform-integration-tests

public void start(boolean withMonitoring) {
  server.setConnectors(new Connector[] { connector });
  context.setContextPath("/");
  context.setParentLoaderPriority(true);
  String containerProjectPath = buildContainerProjectPath();
  String webXml = withMonitoring ? "web.xml" : "web-without-monitoring.xml";
  String descriptor = containerProjectPath + "/src/main/webapp/WEB-INF/" + webXml;
  String resourceBase = containerProjectPath + "/src/main/webapp";
  context.setDescriptor(descriptor);
  context.setResourceBase(resourceBase);
  server.setHandler(context);
  if (startDefaultServices) {
    context.setExtraClasspath(containerProjectPath + "/src/main/resources/");
  }
  try {
    server.start();
    webApplicationContext = (WebApplicationContext) context.getServletContext()
        .getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
    if (webApplicationContext instanceof ConfigurableApplicationContext) {
      ((ConfigurableApplicationContext) webApplicationContext).registerShutdownHook();
    }
  } catch (final Exception e) {
    logger.error("Exception reported", e);
  }
}

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

webAppContext.setExtraClasspath("conf/jqm.properties");
webAppContext.setInitParameter("jqmnode", node.getName());
webAppContext.setInitParameter("jqmnodeid", node.getId().toString());

代码示例来源:origin: org.apache.brooklyn/brooklyn-rest-server

/** NB: not fully supported; use one of the other {@link StartMode}s */
private WebAppContext webXmlContextHandler(ManagementContext mgmt) {
  RestApiSetup.initSwagger();
  WebAppContext context;
  if (findMatchingFile("src/main/webapp")!=null) {
    // running in source mode; need to use special classpath
    context = new WebAppContext("src/main/webapp", "/");
    context.setExtraClasspath("./target/classes");
  } else if (findRestApiWar()!=null) {
    context = new WebAppContext(findRestApiWar(), "/");
  } else {
    throw new IllegalStateException("Cannot find WAR for REST API. Expected in target/*.war, Maven repo, or in source directories.");
  }
  context.setAttribute(BrooklynServiceAttributes.BROOKLYN_MANAGEMENT_CONTEXT, mgmt);
  // TODO shutdown hook
  
  return context;
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

sb.append(url).append(",");
webapp.setExtraClasspath(sb.toString());

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

sb.append(url).append(",");
webapp.setExtraClasspath(sb.toString());

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

context.setExtraClasspath(executionPath);
context.setParentLoaderPriority(true);
context.setResourceBase(executionPath + webAppConfiguration.getConfig().webApp());

代码示例来源:origin: org.eclipse.jetty.osgi/jetty-osgi-boot

_webApp.setExtraClasspath(tmp);

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

sb.append(url).append(",");
webapp.setExtraClasspath(sb.toString());

代码示例来源:origin: nutzam/nutz-web

wac.setExtraClasspath(dc.getAppClasspath());
wac.setConfigurationDiscovered(true);
if (System.getProperty("os.name").toLowerCase().contains("windows")) {

相关文章

WebAppContext类方法