本文整理匯總了Java中org.eclipse.jetty.servlet.ServletHolder.setInitParameters方法的典型用法代碼示例。如果您正苦於以下問題:Java ServletHolder.setInitParameters方法的具體用法?Java ServletHolder.setInitParameters怎麽用?Java ServletHolder.setInitParameters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jetty.servlet.ServletHolder
的用法示例。
在下文中一共展示了ServletHolder.setInitParameters方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addServlet
import org.eclipse.jetty.servlet.ServletHolder; //導入方法依賴的package包/類
public void addServlet(String path, Class<? extends Servlet> servlet, Map<String, String> initParameters) {
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath(path);
ServletHolder holder = new ServletHolder(servlet);
holder.setInitParameters(initParameters);
context.addServlet(holder, path);
handlers.add(context);
}
示例2: addJspServlet
import org.eclipse.jetty.servlet.ServletHolder; //導入方法依賴的package包/類
/**
* Add Jetty's {@code JspServlet} to the given {@link WebAppContext}.
* @param context the jetty {@link WebAppContext}
*/
protected final void addJspServlet(WebAppContext context) {
Assert.notNull(context, "Context must not be null");
ServletHolder holder = new ServletHolder();
holder.setName("jsp");
holder.setClassName(getJspServlet().getClassName());
holder.setInitParameter("fork", "false");
holder.setInitParameters(getJspServlet().getInitParameters());
holder.setInitOrder(3);
context.getServletHandler().addServlet(holder);
ServletMapping mapping = new ServletMapping();
mapping.setServletName("jsp");
mapping.setPathSpecs(new String[] { "*.jsp", "*.jspx" });
context.getServletHandler().addServletMapping(mapping);
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:19,代碼來源:JettyEmbeddedServletContainerFactory.java
示例3: addServlet
import org.eclipse.jetty.servlet.ServletHolder; //導入方法依賴的package包/類
/**
* Add a servlet to the servlet registry. This servlet will be attached to the
* specified URL pattern when the server is started up.
*
* @param urlPattern the URL pattern for paths. Eg, '/foo', '/foo/*'.
* @param servlet the servlet class to bind to the specified paths.
* @param initParams the map with init params, can be null or empty.
* @return the {@link ServletHolder} that holds the servlet.
*/
public ServletHolder addServlet(String urlPattern, Class<? extends HttpServlet> servlet,
@Nullable Map<String, String> initParams) {
ServletHolder servletHolder = new ServletHolder(servlet);
if (initParams != null) {
servletHolder.setInitParameters(initParams);
}
servletRegistry.add(new Pair<>(urlPattern, servletHolder));
return servletHolder;
}