Example usage for javax.servlet.http HttpServletRequest getParameterValues

List of usage examples for javax.servlet.http HttpServletRequest getParameterValues

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest getParameterValues.

Prototype

public String[] getParameterValues(String name);

Source Link

Document

Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.

Usage

From source file:com.krawler.spring.hrms.common.hrmsDocumentController.java

public ModelAndView deleteDocuments(HttpServletRequest request, HttpServletResponse response) {
    KwlReturnObject result;//w w w  .  ja  va2s . c  o m
    JSONObject jobj = new JSONObject();
    JSONObject jobj1 = new JSONObject();

    //Create transaction
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setName("JE_Tx");
    def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    def.setIsolationLevel(TransactionDefinition.ISOLATION_READ_UNCOMMITTED);
    TransactionStatus status = txnManager.getTransaction(def);

    try {
        HashMap<String, Object> requestParams = new HashMap<String, Object>();
        requestParams.put("ids", request.getParameterValues("ids"));
        String applicant = request.getParameter("applicant");
        applicant = StringUtil.checkForNull(applicant);
        if (applicant.equalsIgnoreCase("applicant")) {
            result = hrmsExtApplDocsDAOObj.deleteDocuments(requestParams);
        } else {
            result = documentDAOObj.deleteDocuments(requestParams);
        }
        if (result.isSuccessFlag()) {
            jobj.put("success", true);
        } else {
            jobj.put("success", false);
        }
        jobj1.put("data", jobj.toString());
        jobj1.put("valid", true);
        txnManager.commit(status);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        txnManager.rollback(status);
    } finally {
        return new ModelAndView("jsonView", "model", jobj1.toString());
    }
}

From source file:com.google.caja.ancillary.servlet.UploadPage.java

static void doUpload(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    // Process the uploaded items
    List<ObjectConstructor> uploads = Lists.newArrayList();

    if (ServletFileUpload.isMultipartContent(req)) {
        // Create a factory for disk-based file items
        DiskFileItemFactory factory = new DiskFileItemFactory();

        int maxUploadSizeBytes = 1 << 18;
        factory.setSizeThreshold(maxUploadSizeBytes); // In-memory threshold
        factory.setRepository(new File("/dev/null")); // Do not store on disk
        ServletFileUpload upload = new ServletFileUpload(factory);
        upload.setSizeMax(maxUploadSizeBytes);

        writeHeader(resp);/*from w w  w  .j ava 2s  .  c  om*/

        // Parse the request
        List<?> items;
        try {
            items = upload.parseRequest(req);
        } catch (FileUploadException ex) {
            ex.printStackTrace();
            resp.getWriter().write(Nodes.encode(ex.getMessage()));
            return;
        }

        for (Object fileItemObj : items) {
            FileItem item = (FileItem) fileItemObj; // Written for pre-generic java.
            if (!item.isFormField()) { // Then is a file
                FilePosition unk = FilePosition.UNKNOWN;
                String ct = item.getContentType();
                uploads.add((ObjectConstructor) QuasiBuilder.substV("({ i: @i, ip: @ip, it: @it? })", "i",
                        StringLiteral.valueOf(unk, item.getString()), "ip",
                        StringLiteral.valueOf(unk, item.getName()), "it",
                        ct != null ? StringLiteral.valueOf(unk, ct) : null));
            }
        }
    } else if (req.getParameter("url") != null) {
        List<URI> toFetch = Lists.newArrayList();
        boolean failed = false;
        for (String value : req.getParameterValues("url")) {
            try {
                toFetch.add(new URI(value));
            } catch (URISyntaxException ex) {
                if (!failed) {
                    failed = true;
                    resp.setStatus(500);
                    resp.setContentType("text/html;charset=UTF-8");
                }
                resp.getWriter().write("<p>Bad URI: " + Nodes.encode(ex.getMessage()));
            }
        }
        if (failed) {
            return;
        }
        writeHeader(resp);
        FilePosition unk = FilePosition.UNKNOWN;
        for (URI uri : toFetch) {
            try {
                Content c = UriFetcher.fetch(uri);
                if (c.isText()) {
                    uploads.add((ObjectConstructor) QuasiBuilder.substV("({ i: @i, ip: @ip, it: @it? })", "i",
                            StringLiteral.valueOf(unk, c.getText()), "ip",
                            StringLiteral.valueOf(unk, uri.toString()), "it",
                            StringLiteral.valueOf(unk, c.type.mimeType)));
                }
            } catch (IOException ex) {
                resp.getWriter()
                        .write("<p>" + Nodes.encode("Failed to fetch URI: " + uri + " : " + ex.getMessage()));
            }
        }
    } else {
        resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
        resp.getWriter().write("Content not multipart");
        return;
    }

    Expression notifyParent = (Expression) QuasiBuilder.substV(
            "window.parent.uploaded([@uploads*], window.name)", "uploads", new ParseTreeNodeContainer(uploads));
    StringBuilder jsBuf = new StringBuilder();
    RenderContext rc = new RenderContext(new JsMinimalPrinter(new Concatenator(jsBuf))).withEmbeddable(true);
    notifyParent.render(rc);
    rc.getOut().noMoreTokens();

    HtmlQuasiBuilder b = HtmlQuasiBuilder.getBuilder(DomParser.makeDocument(null, null));

    Writer out = resp.getWriter();
    out.write(Nodes.render(b.substV("<script>@js</script>", "js", jsBuf.toString())));
}

