Example usage for javax.servlet ServletOutputStream println

List of usage examples for javax.servlet ServletOutputStream println

Introduction

In this page you can find the example usage for javax.servlet ServletOutputStream println.

Prototype


public void println(double d) throws IOException 

Source Link

Document

Writes a double value to the client, followed by a carriage return-line feed (CRLF).

Usage

From source file:org.openmrs.module.pmtct.util.FileExporter.java

/**
 * Auto generated method comment//from w  w  w . j  a va  2  s.co  m
 * 
 * @param request
 * @param response
 * @param patientList
 * @param filename
 * @param title
 * @throws Exception
 */
public void exportExpectedPatientInMaternityToCSVFile(HttpServletRequest request, HttpServletResponse response,
        List<Object> patientList, String filename, String title) throws Exception {
    ServletOutputStream outputStream = null;
    try {
        outputStream = response.getOutputStream();
        Patient p;
        PatientService ps = Context.getPatientService();

        response.setContentType("text/plain");
        response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
        outputStream.println("" + title);
        outputStream.println("Number of Patients: " + patientList.size());
        outputStream.println();
        outputStream.println("No. ,Identifier, Names, Enrollment Date, DPA, HIV Status, HIV Status of Partner");
        outputStream.println();

        int ids = 0;

        Encounter cpnEnc;

        for (Object patient : patientList) {
            Object[] o = (Object[]) patient;

            p = ps.getPatient(Integer.parseInt(o[0].toString()));
            cpnEnc = pmtctTag.getCPNEncounterInfo(p.getPatientId());

            ids += 1;
            outputStream.println(ids + "," + p.getActiveIdentifiers().get(0).getIdentifier() + ","
                    + p.getPersonName() + "," + o[3].toString() + ","
                    + pmtctTag.observationValueByConcept(cpnEnc, PMTCTConstants.PREGNANT_DUE_DATE) + ","
                    + pmtctTag.lastObsValueByConceptId(p.getPatientId(), PMTCTConstants.RESULT_OF_HIV_TEST)
                    + ","
                    + pmtctTag.observationValueByConcept(cpnEnc, PMTCTConstants.TESTING_STATUS_OF_PARTNER));
        }

        outputStream.flush();
    } catch (Exception e) {
        log.error(e.getMessage());
    } finally {
        if (null != outputStream)
            outputStream.close();
    }
}

From source file:org.openmrs.module.pmtct.util.FileExporter.java

/**
 * Auto generated method comment//w ww. j a  v a2s .  co m
 * 
 * @param request
 * @param response
 * @param patientList
 * @param filename
 * @param title
 * @throws Exception
 */
public void exportPatientTestedInDeliveryRoomToCSVFile(HttpServletRequest request, HttpServletResponse response,
        List<Object> patientList, String filename, String title) throws Exception {
    ServletOutputStream outputStream = null;
    try {
        outputStream = response.getOutputStream();
        Patient p;
        PatientService ps = Context.getPatientService();

        response.setContentType("text/plain");
        response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
        outputStream.println("" + title);
        outputStream.println("Number of Patients: " + patientList.size());
        outputStream.println();
        outputStream.println(
                "No. ,Identifier, Names, Enrollment Date, DPA, Delivery Date, Result of HIV in Delivery room");
        outputStream.println();

        int ids = 0;

        Encounter cpnEnc, matEnc;

        for (Object patient : patientList) {
            Object[] o = (Object[]) patient;

            p = ps.getPatient(Integer.parseInt(o[0].toString()));
            cpnEnc = pmtctTag.getCPNEncounterInfo(p.getPatientId());
            matEnc = pmtctTag.getMaternityEncounterInfo(p.getPatientId());

            ids += 1;
            outputStream.println(ids + "," + p.getActiveIdentifiers().get(0).getIdentifier() + ","
                    + p.getPersonName() + "," + o[3].toString() + ","
                    + pmtctTag.observationValueByConcept(cpnEnc, PMTCTConstants.PREGNANT_DUE_DATE) + ","
                    + pmtctTag.observationValueByConcept(matEnc, PMTCTConstants.DATE_OF_CONFINEMENT) + ","
                    + pmtctTag.observationValueByConcept(matEnc, PMTCTConstants.RESULT_OF_HIV_TEST));
        }

        outputStream.flush();
    } catch (Exception e) {
        log.error(e.getMessage());
    } finally {
        if (null != outputStream)
            outputStream.close();
    }
}

