wro4j: CSS Image URL rewriting not working for CSS hosted external servers.

What steps will reproduce the problem?

1. Create a CSS, foo.css, which has a background image url
.foo {
  background-image: url( "/images/some.png" );
}
2. Host the CSS in a different web-server
3. In localhost servlet-context, create a group out of that CSS in wro.xml 
<group name="gcss">
 <css>http://staticserver.com/css/foo.css</css>
</group>

What is the expected output? What do you see instead?


The group gcss.css accessed via http://localhost:8080/wro/wro/gcss.css will 
have the image url rewritten wrongly as below -

.foo {
  background-image: url( "http://staticserver.com/css/images/some.png" );
}

it should have been either - http://staticserver.com/images/some.png or 
/images/some.png as it was.


What version of the product are you using? On what operating system?

latest 1.4.6

Additional information below:-

It is similar to -  bug Issue 322 or Issue 91. The fixes for them  seems to be 
specific only to the resources whose uri is a valid ServletContext 
resource.(ie. if the css belongs to the servlet context)

The bug still remains for conditions where you have the css hosted in an 
external server (ie. when we use the UrlUriLocator)

The fix probably should have been made in the 
CssUrlRewritingProcessor.computeNewImageLocation(), the image url starts with 
the '/' it should have left alone, shouldn't it ?

Original issue reported on code.google.com by doncarea...@gmail.com on 13 Jun 2012 at 7:05

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 17

Most upvoted comments