gpt4 book ai didi

com.googlecode.htmlcompressor.compressor.XmlCompressor.setEnabled()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 18:56:40 29 4
gpt4 key购买 nike

本文整理了Java中com.googlecode.htmlcompressor.compressor.XmlCompressor.setEnabled()方法的一些代码示例,展示了XmlCompressor.setEnabled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlCompressor.setEnabled()方法的具体详情如下:
包路径:com.googlecode.htmlcompressor.compressor.XmlCompressor
类名称:XmlCompressor
方法名:setEnabled

XmlCompressor.setEnabled介绍

[英]If set to false all compression will be bypassed. Might be useful for testing purposes. Default is true.
[中]如果设置为false,所有压缩都将被忽略。可能对测试有用。默认值为true

代码示例

代码示例来源:origin: com.googlecode.htmlcompressor/htmlcompressor

@Override
public int doEndTag() throws JspException {
  
  BodyContent bodyContent = getBodyContent();
  String content = bodyContent.getString();
  
  XmlCompressor compressor = new XmlCompressor();
  compressor.setEnabled(enabled);
  compressor.setRemoveComments(removeComments);
  compressor.setRemoveIntertagSpaces(removeIntertagSpaces);
  
  try {
    bodyContent.clear();
    bodyContent.append(compressor.compress(content));
    bodyContent.writeOut(pageContext.getOut());
  } catch (IOException e) {
    e.printStackTrace();
  } catch (Exception e) {
    e.printStackTrace();
  }
  
  return super.doEndTag();
}

代码示例来源:origin: com.github.hazendaz/htmlcompressor

@Override
public int doEndTag() throws JspException {
  BodyContent bodyContent = getBodyContent();
  String content = bodyContent.getString();
  XmlCompressor compressor = new XmlCompressor();
  compressor.setEnabled(enabled);
  compressor.setRemoveComments(removeComments);
  compressor.setRemoveIntertagSpaces(removeIntertagSpaces);
  try {
    bodyContent.clear();
    bodyContent.append(compressor.compress(content));
    bodyContent.writeOut(pageContext.getOut());
  } catch (IOException e) {
    logger.error("", e);
  }
  return super.doEndTag();
}

代码示例来源:origin: com.googlecode.htmlcompressor/htmlcompressor

@Override
public void init(RuntimeServices rs, InternalContextAdapter context, Node node) throws TemplateInitException {
  super.init(rs, context, node);
  log = rs.getLog();
  
  //set compressor properties
  xmlCompressor.setEnabled(rs.getBoolean("userdirective.compressXml.enabled", true));
  xmlCompressor.setRemoveComments(rs.getBoolean("userdirective.compressXml.removeComments", true));
  xmlCompressor.setRemoveIntertagSpaces(rs.getBoolean("userdirective.compressXml.removeIntertagSpaces", true));
}

代码示例来源:origin: com.github.hazendaz/htmlcompressor

@Override
public void init(RuntimeServices rs, InternalContextAdapter context, Node node) throws TemplateInitException {
  super.init(rs, context, node);
  log = rs.getLog();
  // set compressor properties
  xmlCompressor.setEnabled(rs.getBoolean("userdirective.compressXml.enabled", true));
  xmlCompressor.setRemoveComments(rs.getBoolean("userdirective.compressXml.removeComments", true));
  xmlCompressor.setRemoveIntertagSpaces(rs.getBoolean("userdirective.compressXml.removeIntertagSpaces", true));
}

代码示例来源:origin: com.github.hazendaz/htmlcompressor

/**
 * Test enabled.
 *
 * @throws Exception
 *             the exception
 */
@Test
public void testEnabled() throws Exception {
  String source = readResource("testEnabled.xml");
  String result = readResource("testEnabledResult.xml");
  XmlCompressor compressor = new XmlCompressor();
  compressor.setEnabled(false);
  assertEquals(result, compressor.compress(source));
}

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com