Building Reducisaurus URLs
Posted
by Alix Axel
on Stack Overflow
See other posts from Stack Overflow
or by Alix Axel
Published on 2010-05-04T08:15:11Z
Indexed on
2010/05/04
8:18 UTC
Read the original article
Hit count: 348
I'm trying to use Reducisaurus Web Service to minify CSS and Javascript but I've run into a problem...
Suppose I've two unminified CSS at:
http:/domain.com/dynamic/styles/theme.php?color=red
http:/domain.com/dynamic/styles/typography.php?font=Arial
According to the docs I should call the web service like this:
http:/reducisaurus.appspot.com/css?url=http:/domain.com/dynamic/styles/theme.php?color=red
And if I want to minify both CSS files at once:
http:/reducisaurus.appspot.com/css?url1=http:/domain.com/dynamic/styles/theme.php?color=red&url2=http:/domain.com/dynamic/styles/theme.php?color=red
If I wanted to specify a different number of seconds for the cache (3600 for instance) I would use:
http:/reducisaurus.appspot.com/css?url=http:/domain.com/dynamic/styles/theme.php?color=red&expire_urls=3600
And again for both CSS files at once:
http:/reducisaurus.appspot.com/css?url1=http:/domain.com/dynamic/styles/theme.php?color=red&url2=http:/domain.com/dynamic/styles/theme.php?color=red&expire_urls=3600
Now my question is, how does Reducisaurus knows how to separate the URLs I want? How does it know that &expire_urls=3600
is not part of my URL? And how does it know that &url2=...
is not a GET argument of url1
? I'm I doing this right? Do I need to urlencode
my URLs?
I took a peek into the source code and although my Java is very poor it seems that the methods acquireFromRemoteUrl()
and getSortedParameterNames()
from the BaseServlet.java file hold the answers to my question - if a GET argument name contains -
or _
they should be ignored?!
What about multiple &url(n)
s?
© Stack Overflow or respective owner