use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.
the class EVReport method writeContents.
/** Generate CGI output. */
protected void writeContents() throws IOException {
// load settings information for the report
settings = new EVReportSettings(getDataRepository(), parameters, getPrefix());
// possibly store settings data if requested.
if (parameters.get(CUSTOMIZE_PARAM) != null) {
storeCustomizationSettings();
return;
}
// load the user requested earned value model.
getEVModel();
String chartType = getParameter(CHART_PARAM);
if (chartType == null) {
String tableType = getParameter(TABLE_PARAM);
if (tableType == null) {
if (parameters.get(XML_PARAM) != null)
writeXML();
else if (parameters.get(XLS_PARAM) != null)
writeXls();
else if (parameters.get(CSV_PARAM) != null)
writeCsv();
else if (parameters.get(MS_PROJ_XML_PARAM) != null)
writeMSProjXml();
else if (parameters.get(CHARTS_PARAM) != null)
writeChartsPage();
else if (parameters.get(CHART_OPTIONS_PARAM) != null)
writeChartOptions();
else
writeHTML();
} else if (TIME_CHART.equals(tableType))
writeTimeTable();
else if (VALUE_CHART2.equals(tableType))
writeValueTable2();
else if (VALUE_CHART.equals(tableType))
writeValueTable();
else if (COMBINED_CHART.equals(tableType))
writeCombinedTable();
else
throw new TinyCGIException(400, "unrecognized table type parameter");
} else if (TIME_CHART.equals(chartType))
writeTimeChart();
else if (VALUE_CHART.equals(chartType))
writeValueChart();
else if (COMBINED_CHART.equals(chartType))
writeCombinedChart();
else
throw new TinyCGIException(400, "unrecognized chart type parameter");
}
use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.
the class PngCache method doGet.
@Override
protected void doGet() throws IOException {
int streamID = Integer.parseInt(getParameter("id"));
InputStream pngData = PngCache.PNG_CACHE.getInputStream(streamID);
if (pngData == null)
throw new TinyCGIException(HttpURLConnection.HTTP_NOT_FOUND, "Not Found", "Not Found");
out.print("Content-type: image/png\r\n\r\n");
out.flush();
FileUtils.copyFile(pngData, outStream);
outStream.flush();
outStream.close();
}
use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.
the class TinyCGIBase method retrieveParamsFromServlet.
protected void retrieveParamsFromServlet(String servletUriParamName) throws IOException {
String servletUri = getParameter(servletUriParamName);
if (StringUtils.hasValue(servletUri)) {
try {
HttpServletRequest req = (HttpServletRequest) env.get(HttpServletRequest.class);
HttpServletResponse resp = (HttpServletResponse) env.get(HttpServletResponse.class);
if (!servletUri.startsWith("/"))
servletUri = resolveRelativeURI(servletUri);
RequestDispatcher disp = req.getRequestDispatcher(servletUri);
disp.include(req, resp);
Object params = req.getAttribute("REQUEST_PARAMS");
if (params instanceof Map)
parameters.putAll((Map) params);
else
throw new TinyCGIException(404, "Could not retrieve " + servletUri);
req.removeAttribute("REQUEST_PARAMS");
} catch (IOException e) {
throw e;
} catch (Exception e) {
e.printStackTrace();
}
}
}
use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.
the class OpenDefectDialog method writeContents.
@Override
protected void writeContents() throws IOException {
DashController.checkIP(env.get("REMOTE_ADDR"));
String path = getPath();
DefectLogID defectLog = getDefectLog(path);
if (defectLog == null)
throw new TinyCGIException(404, "No defect log found for " + path);
String id = getParameter("id");
if (StringUtils.hasValue(id))
openExistingDefectDialog(defectLog, id);
else
openNewDefectDialog(defectLog, path);
DashController.printNullDocument(out);
}
use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.
the class HierarchySynchronizer method openWBS.
private void openWBS(URL wbsLocation) throws IOException {
URLConnection conn = null;
InputStream in = null;
try {
conn = wbsLocation.openConnection();
in = new BufferedInputStream(conn.getInputStream());
Document doc = XMLUtils.parse(in);
projectXML = doc.getDocumentElement();
prunedChildren = new HashMap<Element, List<Element>>();
String projectTaskID = projectXML.getAttribute(TASK_ID_ATTR);
projectTaskID = cleanupProjectIDs(projectTaskID);
projectXML.setAttribute(TASK_ID_ATTR, projectTaskID);
projectXML.setAttribute(ID_ATTR, ROOT_NODE_PSEUDO_ID);
dumpFileVersion = projectXML.getAttribute(VERSION_ATTR);
if (!StringUtils.hasValue(dumpFileVersion))
dumpFileVersion = "0";
dumpFileTimestamp = XMLUtils.getXMLDate(projectXML, SAVE_DATE_ATTR);
if (dumpFileTimestamp == null) {
long dumpTime = conn.getLastModified();
if (dumpTime > 0)
dumpFileTimestamp = new Date(dumpTime);
}
String projClosedAttr = projectXML.getAttribute("projectClosed");
projectClosed = XMLUtils.hasValue(projClosedAttr);
} catch (Exception e) {
if (in == null && conn instanceof HttpURLConnection) {
HttpURLConnection hConn = (HttpURLConnection) conn;
if (hConn.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND)
throw new TinyCGIException(500, SyncWBS.WBS_FILE_MISSING);
}
throw new IOException("The dashboard could not read the file containing the work " + "breakdown structure for this team project. The file may " + "be corrupt.");
} finally {
if (in != null)
try {
in.close();
} catch (Exception e) {
}
}
}
Aggregations