Hi Luke,
So I found out some more info. So basically the problem why all my css/js files are getting 404's is because of my servlet-mapping. I have the following in my web.xml.
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Now so any page that comes in, it sends to the DispatcherServlet, this includes css and js files. I can put another servlet mapping for the default for say /css/** but I'd rather let acegi deal with in.
I have the following FilterChainProxy:
<!-- This file handle the security configuration management provided by Acegisecurity -->
<bean id="filterChainProxy" class="org.acegisecurity.util.FilterChainProxy">
<property name="filterInvocationDefinitionSource">
<value>
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
PATTERN_TYPE_APACHE_ANT
/css/**=#NONE# /**=httpSessionContextIntegrationFilter,logoutFilte r,casProcessingFilter,anonymousProcessingFilter,se curityContextHolderAwareRequestFilter,exceptionTra nslationFilter,filterInvocationInterceptor
</value>
</property>
</bean>
The problem is this "excpetion" to the proxychain is not being picked up. In my debug statements I get:
Code:
2009-03-13 16:58:32,241 [DEBUG] org.acegisecurity.intercept.web.PathBasedFilterInvocationDefinitionMap - Candidate is: '/css/test.css'; pattern is /css/**; matched=true
2009-03-13 16:58:32,241 [DEBUG] org.hibernate.jdbc.AbstractBatcher - preparing statement
2009-03-13 16:58:32,242 [DEBUG] org.hibernate.type.StringType - binding 'anonymous' to parameter: 1
2009-03-13 16:58:32,242 [DEBUG] org.springframework.orm.hibernate3.support.OpenSessionInViewFilter - Opening single Hibernate Session in OpenSessionInViewFilter
2009-03-13 16:58:32,242 [DEBUG] org.springframework.orm.hibernate3.SessionFactoryUtils - Opening Hibernate Session
2009-03-13 16:58:32,242 [DEBUG] org.hibernate.impl.SessionImpl - opened session at timestamp: 12369887122
2009-03-13 16:58:32,242 [DEBUG] org.hibernate.impl.SessionImpl - setting flush mode to: NEVER
2009-03-13 16:58:32,242 [DEBUG] org.springframework.transaction.support.TransactionSynchronizationManager - Bound value [org.springframework.orm.hibernate3.SessionHolder@8d26dd] for key [org.hibernate.impl.SessionFactoryImpl@1ec73d9] to thread [http-8443-2]
2009-03-13 16:58:32,242 [DEBUG] org.acegisecurity.intercept.web.PathBasedFilterInvocationDefinitionMap - Converted URL to lowercase, from: '/test/css/test.css'; to: '/test/css/test.css'
2009-03-13 16:58:32,241 [DEBUG] org.acegisecurity.util.FilterChainProxy - /css/test.css has an empty filter list
2009-03-13 16:58:32,243 [DEBUG] org.acegisecurity.intercept.web.PathBasedFilterInvocationDefinitionMap - Candidate is: '/test/css/test.css'; pattern is /**; matched=true
2009-03-13 16:58:32,244 [DEBUG] org.springframework.web.servlet.DispatcherServlet - Testing handler map [org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping@5b77c] in DispatcherServlet with name 'portal'
2009-03-13 16:58:32,245 [DEBUG] org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'httpSessionContextIntegrationFilter'
2009-03-13 16:58:32,245 [DEBUG] org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'logoutFilter'
2009-03-13 16:58:32,245 [DEBUG] org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'casProcessingFilter'
2009-03-13 16:58:32,245 [DEBUG] org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'anonymousProcessingFilter'
2009-03-13 16:58:32,245 [DEBUG] org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'securityContextHolderAwareRequestFilter'
2009-03-13 16:58:32,245 [DEBUG] org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'exceptionTranslationFilter'
2009-03-13 16:58:32,245 [DEBUG] org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'filterInvocationInterceptor'
2009-03-13 16:58:32,245 [DEBUG] org.acegisecurity.util.FilterChainProxy - /test/css/test.css at position 1 of 7 in additional filter chain; firing Filter: 'org.acegisecurity.context.HttpSessionContextIntegrationFilter@1ddfb6a'
2009-03-13 16:58:32,245 [DEBUG] org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping - Looking up handler for [/css/test.css]
Two things to look for in the logs is:
It matches the pattern of /css/** as the candidate, however it comes down and says:
2009-03-13 16:58:32,241 [DEBUG] org.acegisecurity.util.FilterChainProxy - /css/test.css has an empty filter list
Not quite sure. All I want is acegi to ignore all css/js files. Do I need to define something else where perhaps in my FilterSecurityInterceptor do I need to have something like /css/**=ROLE_ANONYMOUS? I tried that too but no luck.
Your help would be MUCH appreciated.
Cheers,
Nathan.