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