Closed GoogleCodeExporter closed 9 years ago
Original comment by rr.patil...@gmail.com
on 13 Apr 2011 at 4:24
If you are asking for minifying JS, CSS (which is dynamically generated by
JSPs) and also enabling gzip compression on them then it is doable. Whereas if
you want multiple JSP files, which are generating JS to be merged using
JSCSSMergeServlet that is not possible as of now.
Q. How to minify JS, CSS contents which is dynamically generated by JSPs
A. Using minify tag. http://code.google.com/p/webutilities/wiki/YUIMinTag.
In your JSP files you can declare taglib as...
<%@ taglib uri="http://webutilities.googlecode.com/taglib/wu" prefix="wu" %>
And put your script code generation inside the minify tag
<wu:minify type="js">
// your JSP code that generating JS
</wu:minify>
Similarly for CSS
wu:minify type="css">
// your JSP code that generating CSS
</wu:minify>
If you look view source of the output, you will see that your JS/CSS code is
minified.
Q. How to serve that JSP generated JS/CSS with gzip encoding?
A. You already know the name/path of the JSPs that you are using for generating
JS/CSS. You can add there pattern for CompressionFilter (if current pattern
doesn't cover them).
http://code.google.com/p/webutilities/wiki/CompressionFilter.
<filter-mapping>
<filter-name>compressionFilter</filter-name>
<url-pattern>*.js</url-pattern>
<url-pattern>*.css</url-pattern>
<url-pattern>javascriptGenerator.jsp</url-pattern> <!-- name of your JSP -->
<url-pattern>stylesheetgenerator.jsp</url-pattern> <!-- name of your JSP -->
</filter-mapping>
Original comment by rr.patil...@gmail.com
on 14 Apr 2011 at 11:57
[deleted comment]
Hi! Thanks - this looks like a proper solution. I thought about using the
Minify filter for the entiry JSP. But you are right, it might be better only to
specify certain areas within that JSP. I would use the same mechanism within
the JSP that generates CSS.
The zipping of resources is done by the HTTP Server. This saves performance on
the application server side.
Original comment by tribbel0...@googlemail.com
on 15 Apr 2011 at 7:12
Sure. Closing this issue as invalid. We don't need to support JSP or other
extensions.
Original comment by rr.patil...@gmail.com
on 15 Apr 2011 at 9:08
Original issue reported on code.google.com by
tribbel0...@googlemail.com
on 12 Apr 2011 at 3:46