From source file:org.openmrs.module.pmtct.util.FileExporter.java

/**
 * Auto generated method comment//  ww w  . j a  v a2 s. co m
 * 
 * @param request
 * @param response
 * @param patientList
 * @param filename
 * @param title
 * @throws Exception
 */
public void exportGeneralStatisticsInCPNToCSVFile(HttpServletRequest request, HttpServletResponse response,
        List<Object> patientList, String filename, String title) throws Exception {
    ServletOutputStream outputStream = null;
    try {
        outputStream = response.getOutputStream();
        Patient p;
        PatientService ps = Context.getPatientService();

        response.setContentType("text/plain");
        response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
        outputStream.println("" + title);
        outputStream.println("Number of Patients: " + patientList.size());
        outputStream.println();
        outputStream.println(
                "No. ,Identifier, Names, Gender, BirthDay, Enrollment Date, CPN Date, HIV Status, DPA, Date of Confiment");
        outputStream.println();

        int ids = 0;

        Encounter cpnEnc;
        Encounter matEnc;

        for (Object patient : patientList) {
            Object[] o = (Object[]) patient;

            p = ps.getPatient(Integer.parseInt(o[1].toString()));
            cpnEnc = pmtctTag.getCPNEncounterInfo(p.getPatientId());
            matEnc = pmtctTag.getMaternityEncounterInfo(p.getPatientId());

            ids += 1;
            outputStream.println(ids + "," + p.getActiveIdentifiers().get(0).getIdentifier() + ","
                    + p.getPersonName() + "," + p.getGender() + "," + sdf.format(p.getBirthdate()) + ","
                    + o[4].toString() + "," + sdf.format(cpnEnc.getEncounterDatetime()) + ","
                    + pmtctTag.lastObsValueByConceptId(p.getPatientId(), PMTCTConstants.RESULT_OF_HIV_TEST)
                    + "," + pmtctTag.observationValueByConcept(cpnEnc, PMTCTConstants.PREGNANT_DUE_DATE) + ","
                    + pmtctTag.observationValueByConcept(matEnc, PMTCTConstants.DATE_OF_CONFINEMENT));
        }

        outputStream.flush();
    } catch (Exception e) {
        log.error(e.getMessage());
    } finally {
        if (null != outputStream)
            outputStream.close();
    }
}

From source file:org.openmrs.module.pmtct.util.FileExporter.java

public void exportGeneralStatisticsInMaternityToCSVFile(HttpServletRequest request,
        HttpServletResponse response, List<Object> patientList, String filename, String title)
        throws Exception {
    ServletOutputStream outputStream = null;
    try {/*from w  ww.j  a  v a  2 s  .c o  m*/
        outputStream = response.getOutputStream();
        Patient p;
        PatientService ps = Context.getPatientService();

        response.setContentType("text/plain");
        response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
        outputStream.println("" + title);
        outputStream.println("Number of Patients: " + patientList.size());
        outputStream.println();
        outputStream.println(
                "No. ,Identifier, Names, Enrollment Date, DPA, Date of Confiment, HIV Status, Child Born Status");
        outputStream.println();

        int ids = 0;

        Encounter cpnEnc;
        Encounter matEnc;

        for (Object patient : patientList) {
            Object[] o = (Object[]) patient;

            p = ps.getPatient(Integer.parseInt(o[0].toString()));
            cpnEnc = pmtctTag.getCPNEncounterInfo(p.getPatientId());
            matEnc = pmtctTag.getMaternityEncounterInfo(p.getPatientId());

            ids += 1;
            outputStream.println(ids + "," + p.getActiveIdentifiers().get(0).getIdentifier() + ","
                    + p.getPersonName() + "," + o[3].toString() + ","
                    + pmtctTag.observationValueByConcept(cpnEnc, PMTCTConstants.PREGNANT_DUE_DATE) + ","
                    + pmtctTag.observationValueByConcept(matEnc, PMTCTConstants.DATE_OF_CONFINEMENT) + ","
                    + pmtctTag.lastObsValueByConceptId(p.getPatientId(), PMTCTConstants.RESULT_OF_HIV_TEST)
                    + "," + pmtctTag.observationValueByConcept(matEnc,
                            PMTCTConfigurationUtils.getBornStatusConceptId()));
        }

        outputStream.flush();
    } catch (Exception e) {
        log.error(e.getMessage());
    } finally {
        if (null != outputStream)
            outputStream.close();
    }
}

