Example usage for javax.servlet.http HttpServletRequest getParameterMap

List of usage examples for javax.servlet.http HttpServletRequest getParameterMap

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest getParameterMap.

Prototype

public Map<String, String[]> getParameterMap();

Source Link

Document

Returns a java.util.Map of the parameters of this request.

Usage

From source file:net.bafeimao.umbrella.web.controller.UserController.java

@RequestMapping(value = "/user/exists", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody//from   w  w  w  .  j  a va2 s .c o  m
public Map<String, Object> exists(HttpServletRequest request) {
    Map<String, Object> retMap = new HashMap<String, Object>();

    // URL???
    if (request.getParameterMap().size() == 0) {
        retMap.put("result", -1);
        retMap.put("msg", "unknown url pattern!");
        return retMap;
    }

    // ???
    else if (request.getParameter("name") != null) {
        retMap.put("result", userService.checkExistenceByName(request.getParameter("name")) ? 1 : 0);
    }

    // ?
    else if (request.getParameter("email") != null) {
        retMap.put("result", userService.checkExistenceByEmail(request.getParameter("email")) ? 1 : 0);
    }

    return retMap;
}

From source file:de.ifgi.mosia.wpswfs.handler.GenericRequestHandler.java

@SuppressWarnings("unchecked")
protected HttpResponse handleGet(HttpServletRequest req, HttpServletResponse resp)
        throws IOException, ServiceException {
    HttpResponse response;//from   w w w. j  a v  a2  s  .c o  m
    try {
        response = executeHttpGet((Map<String, String[]>) req.getParameterMap());
    } catch (IOException e) {
        logger.warn(e.getMessage(), e);
        throw new IOException("Proxy server issue: " + e.getMessage());
    }

    return response;
}

From source file:ProductServlet.java

protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws IOException {
    Set<String> keySet = request.getParameterMap().keySet();
    try (PrintWriter out = response.getWriter()) {
        Connection conn = getConnection();
        if (keySet.contains("productID")) {
            PreparedStatement pstmt = conn.prepareStatement(
                    "DELETE FROM `product` WHERE `productID`=" + request.getParameter("productID"));
            try {
                pstmt.executeUpdate();/*from ww w .j a  v  a2s .  com*/
            } catch (SQLException ex) {
                Logger.getLogger(ProductServlet.class.getName()).log(Level.SEVERE, null, ex);
                out.println("Error deleting entry.");
                response.setStatus(500);
            }
        } else {
            out.println("Error: Not enough data to delete");
            response.setStatus(500);
        }
    } catch (SQLException ex) {
        Logger.getLogger(ProductServlet.class.getName()).log(Level.SEVERE, null, ex);
    } catch (ClassNotFoundException ex) {
        Logger.getLogger(ProductServlet.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:org.craftercms.search.controller.SearchRestController.java

@RequestMapping(value = URL_SEARCH, method = RequestMethod.GET)
@ResponseBody/*from w  w w . ja v a 2 s.c o  m*/
public Map<String, Object> search(HttpServletRequest request)
        throws MissingServletRequestParameterException, SearchException {
    return searchService.search(new QueryParams(request.getParameterMap()));
}

From source file:com.enonic.cms.server.service.admin.mvc.controller.AttachmentController.java

private PathAndParams resolvePathAndParams(HttpServletRequest request) {
    @SuppressWarnings({ "unchecked" })
    Map<String, String[]> parameterMap = request.getParameterMap();

    RequestParameters requestParameters = new RequestParameters(parameterMap);
    String pathAsString = urlEncodingUrlPathHelper.getRequestUri(request);
    Path path = new Path(pathAsString);

    return new PathAndParams(path, requestParameters);
}

From source file:net.groupbuy.plugin.alipayPartner.AlipayPartnerPlugin.java

@SuppressWarnings("unchecked")
@Override//from ww  w . j a v a  2s  .  c  o  m
public boolean verifyNotify(String sn, NotifyMethod notifyMethod, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);
    if (generateSign(request.getParameterMap()).equals(request.getParameter("sign"))
            && pluginConfig.getAttribute("partner").equals(request.getParameter("seller_id"))
            && sn.equals(request.getParameter("out_trade_no"))
            && ("WAIT_SELLER_SEND_GOODS".equals(request.getParameter("trade_status"))
                    || "TRADE_FINISHED".equals(request.getParameter("trade_status")))
            && payment.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(post("https://mapi.alipay.com/gateway.do", parameterMap))) {
            return true;
        }
    }
    return false;
}

From source file:com.handu.open.dubbo.monitor.controller.UnsubscribeController.java

@RequestMapping(method = RequestMethod.GET)
public String unsubscribe(@RequestParam String consumer, HttpServletRequest request) {
    URL consumerUrl = URL.valueOf(consumer);
    registryContainer.getRegistry().unsubscribe(consumerUrl, NotifyListenerAdapter.NOTIFY_LISTENER);

    String page;// w  ww  .ja va 2s  .c  o m
    Map<String, String[]> params = request.getParameterMap();

    if (params.containsKey("service")) {
        page = "services/consumers?service=" + request.getParameter("service");
    } else if (params.containsKey("host")) {
        page = "hosts/consumers?host=" + request.getParameter("host");
    } else if (params.containsKey("application")) {
        page = "applications/consumers?application=" + request.getParameter("application");
    } else {
        page = "services/consumers?service=" + consumerUrl.getServiceInterface();
    }

    return "redirect:" + page;
}

From source file:net.groupbuy.plugin.alipayDual.AlipayDualPlugin.java

@SuppressWarnings("unchecked")
@Override//from www  .ja  v a2  s .  c  o m
public boolean verifyNotify(String sn, NotifyMethod notifyMethod, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);
    if (generateSign(request.getParameterMap()).equals(request.getParameter("sign"))
            && pluginConfig.getAttribute("partner").equals(request.getParameter("seller_id"))
            && sn.equals(request.getParameter("out_trade_no"))
            && ("WAIT_SELLER_SEND_GOODS".equals(request.getParameter("trade_status"))
                    || "TRADE_SUCCESS".equals(request.getParameter("trade_status"))
                    || "TRADE_FINISHED".equals(request.getParameter("trade_status")))
            && payment.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(post("https://mapi.alipay.com/gateway.do", parameterMap))) {
            return true;
        }
    }
    return false;
}

From source file:net.groupbuy.plugin.alipayBank.AlipayBankPlugin.java

@SuppressWarnings("unchecked")
@Override/*  ww  w. jav a  2  s. com*/
public boolean verifyNotify(String sn, NotifyMethod notifyMethod, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);
    if (generateSign(request.getParameterMap()).equals(request.getParameter("sign"))
            && pluginConfig.getAttribute("partner").equals(request.getParameter("seller_id"))
            && sn.equals(request.getParameter("out_trade_no"))
            && ("TRADE_SUCCESS".equals(request.getParameter("trade_status"))
                    || "TRADE_FINISHED".equals(request.getParameter("trade_status")))
            && payment.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(post("https://mapi.alipay.com/gateway.do", parameterMap))) {
            return true;
        }
    }
    return false;
}