當前位置: 首頁>>代碼示例>>Java>>正文


Java WebAppContext.setLogUrlOnStart方法代碼示例

本文整理匯總了Java中org.eclipse.jetty.webapp.WebAppContext.setLogUrlOnStart方法的典型用法代碼示例。如果您正苦於以下問題:Java WebAppContext.setLogUrlOnStart方法的具體用法?Java WebAppContext.setLogUrlOnStart怎麽用?Java WebAppContext.setLogUrlOnStart使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jetty.webapp.WebAppContext的用法示例。


在下文中一共展示了WebAppContext.setLogUrlOnStart方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: buildJetty

import org.eclipse.jetty.webapp.WebAppContext; //導入方法依賴的package包/類
public void buildJetty(int port, String sourceDir, String webXmlFile) throws Exception {
    server = new Server();

    SelectChannelConnector connector = new SelectChannelConnector();
    connector.setPort(port);
    server.addConnector(connector);
    WebAppContext context = new WebAppContext();
    context.setResourceBase(sourceDir);
    context.setDescriptor(sourceDir + "/WEB-INF/" + webXmlFile);
    context.setLogUrlOnStart(true);
    context.setContextPath("/");
    context.setParentLoaderPriority(true);

    server.setHandler(context);

    server.start();
}
 
開發者ID:hazelcast,項目名稱:hazelcast-wm,代碼行數:18,代碼來源:JettyServer.java

示例2: configure

import org.eclipse.jetty.webapp.WebAppContext; //導入方法依賴的package包/類
@Override
public Server configure() throws Exception {
    Server server = new Server(port);

    WebAppContext context = new WebAppContext();
    context.setResourceBase("../jetty-core/src/test/resources/" + appName);
    context.setLogUrlOnStart(true);
    context.setContextPath("/");
    context.setParentLoaderPriority(true);

    HazelcastSessionIdManager idManager = new HazelcastSessionIdManager(server, clientOnly);
    idManager.setWorkerName("worker-" + port);
    server.setSessionIdManager(idManager);

    HazelcastSessionManager sessionManager = new HazelcastSessionManager();
    sessionManager.setSessionIdManager(idManager);

    SessionHandler handler = new SessionHandler(sessionManager);
    context.setSessionHandler(handler);

    server.setHandler(context);
    server.setStopTimeout(0);

    HashLoginService loginService = new HashLoginService();
    loginService.putUser("someuser", Credential.getCredential("somepass"), new String[]{"role1", "role2"});
    context.getSecurityHandler().setLoginService(loginService);

    return server;
}
 
開發者ID:hazelcast,項目名稱:hazelcast-jetty-sessionmanager,代碼行數:30,代碼來源:JettyConfigurator.java

示例3: configure

import org.eclipse.jetty.webapp.WebAppContext; //導入方法依賴的package包/類
@Override
public Server configure() throws Exception {
    Server server = new Server(port);

    WebAppContext context = new WebAppContext();
    context.setResourceBase("../jetty-core/src/test/resources/" + appName);
    context.setLogUrlOnStart(true);
    context.setContextPath("/");
    context.setParentLoaderPriority(true);

    HazelcastSessionIdManager idManager = new HazelcastSessionIdManager(server, clientOnly);

    idManager.setWorkerName("worker-" + port);
    server.setSessionIdManager(idManager);

    HazelcastSessionManager sessionManager = new HazelcastSessionManager();
    sessionManager.setSessionIdManager(idManager);

    SessionHandler handler = new SessionHandler(sessionManager);
    context.setSessionHandler(handler);

    server.setHandler(context);
    server.setGracefulShutdown(0);

    HashLoginService loginService = new HashLoginService();
    loginService.putUser("someuser", Credential.getCredential("somepass"), new String[]{"role1", "role2"});
    context.getSecurityHandler().setLoginService(loginService);

    return server;
}
 
開發者ID:hazelcast,項目名稱:hazelcast-jetty-sessionmanager,代碼行數:31,代碼來源:JettyConfigurator.java

示例4: setupWebapp

import org.eclipse.jetty.webapp.WebAppContext; //導入方法依賴的package包/類
/**
 * This method is called to setup the application, it prepares the
 * application context, defines your web.xml and override-web.xml etc ...
 * This is basically what makes your application behave as if it was
 * deployed in a full fledged standard container ...
 *
 * @return WebAppContext
 */
private static WebAppContext setupWebapp() {
    ProtectionDomain domain = JServer.class.getProtectionDomain();
    URL location = domain.getCodeSource().getLocation();
    WebAppContext webapp = new WebAppContext();
    webapp.setContextPath("/");
    webapp.setLogUrlOnStart(true);
    webapp.setParentLoaderPriority(true);
    webapp.setWar(location.toExternalForm());
    webapp.setDescriptor("WEB-INF/web.xml");
    webapp.setOverrideDescriptor("WEB-INF/override-web.xml");
    webapp.prependServerClass("-org.eclipse.jetty.servlet.,-org.eclipse.jetty.server."); //TODO: too much exposure, check which classes are needed.
    webapp.setServer(embed_server);
    return webapp;
}
 
開發者ID:korena,項目名稱:service-base,代碼行數:23,代碼來源:JServer.java


注:本文中的org.eclipse.jetty.webapp.WebAppContext.setLogUrlOnStart方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。