From source file:org.dspace.app.rest.utils.MultipartFileSender.java

public void serveResource() throws IOException {

    // Validate and process range -------------------------------------------------------------

    // Prepare some variables. The full Range represents the complete file.
    Range full = getFullRange();/*from w w  w  . java  2s.c  om*/
    List<Range> ranges = getRanges(full);

    if (ranges == null) {
        //The supplied range values were invalid
        return;
    }

    log.debug("Content-Type : {}", contentType);
    // Initialize response.
    response.reset();
    response.setBufferSize(bufferSize);
    response.setHeader(CONTENT_TYPE, contentType);
    response.setHeader(ACCEPT_RANGES, BYTES);
    response.setHeader(ETAG, checksum);
    response.setDateHeader(LAST_MODIFIED, lastModified);
    response.setDateHeader(EXPIRES, System.currentTimeMillis() + DEFAULT_EXPIRE_TIME);

    //No-cache so that we can log every download
    response.setHeader(CACHE_CONTROL, CACHE_CONTROL_SETTING);

    if (isNullOrEmpty(disposition)) {
        if (contentType == null) {
            contentType = APPLICATION_OCTET_STREAM;
        } else if (!contentType.startsWith(IMAGE)) {
            String accept = request.getHeader(ACCEPT);
            disposition = accept != null && accepts(accept, contentType) ? CONTENT_DISPOSITION_INLINE
                    : CONTENT_DISPOSITION_ATTACHMENT;
        }

        response.setHeader(CONTENT_DISPOSITION,
                String.format(CONTENT_DISPOSITION_FORMAT, disposition, fileName));
        log.debug("Content-Disposition : {}", disposition);
    }

    // Content phase
    if (METHOD_HEAD.equals(request.getMethod())) {
        log.debug("HEAD request - skipping content");
        return;
    }
    // Send requested file (part(s)) to client ------------------------------------------------

    // Prepare streams.
    try (OutputStream output = response.getOutputStream()) {

        if (hasNoRanges(full, ranges)) {

            // Return full file.
            log.debug("Return full file");
            response.setContentType(contentType);
            response.setHeader(CONTENT_LENGTH, String.valueOf(length));
            Range.copy(inputStream, output, length, 0, length, bufferSize);

        } else if (ranges.size() == 1) {

            // Return single part of file.
            Range r = ranges.get(0);
            log.debug("Return 1 part of file : from ({}) to ({})", r.start, r.end);
            response.setContentType(contentType);
            response.setHeader(CONTENT_RANGE, String.format(BYTES_RANGE_FORMAT, r.start, r.end, r.total));
            response.setHeader(CONTENT_LENGTH, String.valueOf(r.length));
            response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT); // 206.

            // Copy single part range.
            Range.copy(inputStream, output, length, r.start, r.length, bufferSize);

        } else {

            // Return multiple parts of file.
            response.setContentType(CONTENT_TYPE_MULTITYPE_WITH_BOUNDARY);
            response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT); // 206.

            // Cast back to ServletOutputStream to get the easy println methods.
            ServletOutputStream sos = (ServletOutputStream) output;

            // Copy multi part range.
            for (Range r : ranges) {
                log.debug("Return multi part of file : from ({}) to ({})", r.start, r.end);
                // Add multipart boundary and header fields for every range.
                sos.println("--" + MULTIPART_BOUNDARY);
                sos.println(CONTENT_TYPE + ": " + contentType);
                sos.println(CONTENT_RANGE + ": " + String.format(BYTES_RANGE_FORMAT, r.start, r.end, r.total));

                //Mark position of inputstream so we can return to it later
                inputStream.mark(0);
                // Copy single part range of multi part range.
                Range.copy(inputStream, output, length, r.start, r.length, bufferSize);
                inputStream.reset();

                sos.println();
            }

            // End with multipart boundary.
            sos.println("--" + MULTIPART_BOUNDARY + "--");
        }
    }

}

