List of usage examples for org.springframework.web.context.request ServletWebRequest getParameterMap
@Override
public Map<String, String[]> getParameterMap()
From source file:org.cloudfoundry.identity.uaa.oauth.UaaAuthorizationEndpoint.java
private AuthorizationRequest getAuthorizationRequestForError(ServletWebRequest webRequest) { // If it's already there then we are in the approveOrDeny phase and we can use the saved request AuthorizationRequest authorizationRequest = (AuthorizationRequest) sessionAttributeStore .retrieveAttribute(webRequest, AUTHORIZATION_REQUEST); if (authorizationRequest != null) { return authorizationRequest; }/* ww w . j ava 2 s.c o m*/ Map<String, String> parameters = new HashMap<String, String>(); Map<String, String[]> map = webRequest.getParameterMap(); for (String key : map.keySet()) { String[] values = map.get(key); if (values != null && values.length > 0) { parameters.put(key, values[0]); } } try { return getOAuth2RequestFactory().createAuthorizationRequest(parameters); } catch (Exception e) { return getDefaultOAuth2RequestFactory().createAuthorizationRequest(parameters); } }
From source file:edu.jhuapl.openessence.controller.ReportController.java
/** * Returns a File Download Dialog for a file containing information in the data details grid. * * @param request the request contains needed parameters: the 'results' headers that appear in the grid * @param response the response object for this request *///from w w w. j a v a2 s .c o m @RequestMapping("/exportGridToFile") public void exportGridToFile(@RequestParam("dsId") JdbcOeDataSource ds, ServletWebRequest request, HttpServletResponse response) throws ErrorMessageException, IOException { TimeZone timezone = ControllerUtils.getRequestTimezone(request); response.setContentType("application/json;charset=utf-8"); final List<Filter> filters = new Filters().getFilters(request.getParameterMap(), ds, null, 0, null, 0); final List<Dimension> results = ControllerUtils.getResultDimensionsByIds(ds, request.getParameterValues("results")); final List<String> columnHeaders = new ArrayList<String>(); for (final Dimension result : results) { if (result.getDisplayName() != null) { columnHeaders.add(result.getDisplayName()); } else { columnHeaders.add(messageSource.getDataSourceMessage(result.getId(), ds)); } } final List<Dimension> accumulations = ControllerUtils.getAccumulationsByIds(ds, request.getParameterValues("accumId")); final List<OrderByFilter> sorts = new ArrayList<OrderByFilter>(); try { 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); } Collection<Record> points = new DetailsQuery().performDetailsQuery(ds, results, accumulations, filters, sorts, false, clientTimezone); response.setContentType("text/csv;charset=utf-8"); String filename = messageSource.getDataSourceMessage("panel.details.export.file", ds) + "-" + new DateTime().toString("yyyyMMdd'T'HHmmss") + ".csv"; response.setHeader("Content-disposition", "attachment; filename=" + filename); // Cache-Control = cache and Pragma = cache enable IE to download files over SSL. response.setHeader("Cache-Control", "cache"); response.setHeader("Pragma", "cache"); FileExportUtil.exportGridToCSV(response.getWriter(), columnHeaders.toArray(new String[columnHeaders.size()]), points, timezone); }
From source file:org.springframework.security.oauth2.provider.endpoint.AuthorizationEndpoint.java
private AuthorizationRequest getAuthorizationRequestForError(ServletWebRequest webRequest) { // If it's already there then we are in the approveOrDeny phase and we can use the saved request AuthorizationRequest authorizationRequest = (AuthorizationRequest) sessionAttributeStore .retrieveAttribute(webRequest, "authorizationRequest"); if (authorizationRequest != null) { return authorizationRequest; }/*from ww w.j a v a2 s.c o m*/ Map<String, String> parameters = new HashMap<String, String>(); Map<String, String[]> map = webRequest.getParameterMap(); for (String key : map.keySet()) { String[] values = map.get(key); if (values != null && values.length > 0) { parameters.put(key, values[0]); } } try { return getOAuth2RequestFactory().createAuthorizationRequest(parameters); } catch (Exception e) { return getDefaultOAuth2RequestFactory().createAuthorizationRequest(parameters); } }