【问题标题】:Apache shiro web application index page as default pageApache shiro Web 应用程序索引页面作为默认页面
【发布时间】:2014-03-01 10:30:27
【问题描述】:

我是 Apache Shiro Web 应用程序开发的新手。我的 web 目录中有一个 index.html,它作为 login.htm 的链接 我希望 index.html 成为我的默认页面,即当 url 类似于:
localhost:8080/myapp/ 要么 localhost:8080/myapp/index.html
它应该显示 index.html

如何使用 url 模式 /* 防止 shiro 过滤器。我的意思是 shiro 不能过滤或处理 index.html。
现在它继续重定向到 login.htm,原因很明显,因为它通常在 web.xml 和 shiro.ini 中配置

【问题讨论】:

    标签: java web-applications web.xml servlet-filters shiro


    【解决方案1】:

    将 index.html 设置为 web.xml 中的欢迎文件

    web.xml

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    

    在 shiro.ini 中允许匿名用户访问您的 index.html URL。 在您的 /* 条目之前为 index.html 提供一个条目

    [urls]
    
    /index.html = anon
    /*={your mapping}
    

    【讨论】:

      猜你喜欢
      • 2012-05-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-28
      • 2013-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多