From source file:org.openmrs.module.pmtct.util.FileExporter.java

/**
 * Auto generated method comment//from w  w w . j av a 2s  .  c om
 * 
 * @param request
 * @param response
 * @param patientList
 * @param filename
 * @param title
 * @throws Exception
 */
public void exportInfantsTestToCSVFile(HttpServletRequest request, HttpServletResponse response,
        List<Object> patientList, String filename, String title) throws Exception {
    ServletOutputStream outputStream = null;
    try {
        outputStream = response.getOutputStream();
        Patient p;
        Patient mother;
        PatientService ps = Context.getPatientService();

        response.setContentType("text/plain");
        response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
        outputStream.println("" + title);
        outputStream.println("Number of Patients: " + patientList.size());
        outputStream.println();
        outputStream.println("No. ,Identifier, Names, Mother's Names, Gender, Birthdate, Scheduled Visit");
        outputStream.println();

        int ids = 0;

        for (Object patient : patientList) {
            Object[] o = (Object[]) patient;

            p = ps.getPatient(Integer.parseInt(o[0].toString()));
            mother = pmtctTag.getChildMother(p.getPatientId());

            ids += 1;
            outputStream.println(ids + "," + p.getActiveIdentifiers().get(0).getIdentifier() + ","
                    + p.getPersonName() + "," + mother.getPersonName() + "," + p.getGender() + ","
                    + sdf.format(p.getBirthdate()) + "," + sdf.format(o[4]));
        }

        outputStream.flush();
    } catch (Exception e) {
        log.error(e.getMessage());
    } finally {
        if (null != outputStream)
            outputStream.close();
    }
}

From source file:it.cnr.icar.eric.server.interfaces.rest.FilePathURLHandler.java

private void writeDirectoryListingItem(ServletOutputStream os, RegistryObjectType member)
        throws IOException, RegistryException {
    String name = getClosestValue(member.getName());
    String desc = getClosestValue(member.getDescription());

    ServerRequestContext context = new ServerRequestContext("FilePathURLHandler.writeDirectoryListingItem",
            null);/*  w w  w. ja v a2  s. com*/
    ClassificationNodeType node = (ClassificationNodeType) qm.getRegistryObject(context,
            member.getObjectType());
    String objectType = node.getCode();

    if (member instanceof RegistryPackageType) {
        os.println("<a href=\"./" + name + "\">" + objectType + "</a>\t\t<a href=\"./" + name + "/\">" + name
                + "</a> \t" + desc + " <br/>");
    } else {
        if (member instanceof ExtrinsicObjectType) {
            os.println("<a href=\"./" + name + "\">" + objectType + "</a>\t\t<a href=\"./" + name
                    + "?getRepositoryItem=true\">" + name + "</a> \t" + desc + " <br/>");
        } else {
            os.println("<a href=\"./" + name + "\">" + objectType + "</a>\t\t" + name + "\t" + desc + " <br/>");
        }
    }
}

From source file:org.openmrs.module.pmtct.util.FileExporter.java

/**
 * Auto generated method comment/*from ww  w  .  ja v  a  2s .  c  o m*/
 * 
 * @param request
 * @param response
 * @param drugOrderList
 * @param filename
 * @param title
 * @throws Exception
 */
