コード例 #1
0
 private void cleanUpContexts() {
   for (Map.Entry<String, JettyHttpContext> stringJettyHttpContextEntry : _contexts.entrySet()) {
     JettyHttpContext context = stringJettyHttpContextEntry.getValue();
     _server.removeBean(context.getJettyContextHandler());
   }
   _contexts.clear();
 }
コード例 #2
0
  @Override
  public HttpContext createContext(String path, HttpHandler handler) {
    checkIfContextIsFree(path);

    JettyHttpContext context = new JettyHttpContext(this, path, handler);
    J2SE6ContextHandler jettyContextHandler = context.getJettyContextHandler();
    _contextCollection.addHandler(jettyContextHandler);

    return context;
  }
コード例 #3
0
  @Override
  public HttpContext createContext(String path, HttpHandler httpHandler) {
    checkIfContextIsFree(path);

    JettyHttpContext context = new JettyHttpContext(this, path, httpHandler);
    HttpSpiContextHandler jettyContextHandler = context.getJettyContextHandler();

    ContextHandlerCollection chc = findContextHandlerCollection(_server.getHandlers());
    if (chc == null)
      throw new RuntimeException("could not find ContextHandlerCollection, you must configure one");

    chc.addHandler(jettyContextHandler);
    _contexts.put(path, context);

    return context;
  }
コード例 #4
0
 @Override
 public void removeContext(String path) throws IllegalArgumentException {
   JettyHttpContext context = _contexts.remove(path);
   if (context == null) return;
   _server.removeBean(context.getJettyContextHandler());
 }