本文整理汇总了Java中javax.servlet.ServletRegistration.Dynamic.setInitParameter方法的典型用法代码示例。如果您正苦于以下问题:Java Dynamic.setInitParameter方法的具体用法?Java Dynamic.setInitParameter怎么用?Java Dynamic.setInitParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.servlet.ServletRegistration.Dynamic
的用法示例。
在下文中一共展示了Dynamic.setInitParameter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initGitServlet
import javax.servlet.ServletRegistration.Dynamic; //导入方法依赖的package包/类
private void initGitServlet(Path gitWorkspace, ServletContext servletContext) throws IOException {
if (!Files.exists(gitWorkspace)) {
Files.createDirectories(gitWorkspace);
}
// add git servlet mapping
Dynamic gitServlet = servletContext.addServlet("git-servlet", new GitServlet());
gitServlet.addMapping("/git/*");
gitServlet.setInitParameter("base-path", gitWorkspace.toString());
gitServlet.setInitParameter("export-all", "true");
gitServlet.setAsyncSupported(true);
gitServlet.setLoadOnStartup(1);
}
示例2: registerCXFServlet
import javax.servlet.ServletRegistration.Dynamic; //导入方法依赖的package包/类
private static void registerCXFServlet(ServletContext servletContext) {
LOGGER.info("Registering CXF servlet...");
Dynamic dynamic =
servletContext.
addServlet(
"LDP4jFrontendServerServlet",
"org.apache.cxf.transport.servlet.CXFServlet");
dynamic.addMapping("/*");
/** See https://issues.apache.org/jira/browse/CXF-5068 */
dynamic.setInitParameter("disable-address-updates","true");
/** Required for testing */
dynamic.setInitParameter("static-welcome-file","/index.html");
dynamic.setInitParameter("static-resources-list","/index.html");
dynamic.setLoadOnStartup(1);
LOGGER.info("CXF servlet registered.");
}
示例3: contextInitialized
import javax.servlet.ServletRegistration.Dynamic; //导入方法依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent sce) {
ServletContext ctx = sce.getServletContext();
Dynamic servlet = ctx.addServlet("jersey", ServletContainer.class);
servlet.addMapping("/*");
servlet.setInitParameter("jersey.config.server.provider.classnames", TestServiceImpl.class.getName());
FilterRegistration.Dynamic filter = ctx.addFilter("origin", CrossOriginFilter.class);
filter.setInitParameter("allowedMethods", "GET,POST,PUT,DELETE");
filter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
}
示例4: customizeRegistration
import javax.servlet.ServletRegistration.Dynamic; //导入方法依赖的package包/类
@Override
protected void customizeRegistration(Dynamic registration) {
MultipartConfigElement multipartConfigElement = new MultipartConfigElement("");
registration.setMultipartConfig(multipartConfigElement);
registration.setInitParameter("dispatchOptionsRequest", "true");
registration.setAsyncSupported(true);
}
示例5: customizeRegistration
import javax.servlet.ServletRegistration.Dynamic; //导入方法依赖的package包/类
@Override
protected void customizeRegistration(Dynamic registration) {
registration.setInitParameter("throwExceptionIfNoHandlerFound", "true");
}
示例6: customizeRegistration
import javax.servlet.ServletRegistration.Dynamic; //导入方法依赖的package包/类
@Override
protected void customizeRegistration(Dynamic registration) {
registration.setInitParameter("dispatchOptionsRequest", "true");
registration.setAsyncSupported(true);
}