public void exportDrugToCSVFile(HttpServletRequest request, HttpServletResponse response,
        List<DrugOrder> drugOrderList, String filename, String title) throws Exception {
    ServletOutputStream outputStream = null;
    try {
        outputStream = response.getOutputStream();
        Patient p = (drugOrderList != null) ? drugOrderList.get(0).getPatient() : null;
        int count = 0;

        response.setContentType("text/plain");
        response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
        outputStream.println("" + title);
        outputStream.println();

        if (null != p) {
            outputStream.println("Identifier, " + p.getActiveIdentifiers().get(0).getIdentifier());
            outputStream.println("Names, " + p.getPersonName());
            outputStream.println("Gender, " + p.getGender());
        }
        outputStream.println();

        outputStream.println(
                "No., Item ordered, Dose/Units, Frequency, Instructions, Start date, Discontinued date");
        outputStream.println();
        for (DrugOrder drugOrder : drugOrderList) {
            count += 1;
            outputStream.println(count + ", " + drugOrder.getDrug().getName() + ", " + drugOrder.getDose() + " "
                    + drugOrder.getDoseUnits().getName().getName() + ", " + drugOrder.getFrequency() + ", "
                    + drugOrder.getInstructions() + ", " + sdf.format(drugOrder.getEffectiveStartDate()) + ", "
                    + sdf.format(drugOrder.getEffectiveStopDate()));
        }

        outputStream.flush();
    } catch (Exception e) {
        log.error(e.getMessage());
    } finally {
        if (null != outputStream)
            outputStream.close();
    }
}

From source file:org.openmrs.module.pmtct.util.FileExporter.java

/**
 * Auto generated method comment/*from ww w .  j a v a2s .c o m*/
 * 
 * @param request
 * @param response
 * @param patientList
 * @param filename
 * @param title
 * @throws Exception
 */
public void exportInfantsTestResumeToCSVFile(HttpServletRequest request, HttpServletResponse response,
        List<Object> patientList, String filename, String title) throws Exception {
    ServletOutputStream outputStream = null;
    try {
        outputStream = response.getOutputStream();
        Patient p;
        Patient mother;
        PatientService ps = Context.getPatientService();

        response.setContentType("text/plain");
        response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
        outputStream.println("" + title);
        outputStream.println("Number of Patients: " + patientList.size());
        outputStream.println();
        outputStream.println(
                "No. ,Identifier, Names, Mother's Names, Gender, Birthdate, Infant Feeding method, PCR Test Result, Ser. Test 9 months Result, Ser. Test 18 months Result");
        outputStream.println();

        int ids = 0;

        Encounter cpnEnc;

        for (Object patient : patientList) {
            Object[] o = (Object[]) patient;

            p = ps.getPatient(Integer.parseInt(o[0].toString()));
            mother = pmtctTag.getChildMother(p.getPatientId());

            cpnEnc = pmtctTag.getCPNEncounterInfo(p.getPatientId());

            ids += 1;
            outputStream.println(ids + "," + p.getActiveIdentifiers().get(0).getIdentifier() + ","
                    + p.getPersonName() + "," + mother.getPersonName() + "," + p.getGender() + ","
                    + sdf.format(p.getBirthdate()) + ","
                    + pmtctTag.lastObsValueByConceptId(p.getPatientId(), PMTCTConstants.INFANT_FEEDING_METHOD)
                    + "," + pmtctTag.getConceptNameById("" + o[4]) + ","
                    + pmtctTag.getConceptNameById("" + o[5]) + "," + pmtctTag.getConceptNameById("" + o[6]));
        }

        outputStream.flush();
    } catch (Exception e) {
        log.error(e.getMessage());
    } finally {
        if (null != outputStream)
            outputStream.close();
    }
}

From source file:pivotal.au.se.gemfirexdweb.controller.QueryController.java

