List of usage examples for org.springframework.web.context.request WebRequest getParameterMap
Map<String, String[]> getParameterMap();
From source file:com.orchestra.portale.controller.ExternalServiceController.java
@RequestMapping(value = "/ciro/get") public @ResponseBody String getCiRo(WebRequest request) { Map<String, String[]> params = request.getParameterMap(); serviceDispacher.setService(new CiRoService(pm)); return serviceDispacher.getExternalServiceResponse(params); }
From source file:com.orchestra.portale.controller.ExternalServiceController.java
@RequestMapping(value = "/bikeSharing/get") public @ResponseBody String getBikeSharing(WebRequest request) { Map<String, String[]> params = request.getParameterMap(); serviceDispacher.setService(new BikeSharingService(pm)); return serviceDispacher.getExternalServiceResponse(params); }
From source file:com.launchkey.example.springmvc.DemoController.java
@RequestMapping(value = "/callback", method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.OK)/* w w w .j a v a 2s.c o m*/ public void callback(WebRequest request) throws AuthManager.AuthException { Map<String, String> callbackData = new HashMap<String, String>(); for (Map.Entry<String, String[]> entry : request.getParameterMap().entrySet()) { callbackData.put(entry.getKey(), entry.getValue()[0]); } authManager.handleCallback(callbackData); }
From source file:de.blizzy.documentr.web.system.SystemController.java
private SortedMap<String, SortedMap<String, String>> getMacroSettingsFromRequest(WebRequest webRequest) { Map<String, String[]> params = webRequest.getParameterMap(); SortedMap<String, SortedMap<String, String>> allMacroSettings = Maps.newTreeMap(); for (Map.Entry<String, String[]> entry : params.entrySet()) { String key = entry.getKey(); if (key.startsWith(MACRO_KEY_PREFIX)) { String[] values = entry.getValue(); if (values.length == 0) { values = new String[] { StringUtils.EMPTY }; }/*from ww w.ja v a 2s.c o m*/ key = key.substring(MACRO_KEY_PREFIX.length()); String macroName = StringUtils.substringBefore(key, "."); //$NON-NLS-1$ key = StringUtils.substringAfter(key, "."); //$NON-NLS-1$ SortedMap<String, String> macroSettings = allMacroSettings.get(macroName); if (macroSettings == null) { macroSettings = Maps.newTreeMap(); allMacroSettings.put(macroName, macroSettings); } macroSettings.put(key, values[0]); } } return allMacroSettings; }
From source file:org.lightadmin.core.web.RepositoryScopedSearchController.java
private Specification specificationFromRequest(WebRequest request, PersistentEntity<?, ?> persistentEntity) { return specificationCreator().toSpecification(persistentEntity, request.getParameterMap()); }
From source file:mailjimp.webhook.WebHookController.java
@SuppressWarnings("unchecked") private Map<String, Object> parseRequest(WebRequest request) { Map<String, String[]> parameterMap = request.getParameterMap(); Map<String, Object> convertible = new HashMap<String, Object>(); for (String parameterKey : parameterMap.keySet()) { Matcher matcher = DATA_PATTERN.matcher(parameterKey); if (matcher.matches()) { String key = matcher.group(INDEX_PARAM_NAME); Object value = parameterMap.get(parameterKey)[0]; if (null == matcher.group(INDEX_MAPPED_PARAM_NAME)) { // simple values convertible.put(key, value); } else if (null == matcher.group(INDEX_MAPPED_ARRAY_INDEX)) { // mapped values Map<String, Object> map = getMapParam(convertible, key); map.put(matcher.group(INDEX_MAPPED_PARAM_NAME), value); } else { // merge values in an array // If you like good coding don't read on! Map<String, Object> map = getMapParam(convertible, key); // now check for the array String arrayKey = matcher.group(INDEX_MAPPED_PARAM_NAME); int arrayIndex = Integer.valueOf(matcher.group(INDEX_MAPPED_ARRAY_INDEX)); if (null == map.get(arrayKey)) { map.put(arrayKey, new Object[] {}); }//from ww w . j av a 2 s . c o m Object[] array = (Object[]) map.get(arrayKey); while (array.length <= arrayIndex) { Object[] newArray = new Object[array.length + 1]; System.arraycopy(array, 0, newArray, 0, array.length); array = newArray; } if (null == array[arrayIndex]) { array[arrayIndex] = new HashMap<String, Object>(); } map.put(arrayKey, array); // noinspection unchecked ((Map<String, Object>) array[arrayIndex]).put(matcher.group(INDEX_MAPPED_ARRAY_PARAM_NAME), value); } } } return convertible; }
From source file:org.openmrs.module.sdmxhdintegration.web.controller.KeyFamilyAttributesDialogController.java
@RequestMapping(value = "/module/sdmxhdintegration/keyFamilyAttributesDialog", method = RequestMethod.POST) public String handleSubmission(WebRequest request, @RequestParam("messageId") Integer messageId, @RequestParam("attachmentLevel") String attachmentLevel, @RequestParam("keyFamilyId") String keyFamilyId, @RequestParam(value = "columnName", required = false) String columnName) { attachmentLevel = URLDecoder.decode(attachmentLevel); if (columnName != null) { columnName = URLDecoder.decode(columnName); }/*from ww w .j a v a2s .c o m*/ // get SDMXHDMessage Object in OMRS SDMXHDMessage sdmxhdMessage = Context.getService(SDMXHDService.class).getMessage(messageId); // get OMRS DSD DataSetDefinitionService dss = Context.getService(DataSetDefinitionService.class); SDMXHDCohortIndicatorDataSetDefinition omrsDSD = Utils.getOMRSDataSetDefinition(sdmxhdMessage, keyFamilyId); Map<String, String[]> paramMap = request.getParameterMap(); for (String key : paramMap.keySet()) { if (key.startsWith(ATTRIBUTE)) { String attributeValue = paramMap.get(key)[0]; if (attributeValue != null && attributeValue != "") { String attribute = key.replaceFirst(ATTRIBUTE, ""); if (attachmentLevel.equals("Dataset")) { omrsDSD.addDataSetAttribute(attribute, attributeValue); } else if (attachmentLevel.equals("Series")) { omrsDSD.addSeriesAttributesToColumn(columnName, attribute, attributeValue); } else if (attachmentLevel.equals("Observation")) { omrsDSD.addObsAttributesToCoulmn(columnName, attribute, attributeValue); } else { // error log.error("Attachment level is not one of 'DataSet', 'Series' or 'Observation'"); } } } } dss.saveDefinition(omrsDSD); return "redirect:redirectParent.form?url=keyFamilyAttributes.form?messageId=" + messageId + "%26keyFamilyId=" + keyFamilyId; }
From source file:de.blizzy.documentr.web.page.PageController.java
@RequestMapping(value = "/cherryPick/{projectName:" + DocumentrConstants.PROJECT_NAME_PATTERN + "}/" + "{branchName:" + DocumentrConstants.BRANCH_NAME_PATTERN + "}/" + "{path:" + DocumentrConstants.PAGE_PATH_URL_PATTERN + "}", method = RequestMethod.POST) @PreAuthorize("hasPagePermission(#projectName, #branchName, #path, VIEW)") public String cherryPick(@PathVariable String projectName, @PathVariable String branchName, @PathVariable String path, @RequestParam String version1, @RequestParam String version2, @RequestParam("branch") Set<String> targetBranches, @RequestParam boolean dryRun, WebRequest request, Model model, Authentication authentication, Locale locale) throws IOException { path = Util.toRealPagePath(path); for (String targetBranch : targetBranches) { if (!permissionEvaluator.hasPagePermission(authentication, projectName, targetBranch, path, Permission.EDIT_PAGE)) { return ErrorController.forbidden(); }/*from w ww. j a va 2 s . c om*/ } List<String> commits = cherryPicker.getCommitsList(projectName, branchName, path, version1, version2); if (commits.isEmpty()) { throw new IllegalArgumentException("no commits to cherry-pick"); //$NON-NLS-1$ } User user = userStore.getUser(authentication.getName()); Map<String, String[]> params = request.getParameterMap(); Set<CommitCherryPickConflictResolve> resolves = Sets.newHashSet(); for (Map.Entry<String, String[]> entry : params.entrySet()) { String name = entry.getKey(); if (name.startsWith("resolveText_")) { //$NON-NLS-1$ String branchCommit = StringUtils.substringAfter(name, "_"); //$NON-NLS-1$ String branch = StringUtils.substringBefore(branchCommit, "/"); //$NON-NLS-1$ String commit = StringUtils.substringAfter(branchCommit, "/"); //$NON-NLS-1$ String text = entry.getValue()[0]; CommitCherryPickConflictResolve resolve = new CommitCherryPickConflictResolve(branch, commit, text); resolves.add(resolve); } } Map<String, List<CommitCherryPickResult>> results = cherryPicker.cherryPick(projectName, branchName, path, commits, targetBranches, resolves, dryRun, user, locale); if (results.keySet().size() != targetBranches.size()) { throw new IllegalStateException(); } if (!dryRun) { boolean allOk = true; loop: for (List<CommitCherryPickResult> branchResults : results.values()) { for (CommitCherryPickResult result : branchResults) { if (result.getStatus() != CommitCherryPickResult.Status.OK) { allOk = false; break loop; } } } if (allOk) { return "redirect:/page/" + projectName + "/" + branchName + //$NON-NLS-1$ //$NON-NLS-2$ "/" + Util.toUrlPagePath(path); //$NON-NLS-1$ } } model.addAttribute("cherryPickResults", results); //$NON-NLS-1$ model.addAttribute("version1", version1); //$NON-NLS-1$ model.addAttribute("version2", version2); //$NON-NLS-1$ model.addAttribute("resolves", resolves); //$NON-NLS-1$ return "/project/branch/page/cherryPick"; //$NON-NLS-1$ }
From source file:org.openmrs.module.sdmxhdintegration.web.controller.MapDimensionDialogController.java
/** * Handles submission of dimension mapping dialog *//*from ww w . j av a 2 s. c o m*/ @RequestMapping(method = RequestMethod.POST) public String handleDialogSubmit(WebRequest request, @RequestParam("mappedOMRSDimensionId") Integer mappedOMRSDimensionId, @RequestParam("messageId") Integer messageId, @RequestParam("sdmxhdDimension") String sdmxhdDimension, @RequestParam("keyFamilyId") String keyFamilyId, @RequestParam(value = "fixedValueCheckbox", required = false) String fixedValueCheckbox, @RequestParam(value = "fixedValue", required = false) String fixedValue) throws Exception { sdmxhdDimension = URLDecoder.decode(sdmxhdDimension); SDMXHDMessage message = Context.getService(SDMXHDService.class).getMessage(messageId); SDMXHDCohortIndicatorDataSetDefinition omrsDSD = Utils.getDataSetDefinition(message, keyFamilyId); // delete previous mappings if there are any Integer omrsDimensionId = omrsDSD.getOMRSMappedDimension(sdmxhdDimension); if (omrsDimensionId != null) { // remove previous dimensions omrsDSD.removeDimension(omrsDimensionId + ""); // TODO remove all Columns that use that dimension (reporting ticket?) } omrsDSD.getOMRSMappedDimensions().remove(sdmxhdDimension); omrsDSD.getOMRSMappedDimensionOptions().remove(sdmxhdDimension); omrsDSD.getFixedDimensionValues().remove(sdmxhdDimension); if (fixedValueCheckbox != null) { omrsDSD.addFixedDimensionValues(sdmxhdDimension, fixedValue); } else { // Build up Dimension Options Map Map<String, String> mappedDimOpts = new HashMap<String, String>(); Map<String, String[]> paramMap = request.getParameterMap(); for (String key : paramMap.keySet()) { if (key.startsWith(DIM_OPT)) { String mappedSDMXHSDimension = key.replaceFirst(DIM_OPT, ""); String mappedOMRSDimension = paramMap.get(key)[0]; mappedDimOpts.put(mappedSDMXHSDimension, mappedOMRSDimension); } } // Map Dimension and Dimension options omrsDSD.mapDimension(sdmxhdDimension, mappedOMRSDimensionId, mappedDimOpts); // add dimension to DataSet DimensionService ds = Context.getService(DimensionService.class); CohortDefinitionDimension omrsDimension = ds.getDefinition(CohortDefinitionDimension.class, mappedOMRSDimensionId); omrsDimension.addParameters(IndicatorUtil.getDefaultParameters()); omrsDimension = (CohortDefinitionDimension) ds.saveDefinition(omrsDimension); omrsDSD.addDimension(mappedOMRSDimensionId + "", omrsDimension, IndicatorUtil.getDefaultParameterMappings()); } // save dataset DataSetDefinitionService dss = Context.getService(DataSetDefinitionService.class); dss.saveDefinition(omrsDSD); return "redirect:redirectParent.form?url=keyFamilyMapping.form?messageId=" + messageId + "%26keyFamilyId=" + keyFamilyId; }
From source file:edu.jhuapl.openessence.controller.ReportController.java
@RequestMapping("/detailsQuery") public @ResponseBody DataSourceDetails detailsQuery(WebRequest request, @RequestParam("dsId") JdbcOeDataSource ds, @RequestParam(value = "firstrecord", defaultValue = "0") long firstRecord, @RequestParam(value = "pagesize", defaultValue = "200") long pageSize) throws ErrorMessageException, OeDataSourceException, OeDataSourceAccessException { List<Filter> filters = new Filters().getFilters(request.getParameterMap(), ds, null, 0, null, 0); List<Dimension> results = ControllerUtils.getResultDimensionsByIds(ds, request.getParameterValues("results")); List<Dimension> accumulations = ControllerUtils.getAccumulationsByIds(ds, request.getParameterValues("accumId")); final List<OrderByFilter> sorts = new ArrayList<OrderByFilter>(); try {//from www. j a v a2 s.co m sorts.addAll(Sorters.getSorters(request.getParameterMap())); } catch (Exception e) { log.warn("Unable to get sorters, using default ordering"); } String clientTimezone = null; String timezoneEnabledString = messageSource.getMessage(TIMEZONE_ENABLED, "false"); if (timezoneEnabledString.equalsIgnoreCase("true")) { clientTimezone = ControllerUtils.getRequestTimezoneAsHourMinuteString(request); } return new DetailsQuery().performDetailsQuery(ds, results, accumulations, filters, sorts, false, clientTimezone, firstRecord, pageSize, true); }