@Test public void testText() throws IOException { Handler.configureProtocolHandler(); final URL url = new URL("data:text/plain;charset=utf-8,HelloWorld"); final InputStream content = (InputStream) url.getContent(); assertEquals("HelloWorld", IOUtils.toString(content, "utf-8")); }
public static void configureProtocolHandler() { final String pkgs = System.getProperty("java.protocol.handler.pkgs"); String newValue = "org.mapfish.print.url"; if (pkgs != null && !pkgs.contains(newValue)) { newValue = newValue + "|" + pkgs; } else if (pkgs != null) { newValue = pkgs; } System.setProperty("java.protocol.handler.pkgs", newValue); }
Handler extends URLStreamHandler { public static void configureProtocolHandler() { final String pkgs = System.getProperty("java.protocol.handler.pkgs"); String newValue = "org.mapfish.print.url"; if (pkgs != null && !pkgs.contains(newValue)) { newValue = newValue + "|" + pkgs; } else if (pkgs != null) { newValue = pkgs; } System.setProperty("java.protocol.handler.pkgs", newValue); } }
Handler extends URLStreamHandler { public static void configureProtocolHandler() { final String pkgs = System.getProperty("java.protocol.handler.pkgs"); String newValue = "org.mapfish.print.url"; if (pkgs != null && !pkgs.contains(newValue)) { newValue = newValue + "|" + pkgs; } else if (pkgs != null) { newValue = pkgs; } System.setProperty("java.protocol.handler.pkgs", newValue); }  }
Handler extends URLStreamHandler { public static void configureProtocolHandler() { final String pkgs = System.getProperty("java.protocol.handler.pkgs"); String newValue = "org.mapfish.print.url"; if (pkgs != null && !pkgs.contains(newValue)) { newValue = newValue + "|" + pkgs; } else if (pkgs != null) { newValue = pkgs; } System.setProperty("java.protocol.handler.pkgs", newValue); }  static void configureProtocolHandler(); }
Handler extends URLStreamHandler { public static void configureProtocolHandler() { final String pkgs = System.getProperty("java.protocol.handler.pkgs"); String newValue = "org.mapfish.print.url"; if (pkgs != null && !pkgs.contains(newValue)) { newValue = newValue + "|" + pkgs; } else if (pkgs != null) { newValue = pkgs; } System.setProperty("java.protocol.handler.pkgs", newValue); }  static void configureProtocolHandler();  }