trouble with snaps filtering [message #667947] |
Mon, 02 May 2011 22:09 |
Eric Hough Messages: 14 Registered: July 2010 |
Junior Member |
|
|
Using Virgo 3.0.0.M03 and a freshly built copy of snaps. I'm having some trouble getting snaps to work they way I feel they should. Long post, so please bear with me! Here are the relevant configs...
Host bundle web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Root Servlet</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/META-INF/security.xml
/META-INF/osgi.xml
</param-value>
</context-param>
<!-- NOTE: my securityFilter config has a filter chain map with
<security:filter-chain pattern="/authenticate/**" filters="none" />
-->
<filter>
<filter-name>securityFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>securityFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>snaps-host-filter</filter-name>
<filter-class>org.eclipse.virgo.snaps.core.SnapHostFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>snaps-host-filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>contextClass</param-name>
<param-value>org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
Relevant pieces of host template.mf
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Root Servlet
Excluded-Exports: *
Web-ContextPath: /
Import-Bundle: org.eclipse.virgo.web.dm
Import-Package: org.eclipse.virgo.snaps.core"
...
snap's web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/META-INF/security.xml
/META-INF/osgi.xml
</param-value>
</context-param>
<filter>
<filter-name>securityFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>securityFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>contextClass</param-name>
<param-value>org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
relevant pieces of snap's template.mf
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Username / Password Login Servlet
Excluded-Exports: *
Import-Bundle: org.eclipse.virgo.web.dm
Import-Package: org.eclipse.virgo.snaps.core
...
Snap-Host: org.example.web.web-rootservlet
Snap-ContextPath: /authenticate
The snap and host find each other correctly when loaded into Virgo. Now, I would expect that when I navigate to http://localhost:8080/authenticate/ the following should occur:
- Host's securityFilter should examine request, match against /authenticate/** and thus apply no security filters.
- Host's snaps filter should run and delegate further request processing to snap at /authenticate
- Snap's securityFilter handles request
- Snap uses index.jsp of snap (as it's a welcome-file) to serve up content.
The actual sequence of events is really confusing to me. Here's the (commented) log of what happens when I make the request to http://localhost:8080/authenticate/
//First few lines are the host's security filter running. Good so far.
DEBUG org.springframework.security.web.FilterChainProxy:193 Converted URL to lowercase, from: '/authenticate/'; to: '/authenticate/'
DEBUG org.springframework.security.web.FilterChainProxy:200 Candidate is: '/authenticate/'; pattern is /authenticate/**; matched=true
DEBUG org.springframework.security.web.FilterChainProxy:158 /authenticate/ has an empty filter list
//Next bunch of lines is Snap handling. Maps the request to the static resource servlet, which seems wrong to me.
INFO org.eclipse.virgo.snaps.core.OsgiSnapRegistry:66 Snap 'org.eclipse.virgo.snaps.core.internal.webapp.WebAppSnap@72cae19' found for context path '/authenticate'
INFO org.eclipse.virgo.snaps.core.internal.webapp.container.StandardVirtualContainerRequestDispatcher:71 Servicing request 'null'
INFO org.eclipse.virgo.snaps.core.internal.webapp.url.ExtensionUrlPattern:38 Path '/authenticate/' does not match pattern 'jsp'
INFO org.eclipse.virgo.snaps.core.internal.webapp.url.DefaultUrlPattern:44 Path '/authenticate/' matches pattern '/'
INFO org.eclipse.virgo.snaps.core.internal.webapp.url.UrlPatternMatcher:75 Matched path '/authenticate/' with mapping '__resource-servlet'
INFO org.eclipse.virgo.snaps.core.internal.webapp.url.DefaultUrlPattern:62 Translated path '/authenticate' to '/'
INFO org.eclipse.virgo.snaps.core.internal.webapp.url.PathUrlPattern:38 Path '/authenticate/' matches pattern '/authenticate'
//Host's security filter running again for unknown reason
DEBUG org.springframework.security.web.FilterChainProxy:193 Converted URL to lowercase, from: '/authenticate/'; to: '/authenticate/'
DEBUG org.springframework.security.web.FilterChainProxy:200 Candidate is: '/authenticate/'; pattern is /authenticate/**; matched=true
DEBUG org.springframework.security.web.FilterChainProxy:158 /authenticate/ has an empty filter list
//Snaps again, this time trying to serve up a static resource from the snap at /authenticate/
INFO org.eclipse.virgo.snaps.core.internal.webapp.StaticResourceServlet:63 Resource / found
If, however, I request http://localhost:8080/authenticate/index.jsp, then things work differently:
//Host's security filter again. Good so far.
DEBUG org.springframework.security.web.FilterChainProxy:193 Converted URL to lowercase, from: '/authenticate/index.jsp'; to: '/authenticate/index.jsp'
DEBUG org.springframework.security.web.FilterChainProxy:200 Candidate is: '/authenticate/index.jsp'; pattern is /authenticate/**; matched=true
DEBUG org.springframework.security.web.FilterChainProxy:158 /authenticate/index.jsp has an empty filter list
//Snaps maps the request to jsp servlet, which is correct.
INFO org.eclipse.virgo.snaps.core.OsgiSnapRegistry:66 Snap 'org.eclipse.virgo.snaps.core.internal.webapp.WebAppSnap@72cae19' found for context path '/authenticate'
INFO org.eclipse.virgo.snaps.core.internal.webapp.container.StandardVirtualContainerRequestDispatcher:71 Servicing request 'null'
INFO org.eclipse.virgo.snaps.core.internal.webapp.url.ExtensionUrlPattern:36 Path '/authenticate/index.jsp' matches pattern 'jsp'
INFO org.eclipse.virgo.snaps.core.internal.webapp.url.UrlPatternMatcher:75 Matched path '/authenticate/index.jsp' with mapping '__jsp-servlet'
INFO org.eclipse.virgo.snaps.core.internal.webapp.url.ExtensionUrlPattern:47 Did not translate path '/authenticate/index.jsp'
INFO org.eclipse.virgo.snaps.core.internal.webapp.url.PathUrlPattern:38 Path '/authenticate/index.jsp' matches pattern '/authenticate'
//Host's security filter running again for unknown reason
DEBUG org.springframework.security.web.FilterChainProxy:193 Converted URL to lowercase, from: '/authenticate/index.jsp'; to: '/authenticate/index.jsp'
DEBUG org.springframework.security.web.FilterChainProxy:200 Candidate is: '/authenticate/index.jsp'; pattern is /authenticate/**; matched=true
DEBUG org.springframework.security.web.FilterChainProxy:158 /authenticate/index.jsp has an empty filter list
So my questions are
- Why is my snap's filter never handling the requests?
- Why is my host's securityFilter handling each request twice?
- What's the rationale behind snaps's default-web.xml?
- Is the "Servicing request 'null' " log statement normal?
- What am I doing wrong!??
Help?
[Updated on: Mon, 02 May 2011 22:11] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04155 seconds