protected String initHtmlDrillDown() { try (InputStream in = getClass().getResource("org/eclipse/scout/rt/client/mobile/html/MobileTableDrillDown.html").openStream()) { return IOUtility.readString(in, "iso-8859-1"); } catch (IOException e) { throw new ProcessingException("Exception while loading html cell template for mobile table", e); } }
@Override public String initHtmlTemplate() { try (InputStream in = ResourceBase.class.getResource("html/defaultWizardStatus.html").openStream()) { return IOUtility.readString(in, "iso-8859-1"); } catch (Exception t) { throw new ProcessingException("Unexpected", t); } }
protected String initHtmlCellTemplate() { try (InputStream in = getClass().getResource("org/eclipse/scout/rt/client/mobile/html/MobileTableCellContent.html").openStream()) { return IOUtility.readString(in, "iso-8859-1"); } catch (IOException e) { throw new ProcessingException("Exception while loading html cell template for mobile table", e); } }
protected String initHtmlDrillDownButton() { try (InputStream in = getClass().getResource("org/eclipse/scout/rt/client/mobile/html/MobileTableDrillDownButton.html").openStream()) { return IOUtility.readString(in, "iso-8859-1"); } catch (IOException e) { throw new ProcessingException("Exception while loading html cell template for mobile table", e); } }
/** * Reads the content of {@link ServletRequest} into a {@link JSONObject}. */ public JSONObject readJsonRequest(final ServletRequest servletRequest) { try (Reader in = servletRequest.getReader()) { final String jsonData = IOUtility.readString(in); LOG.debug("Received: {}", formatJsonForLogging(jsonData)); return (jsonData == null ? new JSONObject() : new JSONObject(jsonData)); } catch (RuntimeException | IOException e) { throw new UiException(e.getMessage(), e); } }
@Override public boolean handlePost(final HttpServletRequest req, final HttpServletResponse resp) throws IOException { // serve only /csp-report if (!ObjectUtility.equals(req.getPathInfo(), HANDLER_PATH)) { return false; } String cspReportData; try (Reader in = req.getReader()) { cspReportData = IOUtility.readString(in, MAX_CSP_REPORT_DATALENGTH); if (in.read() != -1) { cspReportData += "... [only first " + MAX_CSP_REPORT_DATALENGTH + " bytes shown]"; } else { // Format JSON try { JSONObject json = new JSONObject(cspReportData); cspReportData = json.toString(2); } catch (RuntimeException e) { LOG.trace("Error while converting CSP report to JSON", e); } } } LOG.warn("CSP-REPORT: {}", cspReportData); return true; }
public void setValueFromURL(URL url, String encoding) { if (url != null) { try (Reader in = new InputStreamReader(url.openStream(), encoding)) { setValue(IOUtility.readString(in)); } catch (IOException e) { throw new ProcessingException("URL " + url, e); } } else { setValue(null); } }
if (len > 0) { o = IOUtility.readString(c.getCharacterStream(), len); o = IOUtility.readString(c.getCharacterStream());