How can I minimize (on-the-fly) dynamically generated CSS inside servlet?

96 Views Asked by At

My Tomcat servlet generate CSS from several patterns dynamically.

After CSS manipulations done, servlet return it.

I want minimize generated CSS.

What way I can minimize CSS before response?

  • Java routines
  • External library
  • Other

Sample of GET handler:

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {

StringBuilder cssContent = new StringBuilder();

/* Some CSS manipulations */

/* Now cssContent contain generated CSS. Lets return it. */

/* Minimize before response!!! - How? */

response.setContentType("text/css");
response.setStatus(200);
response.getWriter().write(cssContent.toString());

}
0

There are 0 best solutions below