普通网友 2012-12-13 11:38
浏览 165
已采纳

求正则,求方案------过滤非正规渠道访问文件。

比如以下为有效链接,除此以为均为无效链接。应该使用正则过滤还是有更好的方案?
/project/navi
/project/navi/default_3B.htm
/project/navi/library_not_exist.jsp
/project/navi/navi.jsp
/project/navi/navi_temp.jsp
/project/navi/others.jsp
/project/admin
/project/admin/blank.html
/project/admin/admin.jsp
/project/admin/details.jsp
/project/admin/userList.jsp
/project/bookmark
/project/bookmark/add_bookmark.jsp
/project/bookmark/add_success.jsp
/project/bookmark/bookmark.jsp
/project/bookmark/mark_edit.jsp
/project/note
/project/note/add_note.jsp
/project/note/add_success.jsp
/project/note/details.jsp
/project/note/feedback.jsp
/project/note/notes.jsp
/project/note/notesfile_error.jsp
/project/note/notes_edit.jsp
/project/note/notes_upload.jsp
/project/note/topicNoteDetail.jsp
/project/note/topicNoteEdit.jsp
/project/note/topic_note.jsp
/project/search
/project/search/advance_search_result.jsp
/project/search/adv_search_home.jsp
/project/search/adv_search_lib.jsp
/project/search/home_search_result.jsp
/project/search/index_not_exist.jsp
/project/search/keyword.jsp
/project/search/lib_search_result.jsp
/project/home
/project/home/details.jsp
/project/home/FFInvalid.jsp
/project/home/index.jsp
/project/home/lib_not_exist.jsp
/project/home/login.jsp
/project/common
/project/common/error.jsp
/project/common/header.jsp
/project/common/i18nLib.jsp
/project/ua
/project/ua/moreResults.jsp
/project/ua/navi.jsp
/project/ua/related.jsp
/project/ua/search.jsp
/project/ua/toc.jsp
/project/ua/tocContent.jsp
/project/ua/tocTop.jsp
/project/ua/top.jsp
/project/ua/ua.jsp
/project/ua/ua_navi.jsp
/project/upgrade
/project/upgrade/dbUpgradeWelcome.jsp

  • 写回答

1条回答 默认 最新

  • jinnianshilongnian 2012-12-13 11:59
    关注

    AntPathMatcher即可,适合做路径映射

    一般可以把这些配置在properties文件中,然后读取判断

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 x趋于0时tanx-sinx极限可以拆开算吗
  • ¥500 把面具戴到人脸上,请大家贡献智慧
  • ¥15 任意一个散点图自己下载其js脚本文件并做成独立的案例页面,不要作在线的,要离线状态。
  • ¥15 各位 帮我看看如何写代码,打出来的图形要和如下图呈现的一样,急
  • ¥30 c#打开word开启修订并实时显示批注
  • ¥15 如何解决ldsc的这条报错/index error
  • ¥15 VS2022+WDK驱动开发环境
  • ¥30 关于#java#的问题,请各位专家解答!
  • ¥30 vue+element根据数据循环生成多个table,如何实现最后一列 平均分合并
  • ¥20 pcf8563时钟芯片不启振