@Test public void sanitizeStyle() { String html = "<span style=\"color:red;invalid:removed\"></span>"; String expected = "<span style=\"color:red\"></span>"; HtmlSanitizerService service = Framework.getService(HtmlSanitizerService.class); String res = service.sanitizeString(html, null); assertEquals(expected, res); }
@Override public String sanitizeString(String string, String info) { if (policy == null) { log.error("Cannot sanitize, no policy registered"); return string; } return policy.sanitize(string); }
HtmlSanitizerServiceImpl extends DefaultComponent implements HtmlSanitizerService { @Override public String sanitizeString(String string, String info) { if (policy == null) { log.error("Cannot sanitize, no policy registered"); return string; } return policy.sanitize(string); } }
HtmlSanitizerServiceImpl extends DefaultComponent implements HtmlSanitizerService { @Override public String sanitizeString(String string, String info) { if (policy == null) { log.error("Cannot sanitize, no policy registered"); return string; } return policy.sanitize(string); }  }
HtmlSanitizerServiceImpl extends DefaultComponent implements HtmlSanitizerService { @Override public String sanitizeString(String string, String info) { if (policy == null) { log.error("Cannot sanitize, no policy registered"); return string; } return policy.sanitize(string); }  @Override void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor); @Override void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor); @Override void sanitizeDocument(DocumentModel doc); @Override String sanitizeString(String string, String info); }
HtmlSanitizerServiceImpl extends DefaultComponent implements HtmlSanitizerService { @Override public String sanitizeString(String string, String info) { if (policy == null) { log.error("Cannot sanitize, no policy registered"); return string; } return policy.sanitize(string); }  @Override void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor); @Override void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor); @Override void sanitizeDocument(DocumentModel doc); @Override String sanitizeString(String string, String info); static final String ANTISAMY_XP; static final String SANITIZER_XP; public LinkedList<HtmlSanitizerAntiSamyDescriptor> allPolicies; public PolicyFactory policy; public List<HtmlSanitizerDescriptor> allSanitizers; public List<HtmlSanitizerDescriptor> sanitizers; }