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

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

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

WebAppContext.start介绍

暂无

代码示例

代码示例来源:origin: Dreampie/Resty

public void restartWebApp() throws Exception {
  webAppContext.stop();
  logger.info("JettyServer restart...");
  webAppContext.start();
 }
}

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

httpServer.start();
} else {
 webapp.start();

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

@ManagementOperation(description = "Start the web app")
public void startWebApp() throws Exception {
  super.start();
}

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

@ManagementOperation(description = "Start the web app")
public void startWebApp() throws Exception {
  super.start();
}

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

String webroot = getWarRootPath();
WebAppContext webapp = new WebAppContext(webroot, "/");
server.setHandler(webapp);

scanner.setMonitorDirectory(webroot);
scanner.addListener(this);

...

public void onScannerEvent(ScannerEvent evt) {
  if(!evt.path.isFile()) {
    return; // no point restarting on directory only event
  }
  webapp.stop();
  if(evt.isNew() || evt.wasDeleted()) {
    reconfigureScanner();
  }
  webapp.start();
}

代码示例来源:origin: com.github.sogyf/goja-jfinal

public void onChange() {
    try {
      System.err.println("\nLoading changes ......");
      webApp.stop();
      JFinalClassLoader loader = new JFinalClassLoader(webApp, getClassPath());
      webApp.setClassLoader(loader);
      webApp.start();
      System.err.println("Loading complete.");
    } catch (Exception e) {
      System.err.println("Error reconfiguring/restarting webapp after change in watched files");
      e.printStackTrace();
    }
  }
};

代码示例来源:origin: com.cybermkd/ICEREST

public void onChange() {
    try {
      System.err.println("\nLoading changes ......");
      webApp.stop();
      IceRestClassLoader loader = new IceRestClassLoader(webApp, getClassPath());
      webApp.setClassLoader(loader);
      webApp.start();
      System.err.println("Loading complete.");
    } catch (Exception e) {
      System.err.println("Error reconfiguring/restarting webapp after change in watched files");
      logger.error(e.getMessage(), e);
    }
  }
};

代码示例来源:origin: T-baby/ICERest

public void onChange() {
    try {
      System.err.println("\nLoading changes ......");
      webApp.stop();
      IceRestClassLoader loader = new IceRestClassLoader(webApp, getClassPath());
      webApp.setClassLoader(loader);
      webApp.start();
      System.err.println("Loading complete.");
    } catch (Exception e) {
      System.err.println("Error reconfiguring/restarting webapp after change in watched files");
      logger.error(e.getMessage(), e);
    }
  }
};

代码示例来源:origin: com.jfinal/jetty-server

public void onChange() {
    try {
      System.err.println("\nLoading changes ......");
      webApp.stop();
      JFinalClassLoader loader = new JFinalClassLoader(webApp, getClassPath());
      webApp.setClassLoader(loader);
      webApp.start();
      System.err.println("Loading complete (^_^)");
    } catch (Exception e) {
      System.err.println("Error reconfiguring/restarting webapp after change in watched files");
      LogKit.error(e.getMessage(), e);
    }
  }
};

代码示例来源:origin: io.brooklyn/brooklyn-launcher

public synchronized void updateHandler(WebAppContext context) throws Exception {
  Handler[] hl0 = getHandlers();
  List<Handler> hl = hl0!=null ? new ArrayList<Handler>(Arrays.asList(hl0)) : new ArrayList<Handler>();
  // remove any previous version
  removeContextFromList(hl, context.getContextPath());
  // have to add before the root war (remove root war then add back)
  Handler oldRoot = removeContextFromList(hl, "/");
  // now add and add back any root
  hl.add(context);
  if (oldRoot!=null) hl.add(oldRoot);
  setHandlers(hl.toArray(new Handler[0]));
  
  // and if we are already running, start the new context
  if (isRunning()) {
    context.start();
  }
}

代码示例来源:origin: jenkinsci/winstone

public void reloadWebApp(String prefix) {
  WebAppContext webApp = this.webapps.get(prefix);
  if (webApp != null) {
    try {
      webApp.stop();
      webApp.start();
    } catch (Exception e) {
      throw new WinstoneException("Failed to redeploy "+prefix,e);
    }
  } else {
    throw new WinstoneException(Launcher.RESOURCES.getString("HostConfig.PrefixUnknown", prefix));
  }
}

代码示例来源:origin: fabric8io/jube

