sprinvMVC路径拦截

时间:2023-11-15 10:38:50

关于这种路径的拦截:

http://localhost:8080/moodleCourse-tool/scorm/23681/mod_scorm/content/1/index_SCORM.html

一、用servlet,web.xml中<url-pattern>/</url-pattern>

二、用springmvc的动态url

@RequestMapping("/{contextid}/{component}/{filearea}/1/{filename}")
// @RequestMapping
public void player(@PathVariable String contextid,@PathVariable String component,
@PathVariable String filearea,@PathVariable String filename,HttpServletRequest request,
HttpServletResponse response){

三、用springmvc的url

@Controller
@RequestMapping("/scorm")
public class ScormController{ @Autowired
private ScormScoesService scormScoesService; @RequestMapping("/**")
public void player(HttpServletRequest request,HttpServletResponse response){

两个*拦截即可。