@RequestMapping(value = "/query", method = RequestMethod.POST)
public String worksheetAction(@ModelAttribute("queryAttribute") QueryWindow queryAttribute, Model model,
        HttpServletResponse response, HttpServletRequest request, HttpSession session) throws Exception {
    if (session.getAttribute("user_key") == null) {
        logger.debug("user_key is null new Login required");
        response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login");
        return null;
    } else {/* www  . j  a v  a  2  s  . com*/
        Connection conn = AdminUtil.getConnection((String) session.getAttribute("user_key"));
        if (conn == null) {
            response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login");
            return null;
        } else {
            if (conn.isClosed()) {
                response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login");
                return null;
            }
        }

    }

    logger.debug("Received request to action SQL from query worksheet");
    logger.info(queryAttribute);

    UserPref userPrefs = (UserPref) session.getAttribute("prefs");

    ConnectionManager cm = ConnectionManager.getInstance();

    if (queryAttribute.getQuery() != null) {

        if (queryAttribute.getSaveWorksheet().equals("Y")) {
            response.setContentType(SAVE_CONTENT_TYPE);
            response.setHeader("Content-Disposition", "attachment; filename=" + FILENAME);

            ServletOutputStream out = response.getOutputStream();
            out.println(queryAttribute.getQuery());
            out.close();
            return null;
        }

        // retrieve connection
        Connection conn = cm.getConnection(session.getId());
        String query = queryAttribute.getQuery().trim();
        logger.debug("Query = " + query);

        String[] splitQueryStr = spiltQuery(query);

        CommandResult result = new CommandResult();

        if (query.length() > 0) {
            if (splitQueryStr.length == 1) {
                String s = checkForComments(query);
                s = s.trim();

                if (determineQueryType(s).equals("SELECT")) {
                    try {
                        final String explain = queryAttribute.getExplainPlan();
                        if (!explain.equals("N")) {
                            logger.debug("Need to run explain plan.");

                            String explainString = "";

                            if (explain.equals("Y")) {
                                explainString = "explain as xml %s";
                            } else if (explain.equals("T")) {
                                explainString = "explain %s";
                            }

                            String xPlan = QueryUtil.runExplainPlan(conn, String.format(explainString, query));
                            logger.debug("received xPath : " + xPlan);

                            if (explain.equals("Y")) {
                                model.addAttribute("explainresult", xPlan);
                            } else if (explain.equals("T")) {
                                model.addAttribute("explaintxtresult", xPlan);
                            }
                        } else {

                            if (queryAttribute.getShowMember().equals("Y")) {
                                String replace = "select dsid() as \"Member\",";

                                s = query.toLowerCase().replaceFirst("select", replace);
                            }

                            long start = System.currentTimeMillis();
                            Result res = QueryUtil.runQuery(conn, s, userPrefs.getMaxRecordsinSQLQueryWindow());
                            long end = System.currentTimeMillis();

                            double timeTaken = new Double(end - start).doubleValue();
                            DecimalFormat df = new DecimalFormat("#.##");

                            model.addAttribute("queryResults", res);
                            model.addAttribute("query", s);
                            model.addAttribute("querysql", s);
                            if (queryAttribute.getQueryCount().equals("Y")) {
                                model.addAttribute("queryResultCount", res.getRowCount());
                            }

                            if (queryAttribute.getElapsedTime().equals("Y")) {
                                model.addAttribute("elapsedTime", df.format(timeTaken / 1000));
                            }

                            addCommandToHistory(session, userPrefs, s);

                        }
                    } catch (Exception ex) {
                        result.setCommand(s);
                        result.setMessage(ex.getMessage() == null ? "Unable to run query" : ex.getMessage());
                        result.setRows(-1);
                        model.addAttribute("result", result);
                        model.addAttribute("query", s);
                    }
                } else {
                    if (s.length() > 0) {
                        if (determineQueryType(s).equals("COMMIT")) {
                            result = QueryUtil.runCommitOrRollback(conn, true, queryAttribute.getElapsedTime());
                            model.addAttribute("result", result);
                            if (result.getMessage().startsWith("SUCCESS")) {
                                addCommandToHistory(session, userPrefs, s);
                            }
                        } else if (determineQueryType(s).equals("ROLLBACK")) {
                            result = QueryUtil.runCommitOrRollback(conn, false,
                                    queryAttribute.getElapsedTime());
                            model.addAttribute("result", result);
                            if (result.getMessage().startsWith("SUCCESS")) {
                                addCommandToHistory(session, userPrefs, s);
                            }
                        } else if (determineQueryType(s).equals("CALL")) {

                            String procName = getProcName(s);

                            if (procName != null) {
                                String schema = null;

                                int x = procName.indexOf(".");
                                if (x != -1) {
                                    String newProcName = procName.substring((procName.indexOf(".") + 1));
                                    schema = procName.substring(0, (procName.indexOf(".")));
                                    procName = newProcName;
                                } else {
                                    schema = (String) session.getAttribute("schema");
                                }

                                logger.debug("schema for stored procedure = " + schema);
                                logger.debug("call statement called for proc with name " + procName);

                                // need to get schema name to check proc details
                                int numberOfDynamicResultSets = QueryUtil.checkForDynamicResultSetProc(conn,
                                        schema, procName);

                                if (numberOfDynamicResultSets > 0) {
                                    logger.debug("call statement with " + numberOfDynamicResultSets
                                            + " dynamic resultset(s)");
                                    try {
                                        List<Result> procResults = QueryUtil.runStoredprocWithResultSet(conn, s,
                                                userPrefs.getMaxRecordsinSQLQueryWindow(),
                                                numberOfDynamicResultSets);
                                        model.addAttribute("procresults", procResults);
                                        model.addAttribute("callstatement", procName);
                                        model.addAttribute("dynamicresults", numberOfDynamicResultSets);
                                        addCommandToHistory(session, userPrefs, s);
                                    } catch (Exception ex) {
                                        result.setCommand(s);
                                        result.setMessage(ex.getMessage() == null ? "Unable to run query"
                                                : ex.getMessage());
                                        result.setRows(-1);
                                        model.addAttribute("result", result);
                                        model.addAttribute("query", s);
                                    }
                                } else {
                                    result = QueryUtil.runCommand(conn, s, queryAttribute.getElapsedTime());
                                    model.addAttribute("result", result);
                                    if (result.getMessage().startsWith("SUCCESS")) {
                                        addCommandToHistory(session, userPrefs, s);
                                    }
                                }
                            } else {
                                result = QueryUtil.runCommand(conn, s, queryAttribute.getElapsedTime());
                                model.addAttribute("result", result);
                                if (result.getMessage().startsWith("SUCCESS")) {
                                    addCommandToHistory(session, userPrefs, s);
                                }
                            }
                        } else {
                            result = QueryUtil.runCommand(conn, s, queryAttribute.getElapsedTime());
                            model.addAttribute("result", result);
                            if (result.getMessage().startsWith("SUCCESS")) {
                                addCommandToHistory(session, userPrefs, s);
                            }
                        }

                    }
                }

            } else {
                logger.debug("multiple SQL statements need to be executed");
                SortedMap<String, Object> queryResults = handleMultipleStatements(splitQueryStr, conn,
                        userPrefs, queryAttribute, session);
                logger.debug("keys : " + queryResults.keySet());
                model.addAttribute("sqlResultMap", queryResults);
                model.addAttribute("statementsExecuted", queryResults.size());

            }
        }
    } else {
        if (ServletFileUpload.isMultipartContent(request)) {
            logger.debug("is multipartcontent request");
            FileItemFactory factory = new DiskFileItemFactory();
            ServletFileUpload upload = new ServletFileUpload(factory);
            List<?> fileItemsList = upload.parseRequest(request);

            logger.debug("fileItemList size = " + fileItemsList.size());
            Iterator<?> it = fileItemsList.iterator();
            while (it.hasNext()) {
                FileItem fileItemTemp = (FileItem) it.next();
                if (fileItemTemp.getFieldName().equals("sqlfilename")) {
                    QueryWindow qw = new QueryWindow();
                    qw.setQuery(fileItemTemp.getString());
                    model.addAttribute("queryAttribute", qw);
                    model.addAttribute("sqlfile", fileItemTemp.getName());
                }
            }
        }
    }

    return "query";
}