web.xml 模板

[code]<webapp>

<description>站台描述</discription>

<display-name>MyListeningApplication</display-name>

<!-- 指向web站台中某个小图标的路径,大小为16 X 16 pixel,GIF或JPEG格式,扩展名必须为:.gif或.jpg-->

<!-- 指向web站台中某个大图表路径,大小为32 X 32 pixel,GIF或JPEG的格式,扩展名必须为; gif或jpg-->

<icon>

<small-icon>/images/small.gif</small-icon>

<large-icon>/images/large.gir</large-icon>

</icon>



<!-- distributable 元素为空标签,它的存在与否可以指定站台是否可分布式处理.

如果web.xml中出现这个元素,则代表站台在开发时已经被设计为能在多个JSP Container 之间分散执行. -->

<distributable/>



<!-- context-param 元素用来设定web站台的环境参数(context) -->

<!-- getServletContext().getInitParamter("param_name"); -->

<context-param>

<param-name>param_name</param-name>

<param-value>param_value</param-value>

</context-param>




<filter>

<filter-name>Test Filter</filter-name>

<filter-class>com.alibaba.filter.testFilter</filter-class>

<init-param>

<param-name>Encodeing</param-name>

<param-value>GBK</param-value>

<param-name>timeout</param-name>

<param-value>90</param-value>

</init-param>

<filter-mapping>

<filter-name>Test Filter</filter-name>

<url-pattern>/*</url-pattern>

</filter-mapping>

</filter>



<listener>

<listener-class>com.acme.MyConnectionManager</listen-class>

</listener>

<listenrer>

<listener-class>com.acme.MyLoggingModele</listener-class>

</listener>



<servlet>

<display-name>MyServlet</display-name>

<servlet-name>MyServlet</servlet-name>

<servlet-class>com.mycorp.CatalogServlet</servlet-class>

<init-param>

<param-name>catalog</param-name>

<param-value>Spring</param-value>

</init-param>

</servlet>

<servlet-mapping>

<servlet-name>catalog</servlet-name>

<url-pattern>/catalog/*</url-pattern>

</servlet-mapping>



<!-- 定义首页的文件名,服务器会依照设定的顺序来找首页 -->

<welcome-file-list>

<welcome-file>index.jsp</welcome-file>

<welcome-file>index.htm</welcome-file>

</welcome-file-list>




<!-- 设置session 超时时间 ,单位 分-->

<session-config>

<session-timeout>20</session-timeout>

</session-config>



<!-- mime-mapping包含两个子元素extension和mime-type.定义某一个扩展名和某一MIME Type做对映 -->

<mime-mapping>

<extension>doc</extension>

<mime-type>application/vnd.ms-word</mime-type>

</mime-mapping>

<mime-mapping>

<extension>xls</extension>

<mime-type>application/vnd.ms-excel</mime-type>

</mime-mapping>

<mime-mapping>

<extension>ppt</extesnion>

<mime-type>application/vnd.ms-powerpoint</mime-type>

</mime-mapping>


<!-- 包含三个子元素error-code,exception-type和location -->

<!-- 将错误代码(Error Code)或异常(Exception)的种类对应 -->

<!-- 到web站台资源路径 -->

<error-page>

<error-code>404</error-code>

<location>/error404.jsp</location>

</error-page>

<error-page>

<exception-type>java.lang.Exception</exception-type>

<location>/except.jsp</location>

</error-page>



<!-- <description>说明</description> 资源说明

<rec-ref-name>资源名称</rec-ref-name>资源名称

<res-type>资源种类</res-type>资源种类

<res-auth>Application|Container</res-auth>资源由Application或Container来许可

<res-sharing-scope>Shareable|Unshareable</res-sharing-scope>资源是否可以共享.默认值为 Shareable

-->

<resource-ref>

<description>JNDI JDBC DataSource of JSPBook</description>

<res-ref-name>jdbc/sample_db</res-ref-name>

<res-type>javax.sql.DataSoruce</res-type>

<res-auth>Container</res-auth>

</resource-ref>

<!-- 安全登录控制 -->
<security-constraint>
<!-- 指定保护的资源 -->
<web-resource-coolection>
<web-resource-name>Proprietary</web-resource-name>
<url-pattern>/propritary/*</url-pattern>
</web-resource-coolection>
<!-- install_dir/conf/tomcat-users.xml将用户名与角色名和口令相关联 ,可按如下配置 -->
<!--
<tomcat-users>
<user name="joe" password="bigshot" roles="administrator,kahuna" />
<user name="jane" password="enaj" roles="kahuna" />
</tomcat-users>
-->
<auth-constraint>
<role-name>administrator</role-name>
<role-name>kahuna</role-name>
</auth-constraint>
<!--包含的值为 NONE、 INTEGRAL或CONFIDENTIAL -->
<!-- NONE值将对所用的通讯协议不加限制 -->
<!--INTEGRAL和CONFIDENTIAL 简单地要求用SSL -->
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>

<!-- -------------------------------------------- -->
<!-- 登录控制 -->
<login-config>
<auth-method> FORM </auth-method>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/login-error.jsp</form-error-page>
</form-login-config>
</login-config>
<!-- -------------------------------------------- -->
<!--调用 request.isUserInRole("boss") -->
<security-role-ref>
<role-name>boss</role-name> <!-- New alias -->
<role-link>manager</role-link> <!-- Real name -->
</security-role-ref>


</webapp>[/code]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值