List of usage examples for javax.servlet ServletRequestWrapper getScheme
public String getScheme()
From source file:pt.webdetails.cdb.CdbContentGenerator.java
@Exposed(accessLevel = AccessLevel.PUBLIC) public void export(OutputStream out) throws IOException, ExporterRuntimeException, ExporterNotFoundException { ExporterEngine engine = ExporterEngine.getInstance(); IParameterProvider requestParams = getRequestParameters(), pathParams = getPathParameters(); String method = requestParams.getStringParameter("method", ""); if ("listExporters".equals(method)) { String exporters = engine.listExporters(); JsonUtils.buildJsonResult(out, exporters != null, exporters); } else if ("export".equals(method)) { ServletRequestWrapper wrapper = (ServletRequestWrapper) pathParams.getParameter("httprequest"); String exporterName = requestParams.getStringParameter("exporter", ""), group = requestParams.getStringParameter("group", ""), id = requestParams.getStringParameter("id", ""), url = wrapper.getScheme() + "://" + wrapper.getServerName() + ":" + wrapper.getServerPort() + PentahoRequestContextHolder.getRequestContext().getContextPath(); boolean toFile = requestParams.getStringParameter("toFile", "false").equals("true"); Exporter exporter = engine.getExporter(exporterName); if (toFile) { HttpServletResponse response = (HttpServletResponse) pathParams.getParameter("httpresponse"); String path = exporter.getFilename(group, id, url).replaceAll("\\\\", "\\\\").replaceAll("\"", "\\\""); response.setHeader("content-disposition", "attachment; filename=\"" + path + "\""); exporter.binaryExport(group, id, url, out); } else {//from w w w .j av a 2s . c om String export = exporter.export(group, id, url); JsonUtils.buildJsonResult(out, export != null, export); } } }