/** * @see org.apache.wicket.javascript.IJavascriptCompressor#compress(java.lang.String) */ public String compress(String original) { return JavascriptStripper.stripCommentsAndWhitespace(original); } }
int count = getPrevCount(original, i, '\\'); if (c == '\'' && count % 2 == 0) int count = getPrevCount(original, i, '\\'); if (c == '"' && count % 2 == 0) int count = getPrevCount(original, i, '\\'); if (c == '/' && count % 2 == 0)
int count = getPrevCount(original, i, '\\'); if (c == '\'' && count % 2 == 0) int count = getPrevCount(original, i, '\\'); if (c == '"' && count % 2 == 0) int count = getPrevCount(original, i, '\\'); if (c == '/' && count % 2 == 0)
/** * @see org.apache.wicket.util.resource.AbstractStringResourceStream#getString() */ public String getString() { if (Application.get().getResourceSettings().getStripJavascriptCommentsAndWhitespace()) { return JavascriptStripper.stripCommentsAndWhitespace(buffer.toString()); } else { // don't strip the comments return buffer.toString(); } }
protected byte[] filterContent(byte[] input) { try { if (Application.get().getResourceSettings() .getStripJavascriptCommentsAndWhitespace()) { String s = new String(input, "UTF-8"); return JavascriptStripper.stripCommentsAndWhitespace(s).getBytes("UTF-8"); } else { // don't strip the comments, just return original input return input; } } catch (Exception e) { log.error("Error while filtering content", e); return input; } }
@Override protected byte[] filterContent(byte[] input) { try { // @TODO remove in 1.5 if (Application.get() .getResourceSettings() .getStripJavascriptCommentsAndWhitespace()) { String s = new String(input, "UTF-8"); return JavascriptStripper.stripCommentsAndWhitespace(s).getBytes("UTF-8"); } IJavascriptCompressor compressor = Application.get() .getResourceSettings() .getJavascriptCompressor(); if (compressor != null) { String s = new String(input, "UTF-8"); return compressor.compress(s).getBytes("UTF-8"); } // don't strip the comments, just return original input return input; } catch (Exception e) { log.error("Error while filtering content", e); return input; } }