本文整理匯總了Java中org.mortbay.jetty.handler.ContextHandlerCollection.addHandler方法的典型用法代碼示例。如果您正苦於以下問題:Java ContextHandlerCollection.addHandler方法的具體用法?Java ContextHandlerCollection.addHandler怎麽用?Java ContextHandlerCollection.addHandler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.mortbay.jetty.handler.ContextHandlerCollection
的用法示例。
在下文中一共展示了ContextHandlerCollection.addHandler方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configureHandlers
import org.mortbay.jetty.handler.ContextHandlerCollection; //導入方法依賴的package包/類
private void configureHandlers(ContextHandlerCollection contexts)
{
// adding extra context handlers
Iterator handlersIterator = contextHandlers.iterator();
while (handlersIterator.hasNext())
{
ContextHandler contextHandler = (ContextHandler) handlersIterator.next();
contexts.addHandler(contextHandler);
}
}
示例2: doInitialize
import org.mortbay.jetty.handler.ContextHandlerCollection; //導入方法依賴的package包/類
protected void doInitialize()
{
super.doInitialize();
try
{
if( this.server == null) this.server = new Server();
HandlerCollection handlers = new HandlerCollection();
ContextHandlerCollection contexts = new ContextHandlerCollection();
handlers.setHandlers(new Handler[]{contexts,new DefaultHandler()});
server.setHandler(handlers);
this.adminCustomContext = new WebAppContext();
this.adminCustomContext.setWar(this.customAdministrationWar.stringValue());
this.adminCustomContext.setContextPath("/adminCustom");
this.adminCustomContext.setParentLoaderPriority(true);
contexts.addHandler(this.adminCustomContext);
if (this.adminCustomContext.isStarted()) this.adminCustomContext.start();
if( !this.server.isStarted() ) this.server.start();
}
catch (Exception e)
{
super.logError("Error creating AdministrationWebAppHandler!", e);
throw new StatusTransitionException("Error creating AdministrationWebAppHandler!", e);
}
}
示例3: HttpServer
import org.mortbay.jetty.handler.ContextHandlerCollection; //導入方法依賴的package包/類
public HttpServer(String name, String bindAddress, int port,
boolean findPort, Connector connector, Configuration conf,
String[] pathSpecs) throws IOException {
this.webServer = new Server();
this.findPort = findPort;
if (connector == null) {
listenerStartedExternally = false;
listener = createBaseListener(conf);
listener.setHost(bindAddress);
listener.setPort(port);
} else {
listenerStartedExternally = true;
listener = connector;
}
webServer.addConnector(listener);
SessionIdManager sessionIdManager = new HashSessionIdManager(new Random(System.currentTimeMillis()));
webServer.setSessionIdManager(sessionIdManager);
int maxThreads = conf.getInt("tajo.http.maxthreads", -1);
// If HTTP_MAX_THREADS is not configured, QueueThreadPool() will use the
// default value (currently 250).
QueuedThreadPool threadPool = maxThreads == -1 ? new QueuedThreadPool()
: new QueuedThreadPool(maxThreads);
webServer.setThreadPool(threadPool);
final String appDir = getWebAppsPath(name);
ContextHandlerCollection contexts = new ContextHandlerCollection();
webAppContext = new WebAppContext();
webAppContext.setDisplayName(name);
webAppContext.setContextPath("/");
webAppContext.setResourceBase(appDir + "/" + name);
webAppContext.setDescriptor(appDir + "/" + name + "/WEB-INF/web.xml");
contexts.addHandler(webAppContext);
webServer.setHandler(contexts);
addDefaultApps(contexts, appDir, conf);
}