From source file:com.iorga.webappwatcher.RequestLogFilter.java

@SuppressWarnings("unchecked")
private RequestEventLog createRequestEventLog(final HttpServletRequest httpRequest, final String requestURI) {
    final RequestEventLog logRequest = EventLogManager.getInstance().addEventLog(RequestEventLog.class);
    logRequest.setRequestURI(requestURI);
    logRequest.setMethod(httpRequest.getMethod());
    final Enumeration<String> parameterNames = httpRequest.getParameterNames();
    final List<Parameter> parameters = new LinkedList<Parameter>();
    while (parameterNames.hasMoreElements()) {
        final String parameterName = parameterNames.nextElement();
        parameters.add(new Parameter(parameterName, httpRequest.getParameterValues(parameterName)));
    }//  w  w w.j a  v a  2s .c om
    logRequest.setParameters(parameters.toArray(new Parameter[parameters.size()]));
    final Enumeration<String> headerNames = httpRequest.getHeaderNames();
    final List<Header> headers = new LinkedList<Header>();
    while (headerNames.hasMoreElements()) {
        final String headerName = headerNames.nextElement();
        headers.add(new Header(headerName, httpRequest.getHeader(headerName)));
    }
    logRequest.setHeaders(headers.toArray(new Header[headers.size()]));
    final Principal userPrincipal = httpRequest.getUserPrincipal();
    if (userPrincipal != null) {
        logRequest.setPrincipal(userPrincipal.getName());
    }
    final Thread currentThread = Thread.currentThread();
    logRequest.setThreadName(currentThread.getName());
    logRequest.setThreadId(currentThread.getId());
    return logRequest;
}

From source file:m.c.m.proxyma.ProxymaConsoleServlet.java

/**
 * This method updates the passed ProxyFolder using the request parameters
 *
 * @param request the servlet request passed from edtit_rule.jsp
 * @return the ruleBean if all parameters are valid.
 */// w  w  w  . jav  a2s .  c  o  m
