1

When I put below url which exists on Server, I get the 404 error

localhost/PDFDemo/resources/jquery/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png



Error 404--Not Found

From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:

10.4.5 404 Not Found

The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.

If the server does not wish to make this information available to the client, the status code `403 (Forbidden)` can be used instead. The `410 (Gone)` status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.

I had same problem for javascript files and resolved the issue by putting below in web.xml

<mime-mapping>
        <extension>js</extension>
        <mime-type>text/javascript</mime-type>
    </mime-mapping>

Are there equivalent codes for jsp and images which I can put in contextConfigLocation(eg : servlet.xml).

tompal18
  • 1,164
  • 2
  • 21
  • 39

1 Answers1

0

The problem is that you are mapping the Spring Dispatcher Servlet to the root context, so Spring wants to handle every request (which isn't in itself a problem if you have it configured correctly). Adding something like this:

<mvc:resources mapping="/resources/**" location="/public-resources/" cache-period="31556926"/>

Modified for your environment should work. See the documentation for allowing static resources to bypass Spring and go to the default servlet here.

You should also add this to your config so that Spring knows to use the Default Servlet.

<mvc:default-servlet-handler/>

Also, answers to this question may help you.

Community
  • 1
  • 1
digitaljoel
  • 26,265
  • 15
  • 89
  • 115