Results 1 to 2 of 2

Thread: Getting 404s when trying to map static resources

  1. #1
    Join Date
    Apr 2010
    Posts
    104

    Default Getting 404s when trying to map static resources

    Hi,

    I'm using Spring 3.0.5. I have a folder "static" with static assets at the root of my WAR file (at the same level as WEB-INF). I'm trying to map all requests of the form "/context-path/static/" to this directory, but not having success (getting 404s). Here is what I have ...

    Code:
    <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns="http://www.springframework.org/schema/beans"
            xmlns:mvc="http://www.springframework.org/schema/mvc"
            xsi:schemaLocation="http://www.springframework.org/schema/beans
                                http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                                http://www.springframework.org/schema/mvc
                                http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
    
    
            <mvc:resources mapping="/static/**" location="/static/"/>
            <mvc:annotation-driven/>
    My logs show that the mapping is being found, but the file is not. Any ideas how I can troubleshoot this further? - Dave

    Logs ...
    Code:
    2011-07-07 10:11:57,865 [http-8080-2] DEBUG org.springframework.web.servlet.DispatcherServlet  - DispatcherServlet with name 'dispatcher' processing GET request for [/leadsmonitor/static/css/reset.css]
    2011-07-07 10:11:57,866 [http-8080-2] DEBUG org.springframework.web.servlet.handler.SimpleUrlHandlerMapping  - Matching patterns for request [/static/css/reset.css] are [/static/**]
    2011-07-07 10:11:57,866 [http-8080-2] DEBUG org.springframework.web.servlet.handler.SimpleUrlHandlerMapping  - URI Template variables for request [/static/css/reset.css] are {}
    2011-07-07 10:11:57,866 [http-8080-2] DEBUG org.springframework.web.servlet.handler.SimpleUrlHandlerMapping  - Mapping [/static/css/reset.css] to HandlerExecutionChain with handler [org.springframework.web.servlet.resource.ResourceHttpRequestHandler@4c7e9bed] and 2 interceptors
    2011-07-07 10:11:57,866 [http-8080-2] DEBUG org.springframework.web.servlet.DispatcherServlet  - Last-Modified value for [/leadsmonitor/static/css/reset.css] is: -1
    2011-07-07 10:11:57,866 [http-8080-2] DEBUG org.springframework.web.servlet.resource.ResourceHttpRequestHandler  - Trying relative path [css/reset.css] against base location: class path resource [static/]
    2011-07-07 10:11:57,866 [http-80

  2. #2
    Join Date
    Aug 2009
    Location
    Colorado
    Posts
    26

    Default

    I know I have seen this before... you need to turn on logging for org.springframework.web ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •