Example usage for javax.servlet.http HttpServletRequest getLocalAddr

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

Introduction

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

Prototype

public String getLocalAddr();

Source Link

Document

Returns the Internet Protocol (IP) address of the interface on which the request was received.

Usage

From source file:net.groupbuy.plugin.pay99bill.Pay99billPlugin.java

@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);//from  w  ww  .  j  ava2s.  co  m
    Map<String, Object> parameterMap = new LinkedHashMap<String, Object>();
    parameterMap.put("inputCharset", "1");
    parameterMap.put("pageUrl", getNotifyUrl(sn, NotifyMethod.sync));
    parameterMap.put("bgUrl", getNotifyUrl(sn, NotifyMethod.async));
    parameterMap.put("version", "v2.0");
    parameterMap.put("language", "1");
    parameterMap.put("signType", "1");
    parameterMap.put("merchantAcctId", pluginConfig.getAttribute("partner"));
    parameterMap.put("payerIP", request.getLocalAddr());
    parameterMap.put("orderId", sn);
    parameterMap.put("orderAmount", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString());
    parameterMap.put("orderTime", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("orderTimestamp", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("productName",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100));
    parameterMap.put("productDesc",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 400));
    parameterMap.put("ext1", "shopxx");
    parameterMap.put("payType", "00");
    parameterMap.put("signMsg", generateSign(parameterMap));
    return parameterMap;
}

From source file:com.dp2345.plugin.pay99bill.Pay99billPlugin.java

@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);/*from  w  ww . jav  a  2  s  .  c o  m*/
    Map<String, Object> parameterMap = new LinkedHashMap<String, Object>();
    parameterMap.put("inputCharset", "1");
    parameterMap.put("pageUrl", getNotifyUrl(sn, NotifyMethod.sync));
    parameterMap.put("bgUrl", getNotifyUrl(sn, NotifyMethod.async));
    parameterMap.put("version", "v2.0");
    parameterMap.put("language", "1");
    parameterMap.put("signType", "1");
    parameterMap.put("merchantAcctId", pluginConfig.getAttribute("partner"));
    parameterMap.put("payerIP", request.getLocalAddr());
    parameterMap.put("orderId", sn);
    parameterMap.put("orderAmount", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString());
    parameterMap.put("orderTime", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("orderTimestamp", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("productName",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100));
    parameterMap.put("productDesc",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 400));
    parameterMap.put("ext1", "dp2345");
    parameterMap.put("payType", "00");
    parameterMap.put("signMsg", generateSign(parameterMap));
    return parameterMap;
}

From source file:gov.guilin.plugin.pay99bill.Pay99billPlugin.java

@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);/*w w  w.  ja  v a2 s  . com*/
    Map<String, Object> parameterMap = new LinkedHashMap<String, Object>();
    parameterMap.put("inputCharset", "1");
    parameterMap.put("pageUrl", getNotifyUrl(sn, NotifyMethod.sync));
    parameterMap.put("bgUrl", getNotifyUrl(sn, NotifyMethod.async));
    parameterMap.put("version", "v2.0");
    parameterMap.put("language", "1");
    parameterMap.put("signType", "1");
    parameterMap.put("merchantAcctId", pluginConfig.getAttribute("partner"));
    parameterMap.put("payerIP", request.getLocalAddr());
    parameterMap.put("orderId", sn);
    parameterMap.put("orderAmount", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString());
    parameterMap.put("orderTime", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("orderTimestamp", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("productName",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100));
    parameterMap.put("productDesc",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 400));
    parameterMap.put("ext1", "guilin");
    parameterMap.put("payType", "00");
    parameterMap.put("signMsg", generateSign(parameterMap));
    return parameterMap;
}

From source file:net.osxx.plugin.pay99bill.Pay99billPlugin.java

@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);/*from   w w  w  .  ja va  2 s.  c  o m*/
    Map<String, Object> parameterMap = new LinkedHashMap<String, Object>();
    parameterMap.put("inputCharset", "1");
    parameterMap.put("pageUrl", getNotifyUrl(sn, NotifyMethod.sync));
    parameterMap.put("bgUrl", getNotifyUrl(sn, NotifyMethod.async));
    parameterMap.put("version", "v2.0");
    parameterMap.put("language", "1");
    parameterMap.put("signType", "1");
    parameterMap.put("merchantAcctId", pluginConfig.getAttribute("partner"));
    parameterMap.put("payerIP", request.getLocalAddr());
    parameterMap.put("orderId", sn);
    parameterMap.put("orderAmount", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString());
    parameterMap.put("orderTime", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("orderTimestamp", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("productName",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100));
    parameterMap.put("productDesc",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 400));
    parameterMap.put("ext1", "osxx");
    parameterMap.put("payType", "00");
    parameterMap.put("signMsg", generateSign(parameterMap));
    return parameterMap;
}

From source file:com.sammyun.plugin.pay99bill.Pay99billPlugin.java

@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);/*from  w w  w . j a va2s .com*/
    Map<String, Object> parameterMap = new LinkedHashMap<String, Object>();
    parameterMap.put("inputCharset", "1");
    parameterMap.put("pageUrl", getNotifyUrl(sn, NotifyMethod.sync));
    parameterMap.put("bgUrl", getNotifyUrl(sn, NotifyMethod.async));
    parameterMap.put("version", "v2.0");
    parameterMap.put("language", "1");
    parameterMap.put("signType", "1");
    parameterMap.put("merchantAcctId", pluginConfig.getAttribute("partner"));
    parameterMap.put("payerIP", request.getLocalAddr());
    parameterMap.put("orderId", sn);
    parameterMap.put("orderAmount", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString());
    parameterMap.put("orderTime", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("orderTimestamp", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("productName",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100));
    parameterMap.put("productDesc",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 400));
    parameterMap.put("ext1", "preschoolEdu");
    parameterMap.put("payType", "00");
    parameterMap.put("signMsg", generateSign(parameterMap));
    return parameterMap;
}

From source file:com.jd.survey.web.statistics.StatisticsController.java

/**
 * Shows a list of Survey Entries for a Survey Definition, Supports Paging 
 * @param surveyId// w ww  . ja  v  a2  s . com
 * @param principal
 * @param uiModel
 * @param httpServletRequest
 * @return
 */
@Secured({ "ROLE_ADMIN", "ROLE_SURVEY_ADMIN" })
@RequestMapping(value = "/list", produces = "text/html", method = RequestMethod.GET)
public String listSurveyEntries(@RequestParam(value = "sid", required = true) Long surveyDefinitionId,
        @RequestParam(value = "qid", required = false) Long questionId, Model uiModel, Principal principal,
        HttpServletRequest httpServletRequest) {

    try {

        Question question;
        User user = userService.user_findByLogin(principal.getName());
        if (!securityService.userIsAuthorizedToManageSurvey(surveyDefinitionId, user)) {
            log.warn("Unauthorized access to url path " + httpServletRequest.getPathInfo()
                    + " attempted by user login:" + principal.getName() + "from IP:"
                    + httpServletRequest.getLocalAddr());
            return "accessDenied";
        }

        //get the first question
        if (questionId == null) {
            question = surveySettingsService.question_findByOrder(surveyDefinitionId, (short) 1, (short) 1);
        } else {
            question = surveySettingsService.question_findById(questionId);
        }
        populateModel(uiModel, surveyDefinitionId, question, user);
        return "statistics/statistics";

    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw (new RuntimeException(e));
    }
}

From source file:net.groupbuy.plugin.pay99billBank.Pay99billBankPlugin.java

@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);/*  w w  w .j  a  v  a 2 s. c om*/
    Map<String, Object> parameterMap = new LinkedHashMap<String, Object>();
    parameterMap.put("inputCharset", "1");
    parameterMap.put("pageUrl", getNotifyUrl(sn, NotifyMethod.sync));
    parameterMap.put("bgUrl", getNotifyUrl(sn, NotifyMethod.async));
    parameterMap.put("version", "v2.0");
    parameterMap.put("language", "1");
    parameterMap.put("signType", "1");
    parameterMap.put("merchantAcctId", pluginConfig.getAttribute("partner"));
    parameterMap.put("payerIP", request.getLocalAddr());
    parameterMap.put("orderId", sn);
    parameterMap.put("orderAmount", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString());
    parameterMap.put("orderTime", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("orderTimestamp", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("productName",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100));
    parameterMap.put("productDesc",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 400));
    parameterMap.put("ext1", "shopxx");
    parameterMap.put("payType", "10");
    String bank = request.getParameter(BANK_PARAMETER_NAME);
    parameterMap.put("bankId", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK);
    parameterMap.put("signMsg", generateSign(parameterMap));
    return parameterMap;
}

From source file:com.dp2345.plugin.pay99billBank.Pay99billBankPlugin.java

@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);/* w ww .  j a  va  2  s  .c o  m*/
    Map<String, Object> parameterMap = new LinkedHashMap<String, Object>();
    parameterMap.put("inputCharset", "1");
    parameterMap.put("pageUrl", getNotifyUrl(sn, NotifyMethod.sync));
    parameterMap.put("bgUrl", getNotifyUrl(sn, NotifyMethod.async));
    parameterMap.put("version", "v2.0");
    parameterMap.put("language", "1");
    parameterMap.put("signType", "1");
    parameterMap.put("merchantAcctId", pluginConfig.getAttribute("partner"));
    parameterMap.put("payerIP", request.getLocalAddr());
    parameterMap.put("orderId", sn);
    parameterMap.put("orderAmount", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString());
    parameterMap.put("orderTime", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("orderTimestamp", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("productName",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100));
    parameterMap.put("productDesc",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 400));
    parameterMap.put("ext1", "dp2345");
    parameterMap.put("payType", "10");
    String bank = request.getParameter(BANK_PARAMETER_NAME);
    parameterMap.put("bankId", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK);
    parameterMap.put("signMsg", generateSign(parameterMap));
    return parameterMap;
}

From source file:gov.guilin.plugin.pay99billBank.Pay99billBankPlugin.java

@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);//from   w  w  w  .  j a  v a2 s. co  m
    Map<String, Object> parameterMap = new LinkedHashMap<String, Object>();
    parameterMap.put("inputCharset", "1");
    parameterMap.put("pageUrl", getNotifyUrl(sn, NotifyMethod.sync));
    parameterMap.put("bgUrl", getNotifyUrl(sn, NotifyMethod.async));
    parameterMap.put("version", "v2.0");
    parameterMap.put("language", "1");
    parameterMap.put("signType", "1");
    parameterMap.put("merchantAcctId", pluginConfig.getAttribute("partner"));
    parameterMap.put("payerIP", request.getLocalAddr());
    parameterMap.put("orderId", sn);
    parameterMap.put("orderAmount", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString());
    parameterMap.put("orderTime", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("orderTimestamp", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("productName",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100));
    parameterMap.put("productDesc",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 400));
    parameterMap.put("ext1", "guilin");
    parameterMap.put("payType", "10");
    String bank = request.getParameter(BANK_PARAMETER_NAME);
    parameterMap.put("bankId", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK);
    parameterMap.put("signMsg", generateSign(parameterMap));
    return parameterMap;
}

From source file:net.osxx.plugin.pay99billBank.Pay99billBankPlugin.java

@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);//  ww  w  .  j  a  va2s. c o m
    Map<String, Object> parameterMap = new LinkedHashMap<String, Object>();
    parameterMap.put("inputCharset", "1");
    parameterMap.put("pageUrl", getNotifyUrl(sn, NotifyMethod.sync));
    parameterMap.put("bgUrl", getNotifyUrl(sn, NotifyMethod.async));
    parameterMap.put("version", "v2.0");
    parameterMap.put("language", "1");
    parameterMap.put("signType", "1");
    parameterMap.put("merchantAcctId", pluginConfig.getAttribute("partner"));
    parameterMap.put("payerIP", request.getLocalAddr());
    parameterMap.put("orderId", sn);
    parameterMap.put("orderAmount", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString());
    parameterMap.put("orderTime", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("orderTimestamp", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
    parameterMap.put("productName",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100));
    parameterMap.put("productDesc",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 400));
    parameterMap.put("ext1", "osxx");
    parameterMap.put("payType", "10");
    String bank = request.getParameter(BANK_PARAMETER_NAME);
    parameterMap.put("bankId", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK);
    parameterMap.put("signMsg", generateSign(parameterMap));
    return parameterMap;
}