List of usage examples for javax.servlet.http HttpServletRequest getParameterValues
public String[] getParameterValues(String name);
String
objects containing all of the values the given request parameter has, or null
if the parameter does not exist. From source file:com.tremolosecurity.proxy.auth.SAML2Auth.java
@Override public void doGet(HttpServletRequest req, HttpServletResponse resp, AuthStep as) throws ServletException, IOException { HttpSession session = req.getSession(true); if (req.getParameter("SAMLResponse") != null) { String[] resps = req.getParameterValues("SAMLResponse"); if (logger.isDebugEnabled()) { for (int i = 0; i < resps.length; i++) { logger.debug(resps[i]);/*from w ww .ja va2s .c o m*/ } } String b64resp = resps[0]; } else { RequestHolder reqHolder = ((AuthController) session.getAttribute(ProxyConstants.AUTH_CTL)).getHolder(); HashMap<String, Attribute> authParams = (HashMap<String, Attribute>) session .getAttribute(ProxyConstants.AUTH_MECH_PARAMS); Attribute jumpPage = authParams.get("jumpPage"); if (jumpPage != null && jumpPage.getValues().size() == 1 && !jumpPage.getValues().get(0).isEmpty()) { if (logger.isDebugEnabled()) { Enumeration enumer = req.getHeaderNames(); while (enumer.hasMoreElements()) { String name = (String) enumer.nextElement(); logger.debug("Header '" + name + "'='" + req.getHeader(name) + "'"); } } //String referer = req.getHeader("Referer"); String isJump = req.getParameter("isJump"); if (isJump != null && isJump.equalsIgnoreCase("true")) { logger.debug("initializing SSO"); this.initializeSSO(req, resp, session, false, null); } else { this.initializeSSO(req, resp, session, true, jumpPage.getValues().get(0)); } } else { this.initializeSSO(req, resp, session, false, null); } } }
From source file:com.manydesigns.portofino.actions.admin.page.PageAdminAction.java
public Resolution updateLayout() { HttpServletRequest request = context.getRequest(); Enumeration parameters = request.getParameterNames(); while (parameters.hasMoreElements()) { String parameter = (String) parameters.nextElement(); if (parameter.startsWith("embeddedPageAction_")) { String layoutContainer = parameter.substring("embeddedPageAction_".length()); String[] embeddedPageActionIds = request.getParameterValues(parameter); updateLayout(layoutContainer, embeddedPageActionIds); }/*from w w w . j a v a 2 s. c o m*/ } try { DispatcherLogic.savePage(getPageInstance()); } catch (Exception e) { logger.error("Error updating layout", e); SessionMessages.addErrorMessage(ElementsThreadLocals.getText("layout.update.failed")); } return new RedirectResolution(originalPath); }
From source file:com.controller.ProfilesController.java
@RequestMapping(value = "/profiles", method = RequestMethod.POST) public String search(HttpServletRequest request, Model model) { model.addAttribute("active", "profiles"); if (!util.isLoggedIn(request)) { return "redirect:" + loginRedirect; }/* www. j a v a 2 s .co m*/ if (util.userAcces(request) > 1) { model.addAttribute("isAdmin", true); } String[] technischeSkillscheck = request.getParameterValues("technischeSkills"); model.addAttribute("technischeSkillschecked", technischeSkillscheck); String[] projectskillscheck = request.getParameterValues("projectskills"); model.addAttribute("projectskillschecked", projectskillscheck); String region = request.getParameter("region"); model.addAttribute("regionQueried", region); int businessUnit = Integer.parseInt(request.getParameter("businessUnit")); model.addAttribute("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); model.addAttribute("employees", list); List<SkillType> skillTypes = st.getSkillTypes(); model.addAttribute("skillTypes", skillTypes); List<Skill> alleSkills = ski.getSkills(); model.addAttribute("alleSkills", alleSkills); List<Skill> projectskills = ski.getSkillWithProjectSkill(); model.addAttribute("projectskills", projectskills); List<Skill> technischeSkills = ski.getSkillWithTechnischeSkill(); model.addAttribute("technischeSkills", technischeSkills); return "profiles"; }
From source file:edu.lternet.pasta.portal.AdvancedSearchServlet.java
/** * The doPost method of the servlet. <br> * /*w w w. ja v a 2 s .c o m*/ * This method is called when a form has its tag value method equals to post. * * @param request * the request send by the client to the server * @param response * the response send by the server to the client * @throws ServletException * if an error occurred * @throws IOException * if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String forward = "./searchResult.jsp"; String html = ""; TermsList termsList = null; String termsListHTML = ""; String xml = null; HttpSession httpSession = request.getSession(); String uid = (String) httpSession.getAttribute("uid"); if (uid == null || uid.isEmpty()) uid = "public"; String boundaryContained = request.getParameter("boundaryContained"); String boundsChangedCount = request.getParameter("boundsChangedCount"); String dateField = request.getParameter("dateField"); String startDate = request.getParameter("startDate"); String endDate = request.getParameter("endDate"); String datesContained = request.getParameter("datesContained"); String creatorOrganization = request.getParameter("creatorOrganization"); String creatorName = request.getParameter("creatorName"); String locationName = request.getParameter("locationName"); String namedTimescale = request.getParameter("namedTimescale"); String[] siteValues = request.getParameterValues("siteValues"); String subjectField = request.getParameter("subjectField"); String subjectValue = request.getParameter("subjectValue"); String specific = request.getParameter("specific"); String related = request.getParameter("related"); String relatedSpecific = request.getParameter("relatedSpecific"); String ecotrends = request.getParameter("ecotrends"); String landsat5 = request.getParameter("landsat5"); String taxon = request.getParameter("taxon"); String identifier = request.getParameter("identifier"); String northBound = request.getParameter("northBound"); String southBound = request.getParameter("southBound"); String eastBound = request.getParameter("eastBound"); String westBound = request.getParameter("westBound"); boolean isBoundaryContainedChecked = (boundaryContained != null); boolean isDatesContainedChecked = (datesContained != null); boolean isIncludeEcotrendsChecked = (ecotrends != null); boolean isIncludeLandsat5Checked = (landsat5 != null); boolean isSpecificChecked = (specific != null); boolean isRelatedChecked = (related != null); boolean isRelatedSpecificChecked = (relatedSpecific != null); SolrAdvancedSearch solrAdvancedSearch = new SolrAdvancedSearch(creatorName, creatorOrganization, dateField, startDate, endDate, namedTimescale, siteValues, subjectField, subjectValue, isIncludeEcotrendsChecked, isIncludeLandsat5Checked, isDatesContainedChecked, isSpecificChecked, isRelatedChecked, isRelatedSpecificChecked, taxon, identifier, isBoundaryContainedChecked, boundsChangedCount, northBound, southBound, eastBound, westBound, locationName); try { xml = solrAdvancedSearch.executeSearch(uid); String queryText = solrAdvancedSearch.getQueryString(); httpSession.setAttribute("queryText", queryText); termsList = solrAdvancedSearch.getTermsList(); if ((termsList != null) && (termsList.size() > 0)) { termsListHTML = termsList.toHTML(); httpSession.setAttribute("termsListHTML", termsListHTML); } ResultSetUtility resultSetUtility = null; if (uid.equals("public")) { resultSetUtility = new ResultSetUtility(xml, Search.DEFAULT_SORT); } else { boolean isSavedDataPage = false; SavedData savedData = new SavedData(uid); resultSetUtility = new ResultSetUtility(xml, Search.DEFAULT_SORT, savedData, isSavedDataPage); } String mapButtonHTML = resultSetUtility.getMapButtonHTML(); request.setAttribute("mapButtonHTML", mapButtonHTML); //String relevanceHTML = resultSetUtility.getRelevanceHTML(); //request.setAttribute("relevanceHTML", relevanceHTML); html = resultSetUtility.xmlToHtmlTable(cwd + xslpath); request.setAttribute("searchresult", html); RequestDispatcher requestDispatcher = request.getRequestDispatcher(forward); requestDispatcher.forward(request, response); } catch (Exception e) { handleDataPortalError(logger, e); } }
From source file:com.photon.phresco.framework.actions.applications.Applications.java
public String delete() { S_LOGGER.debug("Entering Method Applications.delete()"); try {//from w ww .ja va 2 s.com HttpServletRequest request = (HttpServletRequest) ActionContext.getContext() .get(ServletActionContext.HTTP_REQUEST); String selectedProjects[] = request.getParameterValues(REQ_SELECTEDPROJECTS); ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator(); List<String> projectCodes = new ArrayList<String>(); if (selectedProjects != null) { for (String selctedProject : selectedProjects) { projectCodes.add(selctedProject); } } administrator.deleteProject(projectCodes); addActionMessage(SUCCESS_PROJECT_DELETE); } catch (Exception e) { S_LOGGER.error( "Entered into catch block of Applications.delete()" + FrameworkUtil.getStackTraceAsString(e)); new LogErrorReport(e, "Project delete"); } return list(); }
From source file:com.archsystemsinc.ipms.sec.webapp.controller.MeetingController.java
@RequestMapping(value = "/new-meetingagenda/{mid}", method = RequestMethod.POST) public String newMeetingAgendaItem(@PathVariable("mid") final Long mid, @Valid @ModelAttribute("meetingAgendaItem") final MeetingAgendaItem meetingAgendaItem, final BindingResult result, final Model model, HttpServletRequest httpServletRequest, final java.security.Principal principal) { String returnView = ""; final com.archsystemsinc.ipms.sec.model.Principal currentUser = principalService .findByName(principal.getName()); meetingAgendaItem.setMeetingAgendaOwner(currentUser); if (result.hasErrors()) { returnView = "agendasadd"; model.addAttribute("meetingAgendaItem", meetingAgendaItem); model.addAttribute("referenceData", referenceData()); } else {//from w w w . j av a2s .c o m Meeting meeting = service.findOne(mid); meetingAgendaItem.setMeeting(meeting); String[] facilitatornames = httpServletRequest.getParameterValues("facilitatorname"); String[] items = httpServletRequest.getParameterValues("item"); //meetingAgendaItem.setDiscussionAgendas(discussionAgendas); MeetingAgendaItem agendaItem = meetingAgendaItemService.create(meetingAgendaItem); for (int i = 0; i < facilitatornames.length; i++) { DiscussionAgenda discussionAgenda = new DiscussionAgenda(); discussionAgenda.setFacilitatorname(facilitatornames[i]); discussionAgenda.setItem(items[i]); discussionAgenda.setMeetingAgendaItem(agendaItem); discussionAgendaService.create(discussionAgenda); } returnView = "redirect:/app/meeting/" + mid; } return returnView; }
From source file:com.enonic.vertical.adminweb.AdminHandlerBaseServlet.java
private ExtendedMap parseSimpleRequest(HttpServletRequest request, boolean keepEmpty) { ExtendedMap formItems = new ExtendedMap(keepEmpty); Enumeration paramNames = request.getParameterNames(); while (paramNames.hasMoreElements()) { String key = paramNames.nextElement().toString(); String[] paramValues = request.getParameterValues(key); if (paramValues != null) { if (paramValues.length == 1 && paramValues[0] != null) { String value = paramValues[0]; if (value.length() > 0) { if ("true".equals(value)) { formItems.putBoolean(key, true); } else if ("false".equals(value)) { formItems.putBoolean(key, false); } else { formItems.putString(key, value); }/*from www .j av a 2s.co m*/ } else if (keepEmpty) { formItems.putString(key, value); } } else if (paramValues.length > 1) { formItems.put(key, paramValues); } } } return formItems; }
From source file:com.jsmartframework.web.manager.ExpressionHandler.java
String handleSubmitExpression(String expr, String jParam) throws ServletException, IOException { Object response = null;/*from www . j a v a2 s .c o m*/ Matcher matcher = EL_PATTERN.matcher(expr); if (matcher.find()) { String beanMethod = matcher.group(1); String[] methodSign = beanMethod.split(Constants.EL_SEPARATOR); HttpServletRequest request = WebContext.getRequest(); if (methodSign.length > 0 && WebContext.containsAttribute(methodSign[0])) { Object bean = getExpressionBean(methodSign[0]); String elBeanMethod = String.format(Constants.JSP_EL, beanMethod); // Check authorization to execute method if (!HANDLER.checkExecuteAuthorization(bean, elBeanMethod, request)) { return null; } // Call mapped method with @PreSubmit / @PreAction annotation for specific action boolean preActionValidated = HANDLER.executePreSubmit(bean, methodSign[methodSign.length - 1]); preActionValidated &= HANDLER.executePreAction(bean, methodSign[methodSign.length - 1]); if (preActionValidated) { Object[] arguments = null; String[] paramArgs = request.getParameterValues(TagHandler.J_SBMT_ARGS + jParam); AnnotatedFunction function = HANDLER.beanMethodFunctions.get(beanMethod); if (paramArgs != null) { arguments = new Object[paramArgs.length]; boolean unescape = HANDLER.containsUnescapeMethod(methodSign); for (int i = 0; i < paramArgs.length; i++) { if (function != null) { Class<?> argClass = function.getArgumentType(i); if (argClass != null && !Primitives.isPrimitive(argClass) && !argClass.equals(String.class)) { arguments[i] = GSON.fromJson(paramArgs[i], argClass); continue; } } arguments[i] = unescape ? paramArgs[i] : escapeValue(paramArgs[i]); } } // Call submit method ELContext context = WebContext.getPageContext().getELContext(); MethodExpression methodExpr = WebContext.getExpressionFactory().createMethodExpression(context, elBeanMethod, null, arguments != null ? new Class<?>[arguments.length] : new Class<?>[] {}); response = methodExpr.invoke(context, arguments); if (function != null && function.hasProduces()) { switch (function.getProduces()) { case JSON: WebContext.writeResponseAsJson(response); break; case XML: WebContext.writeResponseAsXmlQuietly(response); break; case STRING: WebContext.writeResponseAsString(response.toString()); break; } // Reset response to be passed to path analysis response = null; } // Call mapped method with @PostSubmit / @PostAction annotation for specific action HANDLER.executePostSubmit(bean, methodSign[methodSign.length - 1]); HANDLER.executePostAction(bean, methodSign[methodSign.length - 1]); } } } return response != null ? response.toString() : null; }
From source file:com.liusoft.dlog4j.action.DlogAction.java
/** * ?(???)//from w ww . ja v a 2 s .c om * @param mapping * @param form * @param request * @param response * @return * @throws Exception * http://localhost/dlog/user.do?sid=1&uid=223&eventSubmit_DelFriend */ protected ActionForward doUnblockUser(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { FormBean fbean = (FormBean) form; validateClientId(request, fbean); String msg = null; //? SessionUserObject loginUser = super.getLoginUser(request, response, false); if (loginUser != null) { String[] uids = request.getParameterValues("uid"); UserDAO.deleteBlacklist(loginUser.getId(), uids); msg = getMessage(request, null, "error.user_delete_from_block", ""); } else msg = getMessage(request, null, "error.user_not_login"); return msgbox(mapping, form, request, response, msg, fbean.getFromPage()); }
From source file:com.liusoft.dlog4j.action.DlogAction.java
/** * ?/*from ww w . jav a 2 s. c o m*/ * @param mapping * @param form * @param request * @param response * @return * @throws Exception * http://localhost/dlog/user.do?sid=1&uid=223&eventSubmit_DelFriend */ protected ActionForward doDelFriend(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { FormBean fbean = (FormBean) form; validateClientId(request, fbean); String msg = null; //? SessionUserObject loginUser = super.getLoginUser(request, response, false); if (loginUser != null) { String[] uids = request.getParameterValues("uid"); int er = UserDAO.deleteFriend(loginUser.getId(), uids); if (er > 0) msg = getMessage(request, null, "error.friend_deleted"); } else msg = getMessage(request, null, "error.user_not_login"); return msgbox(mapping, form, request, response, msg, fbean.getFromPage()); }