其他分享
首页 > 其他分享> > 06dwr - web.xml配置(多个 dwr.xml 配置和 J2EE 角色定义)

06dwr - web.xml配置(多个 dwr.xml 配置和 J2EE 角色定义)

作者:互联网

一般来说只需要一个 dwr.xml 文件,并且会被设为默认位置 WEB-INF/dwr.xml。所以你不需要配置。有 3 个原因说明你为何需要指定不同位置的 dwr.xml 文件:

<param-value>WEB-INF/classes/com/yourco/dwr/dwr.xml</param-value>

就像如下例子去使用:

 <init-param>
	 <param-name>config*****</param-name>
	 <param-value>WEB-INF/dwr.xml</param-value>
	 <description>What config file do we use?</description>
</init-param>

用一个字符串”config” 作为开始,设置 param-name,每个 param-name 必须不同。

<servlet>
	<servlet-name>dwr-user-invoker</servlet-name>
	<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
	<init-param>
		<param-name>config-user</param-name>
		<param-value>WEB-INF/dwr-user.xml</param-value>
	</init-param>
</servlet>

<servlet>
	<servlet-name>dwr-admin-invoker</servlet-name>
	<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
	<init-param>
			<param-name>config-admin</param-name>
			<param-value>WEB-INF/dwr-admin.xml</param-value>
	</init-param>
</servlet>
<servlet-mapping>
	<servlet-name>dwr-admin-invoker</servlet-name>
	<url-pattern>/dwradmin/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
	<servlet-name>dwr-user-invoker</servlet-name>
	<url-pattern>/dwruser/*</url-pattern>
</servlet-mapping>

<security-constraint>
	<display-name>dwr-admin</display-name>
	<web-resource-collection>
		<web-resource-name>dwr-admin-collection</web-resource-name>
    	<url-pattern>/dwradmin/*</url-pattern>
	</web-resource-collection>
	<auth-constraint>
		<role-name>admin</role-name>
	</auth-constraint>
</security-constraint>

<security-constraint>
	<display-name>dwr-user</display-name>
	<web-resource-collection>
		<web-resource-name>dwr-user-collection</web-resource-name>
		<url-pattern>/dwruser/*</url-pattern>
	</web-resource-collection>
	<auth-constraint>
		<role-name>user</role-name>
	</auth-constraint>
</security-constraint>

 

标签:xml,dwr,WEB,admin,web,user,config
来源: https://blog.51cto.com/u_15294985/3003627