我有我認爲是一個奇怪的問題。URL映射不適用於servlet
用同樣映射到一個servlet,一個網址的作品,以及其他沒有:
<servlet-mapping>
<servlet-name>UL_Admin</servlet-name>
<url-pattern>/universal_listings_administration/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Create_New_Site</servlet-name>
<url-pattern>/universal_listings_administration/sites/new_site/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Create_New_Site</servlet-name>
<url_pattern>/universal_listings_administration/sites/delete_site/*</url_pattern>
</servlet-mapping>
Create_New_Site工程/ universal_listings_administration /網站/ NEW_SITE/*而不是/ universal_listings_administration /網站/ delete_site/*
什麼時候去/ universal_listings_administration/sites/delete_site/*該網站只需轉到UL_Admin !!!
我已經改變了網址的順序,但得到了相同的結果。我在不同的瀏覽器上試過這個,認爲它可能是一個緩存問題,但每次都得到相同的結果。
有沒有人有任何關於這裏發生了什麼的想法?
我認爲它可能是唯一的另一件事是我的過濾器或什麼?我已經看了一下,但是一切看起來都可以正常使用濾鏡。反正這裏的web.xml中
<security-constraint>
<web-resource-collection>
<url-pattern>/universal_listings_administration/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<url-pattern>/jsps/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<url-pattern>/stylesheets/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<!-- Filters -->
<filter>
<!-- This filter defines all of the URIs on the site, to ensure easy to update URIs -->
<!-- All URIs defined here will be added to the request's Attributes -->
<!-- The URIs follow naming convention uri-name or uri-admin-name -->
<!-- For simplicity sake, do this only for client URIs (internal can be covered by eclipse!) -->
<filter-name>UriSettingFilter</filter-name>
<filter-class>nz.co.unilistings.control.UriAttributeSettingFilter</filter-class>
<init-param>
<param-name>uri-admin-portal</param-name>
<param-value>/universal_listings_administration/</param-value>
</init-param>
<init-param>
<param-name>uri-admin-new-site</param-name>
<param-value>/universal_listings_administration/sites/new_site/</param-value>
</init-param>
<init-param>
<param-name>uri-admin-delete-site</param-name>
<param-value>/universal_listings_administration/sites/delete_site/</param-value>
</init-param>
</filter>
<filter>
<filter-name>SubdomainFilter</filter-name>
<filter-class>nz.co.unilistings.control.SubdomainFilter</filter-class>
<init-param>
<description>Any subdomain with this value will go to the parent site</description>
<param-name>parent_site_subdomain</param-name>
<param-value>www</param-value>
</init-param>
<init-param>
<description>The URL of the parent site (where people can register)</description>
<param-name>parent_url</param-name>
<param-value>http://www.example.com:8888</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SubdomainFilter</filter-name>
<servlet-name>*</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>UriSettingFilter</filter-name>
<servlet-name>*</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
更新我的安全和過濾器設置:
我做了一些調試,我敢肯定,我會正確的URL,從網絡(複製,粘貼。 XML)和下面是我在請求得到,當它擊中第一個過濾器(比較create_site和delete_site:
create_site: http://www.example.com:8888/universal_listings_administration/sites/new_site/ _pathInfo: 「/」 _requestURI: 「/ universal_listings_administration /網站/ NEW_SITE /」 _servletPath:「/ univer sal_listings_administration /網站/ NEW_SITE」 _uri: 「/ universal_listings_administration /網站/ NEW_SITE /」
delete_site: http://www.example.com:8888/universal_listings_administration/sites/delete_site/ _pathInfo: 「/網站/ delete_site /」 _requestURI: 「/ universal_listings_administration /網站/ delete_site /」 _servletPath : 「/ universal_listings_administration」 _uri: 「/ universal_listings_administration /網站/ delete_site /」
現在我想我必須弄清楚爲什麼_pathInfo和_servletPath有很大的不同......