List of usage examples for javax.servlet.http HttpServletRequest getParameterMap
public Map<String, String[]> getParameterMap();
From source file:gov.nih.nci.firebird.web.interceptor.FirebirdExceptionHandlingInterceptor.java
@SuppressWarnings("rawtypes") // parameters map is untyped private String getRequestParametersString() { HttpServletRequest request = ServletActionContext.getRequest(); StringBuilder sb = new StringBuilder(); for (Object entryObject : request.getParameterMap().entrySet()) { Map.Entry entry = (Map.Entry) entryObject; sb.append(entry.getKey());// w ww . ja va 2 s .co m sb.append(" = "); sb.append(StringUtils.join((Object[]) entry.getValue(), ",")); sb.append('\n'); } return sb.toString(); }
From source file:net.shopxx.plugin.alipayDualPayment.AlipayDualPaymentPlugin.java
@Override public boolean verifyNotify(PaymentPlugin.NotifyMethod notifyMethod, HttpServletRequest request) { PluginConfig pluginConfig = getPluginConfig(); PaymentLog paymentLog = getPaymentLog(request.getParameter("out_trade_no")); if (paymentLog != null && generateSign(request.getParameterMap()).equals(request.getParameter("sign")) && pluginConfig.getAttribute("partner").equals(request.getParameter("seller_id")) && ("WAIT_SELLER_SEND_GOODS".equals(request.getParameter("trade_status")) || "TRADE_SUCCESS".equals(request.getParameter("trade_status")) || "TRADE_FINISHED".equals(request.getParameter("trade_status"))) && paymentLog.getAmount().compareTo(new BigDecimal(request.getParameter("total_fee"))) == 0) { Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("service", "notify_verify"); parameterMap.put("partner", pluginConfig.getAttribute("partner")); parameterMap.put("notify_id", request.getParameter("notify_id")); if ("true".equals(WebUtils.post("https://mapi.alipay.com/gateway.do", parameterMap))) { return true; }// w w w . j a v a 2 s .c o m } return false; }
From source file:org.opentestsystem.authoring.testauth.rest.FileGroupController.java
@RequestMapping(value = "/fileGroup", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Secured({ "ROLE_Result Upload Read" }) @ResponseBody/*from w w w. j a va 2s . co m*/ public SearchResponse<FileGroup> searchFileGroup(final HttpServletRequest request, final HttpServletResponse response) { return this.fileGroupService.searchFileGroups(request.getParameterMap()); }
From source file:com.job.portal.servlets.CompanyServlet.java
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); JSONObject obj = new JSONObject(); JSONArray arr = null;//from w w w .ja v a2s.com String param = null; Map<String, String[]> m = request.getParameterMap(); CompanyManager cm = new CompanyManager(); HttpSession sess = request.getSession(false); UserDetails ud = (UserDetails) sess.getAttribute("user"); CompanyMaster cMaster = null; try { obj.put("status", false); if (request.getParameter("param") != null) { param = request.getParameter("param"); if (param.equalsIgnoreCase("addCompany")) { cMaster = cm.addCompany(m, ud); if (cMaster != null && cMaster.getCompanyId() > 0) { obj.put("status", true); obj.put("msg", "Company added"); } else { obj.put("msg", "There seems to be some problem try again later"); } } } } catch (Exception e) { LogOut.log.error("In " + new Object() { }.getClass().getEnclosingClass().getName() + "." + new Object() { }.getClass().getEnclosingMethod().getName() + " " + e); } finally { out.close(); } }
From source file:pt.ist.fenix.ui.spring.HomepageAdminController.java
@RequestMapping(value = "/activePages", method = RequestMethod.POST) public RedirectView editActivePages(HttpServletRequest request) { HomepageSite homepage = loggedPerson().getHomepage(); if (homepage != null) { atomic(() -> service.dynamicPages(homepage).forEach( page -> page.setPublished(request.getParameterMap().keySet().contains(page.getSlug())))); }/*from w w w . java 2 s .c o m*/ return new RedirectView("/personal-homepage", true); }
From source file:com.jaspersoft.jasperserver.rest.services.RESTRole.java
@Override protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServiceException { WSRole role = restUtils.populateServiceObject(req.getPathInfo(), req.getParameterMap(), WSRole.class); WSRoleSearchCriteria criteria = restUtils.populateServiceObject(req.getPathInfo(), req.getParameterMap(), WSRoleSearchCriteria.class); WSRole[] roles = null;/*ww w .j av a 2 s . c om*/ try { roles = userAndRoleManagementService.findRoles(criteria); if (roles != null && roles.length != 0) { userAndRoleManagementService.deleteRole(role); if (log.isDebugEnabled()) { log.debug(role + " role were deleted"); } } else { throw new ServiceException(HttpServletResponse.SC_NOT_FOUND, "role: " + role + " was not found"); } } catch (AxisFault axisFault) { throw new ServiceException(HttpServletResponse.SC_BAD_REQUEST, axisFault.getLocalizedMessage()); } restUtils.setStatusAndBody(HttpServletResponse.SC_OK, resp, ""); }
From source file:org.opentestsystem.authoring.testauth.rest.ScoringRuleController.java
@RequestMapping(value = "/scoringRule", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Secured({ "ROLE_Scoring Rule Read" }) @PostAuthorize("hasPermission(returnObject, 'ROLE_Scoring Rule Read')") @ResponseBody/* w w w . j a v a 2s . co m*/ public SearchResponse<ScoringRule> searchScoringRule(final HttpServletRequest request, final HttpServletResponse response) { return this.scoringRuleService.searchScoringRules(request.getParameterMap()); }
From source file:annis.gui.servlets.BinaryServlet.java
@Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException { Map<String, String[]> binaryParameter = request.getParameterMap(); String toplevelCorpusName = binaryParameter.get("toplevelCorpusName")[0]; String documentName = binaryParameter.get("documentName")[0]; String mimeType = binaryParameter.get("mime")[0]; try {//w w w .j a v a 2s . c om ServletOutputStream out = response.getOutputStream(); String range = request.getHeader("Range"); HttpSession session = request.getSession(); Object annisServiceURLObject = session.getAttribute(AnnisBaseUI.WEBSERVICEURL_KEY); if (annisServiceURLObject == null || !(annisServiceURLObject instanceof String)) { throw new ServletException("AnnisWebService.URL was not set as init parameter in web.xml"); } String annisServiceURL = (String) annisServiceURLObject; WebResource annisRes = Helper.getAnnisWebResource(annisServiceURL, (AnnisUser) session.getAttribute(AnnisBaseUI.USER_KEY)); WebResource binaryRes = annisRes.path("query").path("corpora") .path(URLEncoder.encode(toplevelCorpusName, "UTF-8")) .path(URLEncoder.encode(documentName, "UTF-8")).path("binary").queryParam("mime", mimeType); if (range != null) { responseStatus206(binaryRes, mimeType, out, response, range); } else { responseStatus200(binaryRes, mimeType, out, response); } out.flush(); } catch (IOException ex) { log.debug("IOException in BinaryServlet", ex); } catch (ClientHandlerException ex) { log.error(null, ex); response.setStatus(500); } catch (UniformInterfaceException ex) { log.error(null, ex); response.setStatus(500); } }
From source file:it.marcoberri.mbmeteo.action.chart.GetLastUPie.java
/** * Processes requests for both HTTP//from w ww. jav a 2s. com * <code>GET</code> and * <code>POST</code> methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.debug("start : " + this.getClass().getName()); final HashMap<String, String> params = getParams(request.getParameterMap()); final Integer dimy = Default.toInteger(params.get("dimy"), 600); final Integer dimx = Default.toInteger(params.get("dimx"), 800); Meteolog meteolog = ds.find(Meteolog.class).order("-time").limit(1).get(); final DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue(ChartEnumMinMaxHelper.outdoorHumidityMin.getUm(), meteolog.getOutdoorHumidity()); dataset.setValue("", 100 - meteolog.getOutdoorHumidity()); JFreeChart chart = ChartFactory.createPieChart("Humidity %", // chart title dataset, // data true, // include legend true, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12)); plot.setNoDataMessage("No data available"); plot.setCircular(false); plot.setLabelGap(0.02); final File f = File.createTempFile("mbmeteo", ".jpg"); ChartUtilities.saveChartAsJPEG(f, chart, dimx, dimy); response.setContentType("image/jpeg"); response.setHeader("Content-Length", "" + f.length()); response.setHeader("Content-Disposition", "inline; filename=\"" + f.getName() + "\""); final OutputStream out = response.getOutputStream(); final FileInputStream in = new FileInputStream(f.toString()); final int size = in.available(); final byte[] content = new byte[size]; in.read(content); out.write(content); in.close(); out.close(); }
From source file:it.marcoberri.mbmeteo.action.chart.GetLastTBar.java
/** * Processes requests for both HTTP//from w w w . j a v a2s .c o m * <code>GET</code> and * <code>POST</code> methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.debug("start : " + this.getClass().getName()); final HashMap<String, String> params = getParams(request.getParameterMap()); final Integer dimy = Default.toInteger(params.get("dimy"), 600); final Integer dimx = Default.toInteger(params.get("dimx"), 800); Meteolog meteolog = ds.find(Meteolog.class).order("-time").limit(1).get(); final DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(meteolog.getOutdoorTemperature(), ChartEnumMinMaxHelper.outdoorTemperatureMin.getUm(), DateTimeUtil.dateFormat("yyyy-MM-dd hh:mm:ss", meteolog.getTime())); final JFreeChart chart = ChartFactory.createBarChart("T", // chart title "", // domain axis label "", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend false, // tooltips? false // URLs? ); final CategoryPlot xyPlot = (CategoryPlot) chart.getPlot(); xyPlot.getRangeAxis().setRange(0, meteolog.getOutdoorTemperature() + 2); final File f = File.createTempFile("mbmeteo", ".jpg"); ChartUtilities.saveChartAsJPEG(f, chart, dimx, dimy); response.setContentType("image/jpeg"); response.setHeader("Content-Length", "" + f.length()); response.setHeader("Content-Disposition", "inline; filename=\"" + f.getName() + "\""); final OutputStream out = response.getOutputStream(); final FileInputStream in = new FileInputStream(f.toString()); final int size = in.available(); final byte[] content = new byte[size]; in.read(content); out.write(content); in.close(); out.close(); }