private static void createWebapp(HandlerCollection handlers, Set<String> foundURLs, Integer port, String war) {
  if (foundURLs.add(war)) {
    String contextPath = createContextPath(war);
    String filePath = createFilePath(war);
    if (contextPath.equals("hawtio")) {
      System.out.println();
      System.out.println("==================================================");
      System.out.println("hawtio is running on http://" + ApiMasterService.getHostName() + ":" + port + "/" + contextPath + "/");
      System.out.println("==================================================");
      System.out.println();
      hawtioEnabled = true;
    } else {
      System.out.println("adding web context path: /" + contextPath + " war: " + filePath);
    }
    WebAppContext webapp = new WebAppContext();
    webapp.setContextPath("/" + contextPath);
    webapp.setWar("file://" + filePath);
    handlers.addHandler(webapp);
    webapp.setThrowUnavailableOnStartupException(true);
    try {
      System.out.println("Starting web app: " + contextPath);
      webapp.start();
      System.out.println("Started web app: " + contextPath + " without any exceptions!");
    } catch (Throwable e) {
      logException(e);
    }
  }
}

代码示例来源:origin: com.github.dactiv/dactiv-common

/**
   * 快速重新启动application,重载target/classes与target/test-classes.
   */
  public static void reloadContext(Server server) throws Exception {
    WebAppContext context = (WebAppContext) server.getHandler();

    System.out.println("[INFO] Application reloading");
    context.stop();

    WebAppClassLoader classLoader = new WebAppClassLoader(context);
    classLoader.addClassPath("target/classes");
    classLoader.addClassPath("target/test-classes");
    context.setClassLoader(classLoader);

    context.start();

    System.out.println("[INFO] Application reloaded");
  }
}

代码示例来源:origin: org.terracotta/terracotta-l1-ee

restContext.start();

代码示例来源:origin: com.github.sakserv/hadoop-mini-clusters-knox

private synchronized void internalActivateArchive(Topology topology, File warDir) throws IOException, ZipException, ParserConfigurationException, TransformerException, SAXException {
  log.activatingTopologyArchive(topology.getName(), warDir.getName());
  try {
    WebAppContext newContext = createWebAppContext(topology, warDir, Urls.decode(warDir.getName()));
    WebAppContext oldContext = deployments.get(newContext.getContextPath());
    deployments.put(newContext.getContextPath(), newContext);
    if (oldContext != null) {
      contexts.removeHandler(oldContext);
    }
    contexts.addHandler(newContext);
    if (contexts.isRunning() && !newContext.isRunning()) {
      newContext.start();
    }
  } catch (Exception e) {
    auditor.audit(Action.DEPLOY, topology.getName(), ResourceType.TOPOLOGY, ActionOutcome.FAILURE);
    log.failedToDeployTopology(topology.getName(), e);
  }
}

代码示例来源:origin: org.apache.knox/gateway-server

private synchronized void internalActivateArchive( Topology topology, File warDir ) throws IOException, ZipException, ParserConfigurationException, TransformerException, SAXException {
 log.activatingTopologyArchive( topology.getName(), warDir.getName() );
 try {
  WebAppContext newContext = createWebAppContext( topology, warDir, Urls.decode( warDir.getName() ) );
  WebAppContext oldContext = deployments.get( newContext.getContextPath() );
  deployments.put( newContext.getContextPath(), newContext );
  if( oldContext != null ) {
   contexts.removeHandler( oldContext );
  }
  contexts.addHandler( newContext );
  if( contexts.isRunning() && !newContext.isRunning() ) {
   newContext.start();
   if(!newContext.isAvailable()) {
    throw newContext.getUnavailableException();
   }
  }
 } catch( Throwable e ) {
  auditor.audit( Action.DEPLOY, topology.getName(), ResourceType.TOPOLOGY, ActionOutcome.FAILURE );
  log.failedToDeployTopology( topology.getName(), e );
 }
}

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

private synchronized void internalActivateArchive( Topology topology, File warDir ) {
 log.activatingTopologyArchive( topology.getName(), warDir.getName() );
 try {
  WebAppContext newContext = createWebAppContext( topology, warDir, Urls.decode( warDir.getName() ) );
  WebAppContext oldContext = deployments.get( newContext.getContextPath() );
  deployments.put( newContext.getContextPath(), newContext );
  if( oldContext != null ) {
   contexts.removeHandler( oldContext );
  }
  contexts.addHandler( newContext );
  if( contexts.isRunning() && !newContext.isRunning() ) {
   newContext.start();
   if(!newContext.isAvailable()) {
    throw newContext.getUnavailableException();
   }
  }
 } catch( Throwable e ) {
  auditor.audit( Action.DEPLOY, topology.getName(), ResourceType.TOPOLOGY, ActionOutcome.FAILURE );
  log.failedToDeployTopology( topology.getName(), e );
 }
}

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

context.start();

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

context.start();

代码示例来源:origin: org.jboss.arquillian.container/arquillian-jetty-embedded-7

wctx.start();
webAppContextProducer.set(wctx);
servletContextInstanceProducer.set(wctx.getServletContext());

相关文章

微信公众号

最新文章

更多

WebAppContext类方法