private void updateProxyFolderFromRequestParameters(HttpServletRequest request, ProxyFolderBean theFolder)
        throws NullArgumentException, IllegalArgumentException, UnsupportedEncodingException {

    //Obtain request parmeters
    String proxyFolderName = request.getParameter(GlobalConstants.EDIT_FORM_FOLDER_NAME);
    String destination = request.getParameter(GlobalConstants.EDIT_FORM_DESTINATION);
    String maxPostSize = request.getParameter(GlobalConstants.EDIT_FORM_MAX_POST_SIZE);
    String cacheProvider = request.getParameter(GlobalConstants.EDIT_FORM_CACHE_PROVIDER);
    String retriver = request.getParameter(GlobalConstants.EDIT_FORM_RETRIVER);
    String serializer = request.getParameter(GlobalConstants.EDIT_FORM_SERIALIZER);
    String[] preprocessors = request.getParameterValues(GlobalConstants.EDIT_FORM_PREPROCESSORS);
    String[] transformers = request.getParameterValues(GlobalConstants.EDIT_FORM_TRANSFORMERS);

    //updtate folder name
    theFolder.setFolderName(proxyFolderName);

    //Update destination
    theFolder.setDestination(destination);

    //update max Post Size
    theFolder.setMaxPostSize(Integer.parseInt(maxPostSize));

    //Update cahce provider class
    theFolder.setCacheProvider(cacheProvider);

    //update retriver class
    theFolder.setRetriver(retriver);

    //update serializer class
    theFolder.setSerializer(serializer);

    //Update preprocessors classes
    theFolder.getPreprocessors().removeAll(theFolder.getPreprocessors());
    if (preprocessors != null) {
        for (int i = 0; i < preprocessors.length; i++)
            theFolder.registerPreprocessor(preprocessors[i]);
    }

    //Update transformer classes
    theFolder.getTransformers().removeAll(theFolder.getTransformers());
    if (transformers != null) {
        for (int i = 0; i < transformers.length; i++)
            theFolder.registerTransformer(transformers[i]);
    }
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.users.UserMainHandler.java

/**
 * Remove a user./*from ww  w.  j a va 2  s .c  o  m*/
 */
private void removeUser(HttpServletRequest request) throws EnvoyServletException {
    HttpSession session = request.getSession();
    SessionManager sessionMgr = (SessionManager) session.getAttribute(SESSION_MANAGER);
    User loggedInUser = (User) sessionMgr.getAttribute(WebAppConstants.USER);

    String[] userIds = request.getParameterValues("radioBtn");
    if (userIds == null || request.getMethod().equalsIgnoreCase("get")) {
        return;
    }

    for (String userId : userIds) {
        if (loggedInUser.getUserId().equals(userId)) {
            CATEGORY.warn(loggedInUser.getUserName()
                    + " is trying to delete himself, which is not allowed in the system");
            continue;
        }
        String deps = UserHandlerHelper.checkForDependencies(userId, session);
        if (deps == null) {
            // removes the user
            UserHandlerHelper.removeUser(loggedInUser, userId);
            SetDefaultRoleUtil.removeDefaultRoles(userId);
            ProjectTMTBUsers ptu = new ProjectTMTBUsers();
            ptu.deleteAllTMTB(userId);
            try {
                Collection<?> userParameters = ServerProxy.getUserParameterManager().getUserParameters(userId);
                HibernateUtil.delete(userParameters);
            } catch (Exception e) {
                CATEGORY.error("Failed to remove user parameters.", e);
            }

            try {
                String hql = "from UserRoleImpl a where a.user=:userId";
                HashMap map = new HashMap();
                map.put("userId", userId);
                List roles = HibernateUtil.search(hql, map);
                HibernateUtil.delete(roles);
                roles = new ArrayList(HibernateUtil.search(hql, map));
            } catch (Exception e) {
                CATEGORY.error(e.getMessage(), e);
            }
        } else {
            CATEGORY.warn(
                    "Cannot delete user " + userId + " because of the following dependencies:\r\n" + deps);
            request.setAttribute(UserConstants.DEPENDENCIES, deps);
        }
    }
}

From source file:org.bedework.eventreg.web.AbstractController.java

/**
 * @param req request// w  ww .j  a va 2s  .co  m
 */
public void dumpRequest(final HttpServletRequest req) {
    try {
        @SuppressWarnings("unchecked")
        final Enumeration<String> names = req.getParameterNames();

        final String title = "Request parameters";

        debug(title + " - global info and uris");
        debug("getRequestURI = " + req.getRequestURI());
        debug("getRemoteUser = " + req.getRemoteUser());
        debug("getRequestedSessionId = " + req.getRequestedSessionId());
        debug("HttpUtils.getRequestURL(req) = " + req.getRequestURL());
        debug("query=" + req.getQueryString());
        debug("contentlen=" + req.getContentLength());
        debug("request=" + req);
        debug("parameters:");

        debug(title);

        while (names.hasMoreElements()) {
            final String key = names.nextElement();
            final String[] vals = req.getParameterValues(key);
            for (final String val : vals) {
                debug("  " + key + " = \"" + val + "\"");
            }
        }
    } catch (final Throwable t) {
        error(t);
    }
}

From source file:com.controller.ProjectsController.java

@RequestMapping(value = "/projects/inviteMembers/{projectId}", method = RequestMethod.POST)
public ModelAndView search(@ModelAttribute Skill skill, HttpServletRequest request,
        @PathVariable int projectId) {
    ModelAndView search = new ModelAndView("inviteMembers");
    search.addObject("active", "projects");
    if (!util.isLoggedIn(request)) {
        return new ModelAndView("redirect:" + loginRedirect);
    }// w ww  . j  a va2 s. co m
    if (util.userAcces(request) > 1) {
        search.addObject("isAdmin", true);
    }
    String[] technischeSkillscheck = request.getParameterValues("technischeSkills");
    search.addObject("technischeSkillschecked", technischeSkillscheck);

    String[] projectskillscheck = request.getParameterValues("projectskills");
    search.addObject("projectskillschecked", projectskillscheck);

    String region = request.getParameter("region");
    search.addObject("regionQueried", region);

    int businessUnit = Integer.parseInt(request.getParameter("businessUnit"));
    search.addObject("businessUnitQueried", businessUnit);

    int lengthTechnischeSkill = 0;
    int lengthProjectSkill = 0;
    if (technischeSkillscheck != null) {
        lengthTechnischeSkill += technischeSkillscheck.length;
    }
    if (projectskillscheck != null) {
        lengthProjectSkill += projectskillscheck.length;
    }

    String[] skills = new String[lengthTechnischeSkill + lengthProjectSkill];

    if (technischeSkillscheck != null) {
        System.arraycopy(technischeSkillscheck, 0, skills, 0, lengthTechnischeSkill);
    }
    if (projectskillscheck != null) {
        System.arraycopy(projectskillscheck, 0, skills, lengthTechnischeSkill, lengthProjectSkill);
    }
    List<Employee> list = sri.getEmployeesWithSkills(skills, region, businessUnit);
    search.addObject("employees", list);

    List<SkillType> skillTypes = st.getSkillTypes();
    search.addObject("skillTypes", skillTypes);

    List<Skill> alleSkills = ski.getSkills();
    search.addObject("alleSkills", alleSkills);

    List<Skill> projectskills = ski.getSkillWithProjectSkill();
    search.addObject("projectskills", projectskills);

    List<Skill> technischeSkills = ski.getSkillWithTechnischeSkill();
    search.addObject("technischeSkills", technischeSkills);

    return search;
}

From source file:org.openmrs.module.drugorderexport.web.controller.DrugOrderFormController.java

/**
 * @see org.springframework.web.servlet.mvc.SimpleFormController#onSubmit(javax.servlet.http.HttpServletRequest,
 *      javax.servlet.http.HttpServletResponse, java.lang.Object,
 *      org.springframework.validation.BindException)
 *//*from   ww  w . j a v a  2  s . c om*/

@SuppressWarnings("unchecked")
protected void doSearch(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response)
        throws Exception {

    List<Integer> patientIds = null;
    List<Patient> patients = new ArrayList<Patient>();
    List<Object[]> objectsList = new ArrayList<Object[]>();
    List<Integer> drugIds = new ArrayList<Integer>();
    List<Integer> drugsByConceptsIds = new ArrayList<Integer>();

    String checkedValueStr[] = null;
    int checkedValue = 0;

    String rdBtn = request.getParameter("rdBtn");
    DrugOrderService service = Context.getService(DrugOrderService.class);

    if (request.getParameterValues("checkValue") != null) {
        checkedValueStr = request.getParameterValues("checkValue");
        //log.info(">>>>>>>>>>>>>>>>>>checkedValue>>>>>>>>>>>>>>>>>> " + checkedValueStr[0]);
        checkedValue = Integer.parseInt(checkedValueStr[0]);
    }

    String gender = request.getParameter("gender"), mnAge = request.getParameter("minAge"),
            mxAge = request.getParameter("maxAge"), mnBirthdate = request.getParameter("minBirthdate"),
            mxBirthdate = request.getParameter("maxBirthdate"), anyOrAll = request.getParameter("anyOrAll"),
            startD = request.getParameter("startdate"), endD = request.getParameter("enddate");

    String[] drugs = request.getParameterValues("drugList");
    String[] drugsByConcepts = request.getParameterValues("drugConceptsList");

    /**********************************************************************************/
    // get drug by id
    if (drugs != null) {
        for (String drug : drugs) {
            drugIds.add(Integer.parseInt(drug));
        }
    } else {
        for (Drug d : service.getArvDrugs()) {
            drugIds.add(d.getDrugId());
        }
    }
    /**********************************************************************************/
    // get drug by concept id
    if (drugsByConcepts != null) {
        for (String conceptStr : drugsByConcepts) {
            drugsByConceptsIds.add(Integer.parseInt(conceptStr));
        }
    } else {
        for (Object obj[] : service.getArvDrugsByConcepts()) {
            drugsByConceptsIds.add((Integer) obj[0]);
        }
    }

    Date minBirthdate = null;
    Date maxBirthdate = null;
    Date minAge = null;
    Date maxAge = null;
    Date startDate = null;
    Date endDate = null;

    DrugOrderControllerMessage message = new DrugOrderControllerMessage();
    String arvConceptIds = DrugOrderExportUtil.gpGetARVConceptIds();
    String arvDrugIds = DrugOrderExportUtil.gpGetARVDrugsIds();
    /*
     * Data validation
     */
    SimpleDateFormat df = OpenmrsUtil.getDateFormat();
    if (startD != null && startD.length() != 0) {
        startDate = df.parse(startD);
    }
    if (endD != null && endD.length() != 0) {
        endDate = df.parse(endD);
    }

    if (mnBirthdate != null && mnBirthdate.length() != 0) {
        minBirthdate = df.parse(mnBirthdate);
    }
    if (mxBirthdate != null && mxBirthdate.length() != 0) {
        maxBirthdate = df.parse(mxBirthdate);
    }

    if (mxAge != null && mxAge.length() != 0) {
        maxAge = service.getDateObjectFormAge(Integer.parseInt(mxAge));
    }
    if (mnAge != null && mnAge.length() != 0) {
        minAge = service.getDateObjectFormAge(Integer.parseInt(mnAge));
    }

    if (rdBtn.equals("drugs")) {
        patientIds = service.searchDrugOrderByDrug(anyOrAll, startDate, endDate,
                service.getListOfDrugsByIds(drugIds), gender, minAge, maxAge, minBirthdate, maxBirthdate);

        if (checkedValue == 1) {
            List<Integer> allPatients = service.searchDrugOrderByDrug(anyOrAll, startDate, endDate,
                    service.getListOfDrugsByIds(drugIds), gender, minAge, maxAge, minBirthdate, maxBirthdate);

            patientIds = service.getActiveOnDrugsPatients(allPatients, arvDrugIds, endDate);

        }
    } else if (rdBtn.equals("concepts")) {
        patientIds = service.searchDrugOrderByDrugsConcepts(anyOrAll, startDate, endDate,
                service.getListOfDrugsByConceptsIds(drugsByConceptsIds), gender, minAge, maxAge, minBirthdate,
                maxBirthdate);

        if (checkedValue == 1)
            patientIds = service.searchDrugOrderByDrugActive(anyOrAll, startDate, endDate,
                    service.getListOfDrugsByConceptsIds(drugsByConceptsIds), gender, minAge, maxAge,
                    minBirthdate, maxBirthdate);

    }

    for (Integer patientId : patientIds) {
        Patient patient = new Patient();

        patient = Context.getPatientService().getPatient(patientId);

        if (!patient.getVoided())
            patients.add(patient);

        Date startTreatmentDate = null;
        Date lastEncounterDate = null;
        Date lastVisitDate = null;
        String startTreatmentDateStr = "";
        String lastEncounterDateStr = "";
        String lastVisitDateStr = "";

        if (service.getPatientLastVisitDate(patientId) != null) {
            lastVisitDate = service.getPatientLastVisitDate(patientId);
            lastVisitDateStr = lastVisitDate.toString();
        }
        if (service.getWhenPatStartedXRegimen(patientId, DrugOrderExportUtil.gpGetARVDrugsIds()) != null) {
            startTreatmentDate = service.getWhenPatientStarted(patient);
            startTreatmentDateStr = startTreatmentDate.toString();
        }
        if (service.getPatientLastEncounterDate(patientId) != null) {
            lastEncounterDate = service.getPatientLastEncounterDate(patientId);
            lastEncounterDateStr = lastEncounterDate.toString();
        }

        List<String> programs = new ArrayList<String>();
        String progAndDate = "";
        Collection<PatientProgram> patientPrograms = Context.getProgramWorkflowService()
                .getPatientPrograms(patient, null, null, null, null, null, false);
        Date date = null;
        if (endDate == null)
            endDate = new Date();
        for (PatientProgram pg : patientPrograms) {
            date = pg.getDateCompleted();
            if (date == null)
                progAndDate += pg.getProgram().getName() + "(Still Enrolled),";
            else if (date != null && date.getTime() <= endDate.getTime())
                progAndDate += pg.getProgram().getName() + " (Completed on " + df.format(pg.getDateCompleted())
                        + "),";
        }
        objectsList.add(new Object[] { Context.getPersonService().getPerson(patientId), startTreatmentDateStr,
                lastEncounterDateStr, lastVisitDateStr, progAndDate });
    }

    Date now = new Date();

    List<String> drugNames = new ArrayList<String>();
    String anyARVs = " ARVs";

    if (rdBtn.equals("drugs")) {
        for (Integer id : drugIds) {
            drugNames.add(Context.getConceptService().getDrug(id).getName());
        }
    }

    if (rdBtn.equals("concepts")) {

        for (Integer conceptId : drugsByConceptsIds) {
            //               if(Context.getConceptService().getDrug(conceptId)!=null)
            drugNames.add(Context.getConceptService().getConcept(conceptId).getName().toString());
        }
    }

    model.put("anyOrAll", anyOrAll);
    if (drugNames != null && drugNames.size() != 0) {
        model.put("drugList", drugNames.toString().substring(1, drugNames.toString().indexOf(']')));
        message.setDrugIds(drugNames.toString().substring(1, drugNames.toString().indexOf(']')));
    } else {
        model.put("drugList", anyARVs);
        message.setDrugIds(anyARVs);
    }

    if (startDate != null) {
        model.put("startdate", df.format(startDate));
        message.setStartDate(df.format(startDate) + "");
    }

    if (endDate != null) {
        model.put("enddate", df.format(endDate));
        message.setEndDate(df.format(endDate) + "");
    }

    if (gender.equals("f")) {
        model.put("gender", "Female");
        message.setGender("Female");
    } else if (gender.equals("")) {
        model.put("gender", "Any");
        message.setGender("Any");
    } else if (!gender.equals("m")) {
        model.put("gender", "Male");
        message.setGender("Male");
    }
    if (minAge != null) {
        model.put("minAge", now.getYear() - minAge.getYear());
        message.setMinAge(now.getYear() - minAge.getYear() + "");
    }
    if (maxAge != null) {
        model.put("maxAge", now.getYear() - maxAge.getYear());
        message.setMaxAge(now.getYear() - maxAge.getYear() + "");
    }
    if (minBirthdate != null) {
        model.put("minBirthdate", df.format(minBirthdate));
        message.setMinBirthdate(df.format(minBirthdate) + "");
    }
    if (maxBirthdate != null) {
        model.put("maxBirthdate", df.format(maxBirthdate));
        message.setMaxBirthdate(df.format(maxBirthdate) + "");
    }

    // for data exportation
    if (request.getParameter("export") != null && !request.getParameter("export").equals("")) {
        if (Context.getAuthenticatedUser().hasPrivilege("Export Collective Patient Data")) {
            if (request.getParameter("export").equals("excel"))
                DrugOrderExportUtil.exportData(request, response, patients);
            if (request.getParameter("export").equals("pdf"))
                DrugOrderExportUtil.exportToPDF(request, response, patients);
        } else {
            model.put("msg", "Required Privilege: [Export Collective Patient Data]");
        }
    }

    model.put("objectsList", objectsList);
    model.put("drugIdback", drugIds);
    model.put("conceptIdsback", drugsByConceptsIds);
    model.put("listSize", objectsList.size());
    model.put("checkedValueExport", checkedValue);
    model.put("rdBtn", rdBtn);

}

From source file:org.wiredwidgets.cow.server.web.TasksController.java

/**
 * Mark a task as complete The choice of DELETE here is based on the fact
 * that this action causes the resource (i.e. task) to be removed from its
 * location at the specified URL. Once completed, the task will then appear
 * under the /tasks/history URI. Response: http 204 if success, 404 if the
 * task was not found (i.e. an invalid task ID or a task that was already
 * completed)/*from   w  w  w .ja va  2s .  co m*/
 *
 * @param id the task ID
 * @param outcome the outgoing transition for the completed task. Required
 * if the task has more than one possible outcome.
 * @param variables variable assignments for the completed task, in
 * name:value format. More than one instance of this parameter can be
 * provided (e.g. ?variable=name1:value1&variable=name2:value2 etc)
 * @param response
 */
@RequestMapping(value = "/active/{id}", method = RequestMethod.DELETE)
@ResponseBody
public void completeTask(@PathVariable("id") String id,
        @RequestParam(value = "outcome", required = false) String outcome,
        @RequestParam(value = "var", required = false) String variables, HttpServletResponse response,
        HttpServletRequest request) {
    // verify existence

    Task task = taskService.getTask(Long.valueOf(id));

    if (task == null) {
        response.setStatus(HttpServletResponse.SC_NOT_FOUND); // 404
    } else {
        Map<String, Object> varMap = new HashMap<String, Object>();
        if (variables != null) {
            // Note: allowing Spring to create the array has some undesired behaviors in some cases.  For example
            // if the query string contains a comma, Spring treats it as multi-valued.
            // Since we don't want that, we instead use the underlying request object to get the array.
            String[] vars = request.getParameterValues("var");
            for (String variable : vars) {
                // variable is a string in the format name:value
                // Only split on the first ":" found; the value section may contain additional ":" tokens.
                String[] split = variable.split(":", 2);
                varMap.put(split[0], split[1]);
            }
        }
        //testHumanVars.completeTask(Long.valueOf(id), task.getAssignee(), varMap);
        log.debug("Completing task: id=" + id + " outcome=" + outcome);
        log.debug("Vars: " + varMap);

        taskService.completeTask(Long.valueOf(id), task.getAssignee(), outcome, varMap);

        response.setStatus(HttpServletResponse.SC_NO_CONTENT); // 204

        //Task t = taskService.getTask(id);
        //amqpNotifier.amqpTaskPublish(t, "process", "TaskCompleted", id);
    }
}

From source file:com.Accenture.Controller.Learnercontroller.java

@RequestMapping("/register")
public ModelAndView markregister1(HttpServletRequest request, HttpServletResponse res) {
    String message = "";
    String[] name = request.getParameterValues("name");
    String[] date = request.getParameterValues("date");
    String[] status = request.getParameterValues("status");
    String[] s = request.getParameterValues("s");
    String msg = request.getParameter("msg");

    for (int i = 0; i < name.length; i++) {
        mpojos.setLname(name[i]);/*from  w w  w  .  j a v a2s  .c o m*/
        mpojos.setDate(date[i]);
        mpojos.setStatus(status[i]);
        mpojos.setFname(s[i]);

        mdao.saveMarkRegister(mpojos);
    }
    return new ModelAndView("trainerlogin", "msg", msg);
}