Announcement Announcement Module
Collapse
No announcement yet.
Images not Rendering Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Images not Rendering

    Hello,

    I know this has been discussed multiple times but for some reason I still cannot get an image to render.

    I'm new to spring and spring security; I'm using spring security 3.0.3 and Spring 3.0.1

    Here is my spring-security.xml file:

    Code:
    <http use-expressions="true">
         <form-login login-page="/login" default-target-url="/welcome" authentication-failure-url="/loginfailed" />
         <logout logout-success-url="/logout" />
         <intercept-url pattern="/jsp/images/**" access="permitAll()"/> (I've also tried filter="none" instead of access="permitAll()" neither work)
         <intercept-url pattern="/login*" access="permitAll()" />
         <intercept-url pattern="/**" access="isAuthenticated()"/>
    </http>
    Here is the portion of my web.xml file:
    Code:
    	<servlet>
    		<servlet-name>dispatcher</servlet-name>
    		<servlet-class>
            	org.springframework.web.servlet.DispatcherServlet
            </servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    	<servlet-mapping>
    		<servlet-name>default</servlet-name>
    		<url-pattern>/jsp/images/*</url-pattern>
    	</servlet-mapping>
    	<servlet-mapping>
    		<servlet-name>dispatcher</servlet-name>
    		<url-pattern>/</url-pattern>
    	</servlet-mapping>
    	
    	<listener>
    		<listener-class>
            	org.springframework.web.context.ContextLoaderListener
            </listener-class>
    	</listener>
     
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    			/WEB-INF/dispatcher-servlet.xml,
    			/WEB-INF/spring-security.xml
    		</param-value>
    	</context-param>
     
    	<!-- Spring Security -->
    	<filter>
    		<filter-name>springSecurityFilterChain</filter-name>
    		<filter-class>
                      org.springframework.web.filter.DelegatingFilterProxy
                    </filter-class>
    	</filter>
     
    	<filter-mapping>
    		<filter-name>springSecurityFilterChain</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>

    I've tried to access the image directly ie http://localhost:8080/TestProj/jsp/images/logo.png and I get the error message - The requested resource (/TestProj/jsp/images/logo.png) is not available, and I've also tried to reference the image from within the application and nothing is displayed.

    Any help or advice would be greatly appreciated.

    Thank you.
    Keith

  • #2
    I figured out the problem. I had my images directory under the web-inf directory which is protected and therefore it wasn't being read.

    Comment

    Working...
    X