Package net.sf.sahi.stream.filter

Examples of net.sf.sahi.stream.filter.JSModifierFilter


              if (html) {
          HTMLModifierFilter htmlModifierFilter = new HTMLModifierFilter(charset, isXHTML(), isSSL);
          htmlModifierFilter.modifyHeaders(response);
          dataString = htmlModifierFilter.modify(dataString);
              }
        JSModifierFilter jsModifierFilter = new JSModifierFilter(charset);
        dataString = jsModifierFilter.modify(dataString);
       
        try {
          setData(dataString.getBytes(charset));
        } catch (UnsupportedEncodingException e) {
          e.printStackTrace();
View Full Code Here


        if (responseCode < 300 || responseCode >= 400) { // Response code other than 3xx
            boolean html = isHTML();
            charset(); // set it
            if (html) {
              if (Configuration.addCharacterFilter()) addFilter(new CharacterFilter(charset));
              if (Configuration.addJSModifierFilter()) addFilter(new JSModifierFilter(charset));
              if (Configuration.addHTMLModifierFilter()) addFilter(new HTMLModifierFilter(charset, isXHTML(), isSSL));
              addFilter(new NoCacheFilter());
            } else if (isJs()) {
              if (Configuration.addCharacterFilter()) addFilter(new CharacterFilter(charset));
              if (Configuration.addJSModifierFilter()) addFilter(new JSModifierFilter(charset));
//              Removing NoCacheFilter because it slows down pages a lot.
//              Test on http://sourceforge.net main page. min.js should be fetched from cache.             
//              addFilter(new NoCacheFilter()); 
            }
        }
View Full Code Here

    output = getFiltered(new String[]{s1});
    assertEquals("new_ActiveXObject", output);
  }
  public void testBrokenStreamParsing1() throws IOException{
    byte[] s1 = "xx a = new ActiveXObject(); yy".getBytes();
    JSModifierFilter modifierFilter = new JSModifierFilter("iso-8859-1");
    byte[] result = modifierFilter.modify(s1);
    byte[] remaining = modifierFilter.getRemaining();
    assertEquals("xx a = new_ActiveXObject(); yy", new String(result)+new String(remaining));
  }
View Full Code Here

    String s3 = " \t\tActiveXObject";
    output = getFiltered(new String[]{s1, s2, s3});
    assertEquals("new_ActiveXObject", output);
  }
  private String getFiltered(String[] strings) throws IOException {
    JSModifierFilter modifierFilter = new JSModifierFilter("iso-8859-1");
    return getFiltered(strings, modifierFilter);
  }
View Full Code Here

TOP

Related Classes of net.sf.sahi.stream.filter.JSModifierFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.