zhyiwww
          用平實的筆,記錄編程路上的點點滴滴………
          posts - 536,comments - 394,trackbacks - 0
          <2010年9月>
          2930311234
          567891011
          12131415161718
          19202122232425
          262728293012
          3456789

          -------------------------------------------
          崇尚原創精神,
          文章歡迎轉載,
          請您注明出處,
          在此特別聲明。
          版權所有@zhyiwww
          引用鏈接
          http://www.aygfsteel.com/zhyiwww

          --------------------------------------------

          常用鏈接

          留言簿(33)

          隨筆分類(626)

          朋友的博客

          最新隨筆

          搜索

          •  

          積分與排名

          • 積分 - 1558687
          • 排名 - 11

          最新評論

          閱讀排行榜

          評論排行榜

             
          tomcat下basic授權的訪問配置
          【1】把下面的代碼放到你在自己項目的<web-app>下面

          <security-constraint>
                  <web-resource-collection>
                      <web-resource-name>Entire Application</web-resource-name>
                      <url-pattern>/*</url-pattern>
                   </web-resource-collection>
                  <!-- NOTE: This role is not present in the default users file -->
                  <auth-constraint>
                      <role-name>user</role-name>
                  </auth-constraint>

              </security-constraint>

              <!-- Define the Login Configuration for this Application -->
              <login-config>
                  <auth-method>BASIC</auth-method>
                  <realm-name>TEST ACCESS CONTROL</realm-name>
              </login-config>

          【2】在tomcat-user.xml里面,添加如下代碼
          <tomcat-users>
            <role rolename="user"/>
            <user username="xyz" password="xyz" roles="user"/>
          </tomcat-users>
          【3】重啟tomcat就可以了





          |----------------------------------------------------------------------------------------|
                                     版權聲明  版權所有 @zhyiwww
                      引用請注明來源 http://www.aygfsteel.com/zhyiwww   
          |----------------------------------------------------------------------------------------|
          posted on 2010-09-17 09:55 zhyiwww 閱讀(871) 評論(0)  編輯  收藏 所屬分類: j2ee
          主站蜘蛛池模板: 诸暨市| 凤翔县| 平阴县| 昂仁县| 河北区| 漯河市| 广河县| 定陶县| 固安县| 宜昌市| 广元市| 和政县| 东乡族自治县| 安顺市| 井研县| 县级市| 昆山市| 罗源县| 遂昌县| 宝山区| 壶关县| 秦安县| 沙湾县| 溆浦县| 洪湖市| 唐山市| 龙里县| 兰西县| 德钦县| 会昌县| 凉山| 林口县| 湄潭县| 苗栗县| 淮安市| 资兴市| 楚雄市| 绥德县| 元氏县| 锡林浩特市| 白水县|