本文整理汇总了Java中javax.servlet.ServletRegistration.addMapping方法的典型用法代码示例。如果您正苦于以下问题:Java ServletRegistration.addMapping方法的具体用法?Java ServletRegistration.addMapping怎么用?Java ServletRegistration.addMapping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.servlet.ServletRegistration
的用法示例。
在下文中一共展示了ServletRegistration.addMapping方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: regiesterVIServlet
import javax.servlet.ServletRegistration; //导入方法依赖的package包/类
protected static final void regiesterVIServlet(ServletContext context,Logger logger){
try {
ServletRegistration.Dynamic asr = context.addServlet("VIApiServlet", VIApiServlet.class);
if (asr != null) {
asr.setLoadOnStartup(Integer.MAX_VALUE);
asr.addMapping("/@in/api/*");
} else {
logger.warn("Servlet VIApiServlet already exists");
}
ServletRegistration ssr = context.addServlet("VIHttpServlet", StaticContentServlet.class);
if (ssr != null) {
ssr.addMapping("/@in/*");
} else {
logger.warn("Servlet VIHttpServlet already exists");
}
}catch (Throwable e){
logger.error("VI register servlet failed",e);
}
}
示例2: addEndpointMappingToCasServlet
import javax.servlet.ServletRegistration; //导入方法依赖的package包/类
/**
* Add endpoint mapping to cas servlet.
*
* @param sce the sce
* @param mapping the mapping
*/
protected final void addEndpointMappingToCasServlet(final ServletContextEvent sce, final String mapping) {
logger.info("Adding [{}] to {} servlet context", mapping, WebUtils.CAS_SERVLET_NAME);
final ServletRegistration registration = getCasServletRegistration(sce);
if (registration != null) {
registration.addMapping(mapping);
logger.info("Added [{}] to {} servlet context", mapping, WebUtils.CAS_SERVLET_NAME);
}
}
示例3: init
import javax.servlet.ServletRegistration; //导入方法依赖的package包/类
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
//初始化相关类
HelperLoader.init();
//获取ServletContext对象,注册Servlet
ServletContext servletContext = config.getServletContext();
//处理JSP的Servlet
ServletRegistration jspServlet = servletContext.getServletRegistration("jsp");
jspServlet.addMapping(ConfigHelper.getAppJspPath() + "*");
//处理静态资源的默认Servlet
ServletRegistration defaultServlet = servletContext.getServletRegistration("default");
defaultServlet.addMapping(ConfigHelper.getAppAssetPath() + "*");
}
示例4: init
import javax.servlet.ServletRegistration; //导入方法依赖的package包/类
@Override
public void init(ServletConfig servletConfig) throws ServletException {
// 初始化相关Helper类
HelperLoader.init();
// 获取ServletContext对象(用于注册Servlet)
ServletContext servletContext = servletConfig.getServletContext();
// 注册处理jsp的servlet
ServletRegistration jspServlet = servletContext
.getServletRegistration("jsp");
jspServlet.addMapping(ConfigHelper.getAppJspPath() + "*");
// 注册处理静态资源的默认Servlet
ServletRegistration defaultServlet = servletContext
.getServletRegistration("default");
defaultServlet.addMapping(ConfigHelper.getAppAssetPath() + "*");
}
示例5: registerJspServlet
import javax.servlet.ServletRegistration; //导入方法依赖的package包/类
private void registerJspServlet(ServletContext context) {
ServletRegistration servletRegistration = context.getServletRegistration("jsp");
servletRegistration.addMapping("/index.jsp");
String jspPath = PropertiesProvider.getString(FrameworkConstant.JSP_PATH);
if (StringUtil.isNotEmpty(jspPath)) {
servletRegistration.addMapping(jspPath + "*");
}
}
示例6: registeJspServlet
import javax.servlet.ServletRegistration; //导入方法依赖的package包/类
/**
* 添加jsp映射
*/
@Deprecated
private void registeJspServlet(ServletContext context) {
ServletRegistration jspServlet = context.getServletRegistration("jsp");
jspServlet.addMapping("/index.jsp");
String jspPath = Constants.JSP_PATH_VALUE;
jspServlet.addMapping(jspPath + "*");
}
示例7: init
import javax.servlet.ServletRegistration; //导入方法依赖的package包/类
@Override
public void init(ServletConfig config) throws ServletException {
Loader.init();//初始化框架&应用
ServletContext sc = config.getServletContext();
//注册JSP的Servlet
ServletRegistration jspServlet = sc.getServletRegistration("jsp");
jspServlet.addMapping(ConfigHelper.getAppJspPath() + "*");
//注册处理静态资源的Servlet
ServletRegistration defaultServlet = sc.getServletRegistration("default");
defaultServlet.addMapping(ConfigHelper.getAppAssetPath() + "*");
}