traitMap.put(trait.name(), trait); List<String> lines = IO.read(MimeType.class.getResource("/org/osgl/mime-types2.properties")).toLines(); for (String line : lines) { S.Pair pair = S.binarySplit(line, '=');
private String verifyJsonBody(Object jsonBody) { if (jsonBody instanceof Map) { processParamSubstitution((Map) jsonBody); } else if (jsonBody instanceof Collection) { jsonBody = processParamSubstitution((Collection) jsonBody); } String s = null == jsonBody ? "" : (jsonBody instanceof String) ? (String) jsonBody : JSON.toJSONString(jsonBody); if (S.blank(s)) { return ""; } final String origin = s; if (s.startsWith("resource:")) { s = S.ensure(s.substring(9).trim()).startWith("/"); URL url = Act.getResource(s); E.unexpectedIf(null == url, "Cannot find JSON body: " + origin); s = IO.read(url).toString(); } try { JSON.parse(s); } catch (Exception e) { E.unexpected(e, "Invalid JSON body: " + origin); } return s; }
public UrlReadStage(URL url) { super(url); sourceName(url.getPath()); }
traitMap.put(trait.name(), trait); List<String> lines = IO.read(MimeType.class.getResource("/org/osgl/mime-types2.properties")).toLines(); for (String line : lines) { S.Pair pair = S.binarySplit(line, '=');
private String verifyJsonBody(Object jsonBody) { if (jsonBody instanceof Map) { processParamSubstitution((Map) jsonBody); } else if (jsonBody instanceof Collection) { jsonBody = processParamSubstitution((Collection) jsonBody); } String s = null == jsonBody ? "" : (jsonBody instanceof String) ? (String) jsonBody : JSON.toJSONString(jsonBody); if (S.blank(s)) { return ""; } final String origin = s; if (s.startsWith("resource:")) { s = S.ensure(s.substring(9).trim()).startWith("/"); URL url = Act.getResource(s); E.unexpectedIf(null == url, "Cannot find JSON body: " + origin); s = IO.read(url).toString(); } try { JSON.parse(s); } catch (Exception e) { E.unexpected(e, "Invalid JSON body: " + origin); } return s; }
private String verifyJsonBody(Object jsonBody) { String s = null == jsonBody ? "" : (jsonBody instanceof String) ? (String) jsonBody : JSON.toJSONString(jsonBody); if (S.blank(s)) { return ""; } final String origin = s; if (s.startsWith("resource:")) { s = S.ensure(s.substring(9).trim()).startWith("/"); URL url = Act.getResource(s); E.unexpectedIf(null == url, "Cannot find JSON body: " + origin); s = IO.read(url).toString(); } try { JSON.parse(s); } catch (Exception e) { E.unexpected(e, "Invalid JSON body: " + origin); } return s; }
public static UrlReadStage read(URL url) { return new UrlReadStage(url); }
private List<String> readUrl(URL url) { return C.list(IO.read(url).toLines()).filter(S.F.NOT_BLANK); }
public static UrlReadStage read(URL url) { return new UrlReadStage(url); }
protected String getResourceAsString(String name) { URL url = Act.getResource(patchResourceName(name)); return null == url ? null : IO.read(url).toString(); }
protected String getResourceAsString(String name) { URL url = YamlLoader.class.getResource(patchResourceName(name)); return null == url ? null : IO.read(url).toString(); }
public UrlReadStage(URL url) { super(url); sourceName(url.getPath()); }
private List<String> readUrl(URL url) { return C.list(IO.read(url).toLines()).filter(S.F.NOT_BLANK); }
private String tryRead() { File file = new File(resourcePath); String content; if (file.exists() && file.canRead()) { content = IO.read(file).toString(); } else { URL url = Act.getResource(resourcePath); content = null == url ? null : IO.read(url).toString(); } return content; }
protected String getResourceAsString(String name) { URL url = Act.getResource(patchResourceName(name)); return null == url ? null : IO.read(url).toString(); }
private String tryRead() { File file = new File(resourcePath); String content; if (file.exists() && file.canRead()) { content = IO.read(file).toString(); } else { URL url = Act.getResource(resourcePath); content = null == url ? null : IO.read(url).toString(); } return content; }