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:net.duckling.ddl.web.controller.team.CreateTeamController.java
private String getTeamDefaultAccess(HttpServletRequest request) { String[] a = request.getParameterValues("teamInfo"); if (a == null || a.length == 0) { return Team.DEFAULT_TEAM_VIEW_LIST; } else if (a.length == 1) { if ("teamcommunication".equals(a[0])) { return Team.DEFAULT_TEAM_VIEW_NOTIC; } else {/*from w w w. java2 s . co m*/ return Team.DEFAULT_TEAM_VIEW_LIST; } } else { return Team.DEFAULT_TEAM_VIEW_LIST; } }
From source file:org.easit.core.controllers.facebook.FacebookFriendsController.java
@RequestMapping(value = "/facebook/manageLists/{friendId}", method = RequestMethod.POST) public String manageLists(@PathVariable("friendId") String friendId, String fListId[], HttpServletRequest request) { String[] listids = request.getParameterValues("fListId[]"); List<Reference> currentLists = new ArrayList<Reference>(); List<String> newListIds = new ArrayList<String>(); newListIds = Arrays.asList(listids); currentLists = friendListsPerUser(facebook.friendOperations().getFriendLists(), friendId); for (Reference current : currentLists) { if (!(newListIds.contains(current.getId()))) facebook.friendOperations().removeFromFriendList(current.getId(), friendId); }/*from ww w. j a v a 2s. co m*/ for (String listId : newListIds) { if (!(currentLists.contains(listId))) facebook.friendOperations().addToFriendList(listId, friendId); } return "redirect:/facebook/friends"; }
From source file:com.surevine.alfresco.audit.listeners.RemoveDeletionMarkAuditEventListener.java
@Override public void setSpecificAuditMetadata(final Auditable auditable, final HttpServletRequest request, final JSONObject json, final BufferedHttpServletResponse response) throws JSONException { final String pathParam = request.getParameter("path"); final String[] nodeRefs = request.getParameterValues(AlfrescoJSONKeys.NODEREF); if (pathParam != null) { try {/*from w ww . j a v a 2 s . co m*/ setMetadataFromNodeRef(auditable, nodeRefResolver.getNodeRefFromPath(pathParam)); } catch (FileNotFoundException fne) { logger.warn("Could not find file for path: " + pathParam, fne); } } else if (nodeRefs.length == 0) { throw new RuntimeException("Expected either a path or nodeRef parameter. None found."); } else { setMetadataFromNodeRef(auditable, nodeRefResolver.getNodeRefFromGUID(nodeRefs[0])); } }
From source file:com.surevine.alfresco.audit.listeners.ImmediateArchiveAuditEventListener.java
@Override public void setSpecificAuditMetadata(final Auditable auditable, final HttpServletRequest request, final JSONObject json, final BufferedHttpServletResponse response) throws JSONException { final String pathParam = request.getParameter("path"); final String[] nodeRefs = request.getParameterValues(AlfrescoJSONKeys.NODEREF); if (pathParam != null) { // If the path parameter is non null then we resovle the nodeRef using the path. try {/* ww w . j av a2 s . com*/ setMetadataFromNodeRef(auditable, nodeRefResolver.getNodeRefFromPath(pathParam)); } catch (FileNotFoundException fne) { logger.warn("Could not find file for path: " + pathParam, fne); } } else if (nodeRefs.length == 0) { throw new RuntimeException("Expected either a path or nodeRef parameter. None found."); } else { setMetadataFromNodeRef(auditable, nodeRefResolver.getNodeRefFromGUID(nodeRefs[0])); } }
From source file:com.redhat.rhn.frontend.servlets.DumpFilter.java
private void logParameters(HttpServletRequest req) { Enumeration items = req.getParameterNames(); while (items.hasMoreElements()) { String name = (String) items.nextElement(); String[] values = req.getParameterValues(name); for (int i = 0; i < values.length; i++) { log.debug("Parameter: name [" + name + "] value [" + values[i] + "]"); }/*ww w . j a v a2 s . c o m*/ } }
From source file:org.openmrs.module.adminui.page.controller.metadata.locations.LocationPageController.java
/** * @param model/* w ww . ja va2 s. c o m*/ * @param location * @param errors * @param locationService * @param locationValidator * @param messageSource * @param request * @return */ @RequestMapping(value = "/save", method = RequestMethod.POST) public String post(PageModel model, @RequestParam(value = "locationId", required = false) @BindParams Location location, BindingResult errors, @SpringBean("locationService") LocationService locationService, @SpringBean("locationValidator") LocationValidator locationValidator, @SpringBean("messageSource") MessageSource messageSource, @RequestParam(required = false, value = "save") String saveFlag, @RequestParam(required = false, value = "retire") String retireFlag, HttpServletRequest request) { locationValidator.validate(location, errors); String[] locationTags = request.getParameterValues("locTags"); Set<LocationTag> tags = new HashSet<LocationTag>(); if (!ArrayUtils.isEmpty(locationTags)) { for (String x : locationTags) { LocationTag tag = locationService.getLocationTag(Integer.valueOf(x)); if (tag != null) { tags.add(tag); } } location.setTags(tags); } else { tags = null; } location.setTags(tags); LocationAttribute attr = new LocationAttribute(); List<LocationAttributeType> locationAttributeList = locationService.getAllLocationAttributeTypes(); for (LocationAttributeType locAttr : locationAttributeList) { attr.setLocationAttributeId(locAttr.getId()); attr.setValue(request.getParameter("attribute." + locAttr.getId())); attr.setLocation(location); } if (!errors.hasErrors()) { try { if (saveFlag.length() > 3) { locationService.saveLocation(location); request.getSession().setAttribute(UiCommonsConstants.SESSION_ATTRIBUTE_INFO_MESSAGE, "adminui.location.saved"); } else if (retireFlag.length() > 3) { String reason = request.getParameter("retireReason"); locationService.retireLocation(location, reason); request.getSession().setAttribute(UiCommonsConstants.SESSION_ATTRIBUTE_INFO_MESSAGE, "adminui.location.retired"); } return "redirect:/adminui/metadata/locations/manageLocations.page"; } catch (Exception e) { log.warn("Some error occurred while saving location details:", e); request.getSession().setAttribute(UiCommonsConstants.SESSION_ATTRIBUTE_ERROR_MESSAGE, "adminui.save.fail"); } } else { sendErrorMessage(errors, messageSource, request); } model.addAttribute("errors", errors); model.addAttribute("location", location); model.addAttribute("existingLocations", locationService.getAllLocations()); model.addAttribute("locationTags", locationService.getAllLocationTags()); model.addAttribute("attributeTypes", locationService.getAllLocationAttributeTypes()); return "metadata/locations/location"; }
From source file:cn.vlabs.umt.ui.actions.ManageApplicationAction.java
public ActionForward remove(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {// w w w .java 2 s. c o m AppService service = getAppService(); String[] appids = request.getParameterValues("appids"); if (appids != null) { for (String id : appids) { try { int appid = Integer.parseInt(id); service.deleteApplication(appid); } catch (NumberFormatException e) { } } } return showApps(mapping, form, request, response); }
From source file:com.alibaba.doris.admin.web.configer.module.action.NodeManageAction.java
/** * ?????MachineNode?????sequence? Preview *///from w ww . ja v a2 s . co m public void doPreview(Context context, Navigator nav, HttpServletRequest request) { String[] newNodes = request.getParameterValues("newNode"); if (newNodes == null || newNodes.length == 0) return; boolean isLegalMigrateNodes = PhysicalNodeUtil.isLegalMigrateNodes(newNodes); if (!isLegalMigrateNodes) { nav.redirectTo(WebConstant.NODE_MANAGE_LIST_LINK).withParameter("errorResult", "??MachineNode?????sequence???"); return; } StringBuilder nodes = new StringBuilder(); for (String node : newNodes) { if (StringUtils.isNotBlank(node)) { String[] item = node.split("#"); if (NumberUtils.isDigits(item[1])) { boolean isLegal = adminNodeService.checkLegalMigrateByIP(item[2], StoreNodeSequenceEnum.getTypeByValue(Integer.parseInt(item[1]))); if (isLegal) { nodes.append(node).append(","); } else { nav.redirectTo(WebConstant.NODE_MANAGE_LIST_LINK).withParameter("errorResult", "??MachineNode?????sequence???"); return; } } } } if (StringUtils.isBlank(nodes.toString())) { nav.redirectTo(WebConstant.NODE_MANAGE_LIST_LINK).withParameter("errorResult", "Node?"); } else { nav.redirectTo(WebConstant.NEW_NODES_PREVIEW_LINK) .withParameter("nodes", nodes.toString().substring(0, nodes.length() - 1)) .withParameter("isPreview", request.getParameter("isPreview")); ; } }
From source file:common.bind.CommonBindValidator.java
@Override protected void validate(Object command, Errors err, HttpServletRequest request) { if (required_field_arrays_marker != null && required_field_arrays != null) { String[] marker = request.getParameterValues(required_field_arrays_marker); if (marker != null) { if (required_field_vector) { for (int i = 0; i < required_field_arrays.length; i++) { for (int j = 0; j < marker.length; j++) { String s = request.getParameter( required_vector_name + "[" + marker[j] + "]." + required_field_arrays[i]); if (s == null || s.equals("")) { err.rejectValue(required_vector_name + "[" + marker[j] + "]", "required"); }//from ww w . jav a 2s. com } } } else { for (int i = 0; i < required_field_arrays.length; i++) { for (int j = 0; j < marker.length; j++) { String s = request.getParameter(required_field_arrays[i] + "[" + j + "]"); if (s == null || s.equals("")) { err.rejectValue(required_field_arrays[i], "required"); } } } } } } if (anti_spam_code != null) { String error_code = common.web.filters.Antispam.canAccess(request, request.getParameter(anti_spam_code), true); if (error_code != null) { err.reject(error_code); common.CommonAttributes.addErrorMessage(error_code, request); } } }
From source file:com.glaf.core.util.RequestUtils.java
/** * request??/*from w ww. java 2s .c o m*/ * * @param request * @param name * @return */ public static String getParameter(HttpServletRequest request, String name) { String value = request.getParameter(name); if (StringUtils.isEmpty(value)) { String[] values = request.getParameterValues(name); if (values != null && values.length > 0) { StringBuffer buff = new StringBuffer(); for (int i = 0; i < values.length; i++) { if (i < values.length - 1) { if (StringUtils.isNotEmpty(values[i])) { buff.append(values[i]).append(','); } } else { if (StringUtils.isNotEmpty(values[i])) { buff.append(values[i]); } } } if (StringUtils.isNotEmpty(buff.toString())) { value = buff.toString(); } } } return value; }