Question

I'm trying to integrate Jawr into my Spring application:

  <bean abstract="true" id="jawrBase" class="net.jawr.web.servlet.JawrSpringController">
    <property name="configuration">
      <props>
        <prop key="jawr.debug.on">false</prop>
        <prop key="jawr.gzip.on">true</prop>
        <prop key="jawr.js.bundle.all.id">/static/all.js</prop>
        <prop key="jawr.js.bundle.all.mappings">/static/js/**</prop>
        <prop key="jawr.css.bundle.basedir">/static/css</prop>
        <prop key="jawr.css.factory.use.singlebundle">true</prop>
        <prop key="jawr.css.factory.singlebundle.bundlename">/static/all.css</prop>
      </props>
    </property>
  </bean>

  <bean id="jawrJsController" parent="jawrBase" />

  <bean id="jawrCSSController" parent="jawrBase">
    <property name="type" value="css" />
  </bean>

  <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="mappings">
      <props>
        <prop key="/**/*.js">jawrJsController</prop>
        <prop key="/**/*.css">jawrCSSController</prop>
      </props>
    </property>
  </bean>

My folder structure:

  • static
    • images
    • css
    • js

CSS and JS files are properly mapped to all.css/all.js. But Images can't be found.

Snippet from my /static/css/style.css:

header,
footer
{
  background-image: url( ../images/sprite.png );
  color: #fff;
}

This will be changed in /test/gzip_954035349/static/all.css to:

header, footer{background-image:url(../../static/images/sprite.png);color:#fff;}

Which should be the correct behavior, because this would result in an absolute path to /test/static/images/sprite.png

There's another image in this folder called favicon.png which I can access by http://localhost:8080/test/static/images/favicon.png Therefor I should be able to also access my sprite with http://localhost:8080/test/static/images/sprite.png which causes an Stackoverflow Exception...

Was it helpful?

Solution

Fixed...

I've added <mvc:resources location="/static/" mapping="/static/**" />

to my dispatcher-servlet.xml

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top