本文整理汇总了Java中org.eclipse.jetty.servlet.ServletContextHandler.setInitParameter方法的典型用法代码示例。如果您正苦于以下问题:Java ServletContextHandler.setInitParameter方法的具体用法?Java ServletContextHandler.setInitParameter怎么用?Java ServletContextHandler.setInitParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jetty.servlet.ServletContextHandler
的用法示例。
在下文中一共展示了ServletContextHandler.setInitParameter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
public static void main(String[] args) {
int port = Configuration.INSTANCE.getInt("port", 8080);
Server server = new Server(port);
ServletContextHandler contextHandler
= new ServletContextHandler(ServletContextHandler.SESSIONS);
contextHandler.setContextPath("/");
ServletHolder sh = new ServletHolder(new VaadinServlet());
contextHandler.addServlet(sh, "/*");
contextHandler.setInitParameter("ui", AnalysisUI.class.getCanonicalName());
contextHandler.setInitParameter("productionMode", String.valueOf(PRODUCTION_MODE));
server.setHandler(contextHandler);
try {
server.start();
server.join();
} catch (Exception e) {
LOG.error("Failed to start application", e);
}
}
示例2: main
import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
public static void main(String[] args) {
int port = Configuration.INSTANCE.getInt("port", 8080);
Server server = new Server(port);
ServletContextHandler contextHandler
= new ServletContextHandler(ServletContextHandler.SESSIONS);
contextHandler.setContextPath("/");
ServletHolder sh = new ServletHolder(new VaadinServlet());
contextHandler.addServlet(sh, "/*");
contextHandler.setInitParameter("ui", CrawlerAdminUI.class.getCanonicalName());
contextHandler.setInitParameter("productionMode", String.valueOf(PRODUCTION_MODE));
server.setHandler(contextHandler);
try {
server.start();
server.join();
} catch (Exception e) {
LOG.error("Failed to start application", e);
}
}
示例3: setWebSocketComponentServletInitialParameter
import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
protected void setWebSocketComponentServletInitialParameter(ServletContextHandler context, WebsocketEndpoint endpoint) {
if (endpoint.getBufferSize() != null) {
context.setInitParameter("bufferSize", endpoint.getBufferSize().toString());
}
if (endpoint.getMaxIdleTime() != null) {
context.setInitParameter("maxIdleTime", endpoint.getMaxIdleTime().toString());
}
if (endpoint.getMaxTextMessageSize() != null) {
context.setInitParameter("maxTextMessageSize", endpoint.getMaxTextMessageSize().toString());
}
if (endpoint.getMaxBinaryMessageSize() != null) {
context.setInitParameter("maxBinaryMessageSize", endpoint.getMaxBinaryMessageSize().toString());
}
if (endpoint.getMinVersion() != null) {
context.setInitParameter("minVersion", endpoint.getMinVersion().toString());
}
}
示例4: main
import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Server server = new Server(8080);
ServletContextHandler handler = new ServletContextHandler();
handler.setContextPath("/");
handler.setInitParameter("contextConfigLocation", "classpath*:spring-mvc.xml");
ServletHolder servletHolder = new ServletHolder();
servletHolder.setInitOrder(1);
servletHolder.setHeldClass(DispatcherServlet.class);
servletHolder.setInitParameter("contextConfigLocation", "classpath*:spring-mvc.xml");
handler.addServlet(servletHolder, "/");
server.setHandler(handler);
server.start();
server.join();
}
示例5: main
import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
new Thread(new Crawler()).start();// hourly
JodelWebConfiguration conf;
if (args.length != 1) {
InputStream ins;
File confFile = new File("conf/jodel.properties");
if (confFile.exists()) {
ins = new FileInputStream(confFile);
} else {
ins = Launcher.class.getResourceAsStream("jodel.properties");
}
conf = new JodelWebConfiguration(ins);
} else {
conf = new JodelWebConfiguration(new FileInputStream(new File(
args[0])));
}
DatabaseConnection.init(conf);
Server s = new Server(new InetSocketAddress(conf.getHostName(),
conf.getPort()));
((QueuedThreadPool) s.getThreadPool()).setMaxThreads(20);
ServletContextHandler h = new ServletContextHandler(
ServletContextHandler.SESSIONS);
h.setInitParameter(SessionManager.__SessionCookieProperty, "Jodel-Session");
h.addServlet(JodelWeb.class, "/*");
HandlerList hl = new HandlerList();
hl.setHandlers(new Handler[] { generateStaticContext(), h });
s.setHandler(hl);
s.start();
}
示例6: main
import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
LiteWaveWebConfigurator conf;
if (args.length != 1) {
InputStream ins;
File confFile = new File("conf/litewave.properties");
ins = new FileInputStream(confFile);
conf = new LiteWaveWebConfigurator(ins);
} else {
conf = new LiteWaveWebConfigurator(new FileInputStream(new File(
args[0])));
}
DatabaseConnection.init(conf);
Server s = new Server(new InetSocketAddress(conf.getHostName(),
conf.getPort()));
System.out.println("start Server");
((QueuedThreadPool) s.getThreadPool()).setMaxThreads(20);
ServletContextHandler h = new ServletContextHandler(
ServletContextHandler.SESSIONS);
h.setInitParameter(SessionManager.__SessionCookieProperty, "DB-Session");
h.addServlet(LiteWaveMain.class, "/*");
HandlerList hl = new HandlerList();
hl.setHandlers(new Handler[] { generateStaticContext(), h });
s.setHandler(hl);
s.start();
//For intel systems (OmniDriver Initialization
/*
ExecutorService executor = Executors.newSingleThreadExecutor();
try {
executor.submit(new InitSpectrometer()).get(1800, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e1) {
System.out.println("Timeout: USB driver not Initialized");
e1.printStackTrace();
} // Timeout of 10 minutes.
executor.shutdown(); */
}