本文整理匯總了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();
}
示例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;
}
示例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;
}
示例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;
}