List of usage examples for javax.servlet.http HttpServletRequest getLocalAddr
public String getLocalAddr();
From source file:gov.guilin.plugin.alipayDirect.AlipayDirectPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { Setting setting = SettingUtils.get(); PluginConfig pluginConfig = getPluginConfig(); Payment payment = getPayment(sn);// ww w . j a v a 2 s. co m Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("service", "create_direct_pay_by_user"); parameterMap.put("partner", pluginConfig.getAttribute("partner")); parameterMap.put("_input_charset", "utf-8"); parameterMap.put("sign_type", "MD5"); parameterMap.put("return_url", getNotifyUrl(sn, NotifyMethod.sync)); parameterMap.put("notify_url", getNotifyUrl(sn, NotifyMethod.async)); parameterMap.put("out_trade_no", sn); parameterMap.put("subject", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 60)); parameterMap.put("body", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 600)); parameterMap.put("payment_type", "1"); parameterMap.put("seller_id", pluginConfig.getAttribute("partner")); parameterMap.put("total_fee", payment.getAmount().setScale(2).toString()); parameterMap.put("show_url", setting.getSiteUrl()); parameterMap.put("paymethod", "directPay"); parameterMap.put("exter_invoke_ip", request.getLocalAddr()); parameterMap.put("extra_common_param", "guilin"); parameterMap.put("sign", generateSign(parameterMap)); return parameterMap; }
From source file:net.osxx.plugin.alipayDirect.AlipayDirectPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { Setting setting = SettingUtils.get(); PluginConfig pluginConfig = getPluginConfig(); Payment payment = getPayment(sn);//from w w w. jav a 2 s .com Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("service", "create_direct_pay_by_user"); parameterMap.put("partner", pluginConfig.getAttribute("partner")); parameterMap.put("_input_charset", "utf-8"); parameterMap.put("sign_type", "MD5"); parameterMap.put("return_url", getNotifyUrl(sn, NotifyMethod.sync)); parameterMap.put("notify_url", getNotifyUrl(sn, NotifyMethod.async)); parameterMap.put("out_trade_no", sn); parameterMap.put("subject", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 60)); parameterMap.put("body", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 600)); parameterMap.put("payment_type", "1"); parameterMap.put("seller_id", pluginConfig.getAttribute("partner")); parameterMap.put("total_fee", payment.getAmount().setScale(2).toString()); parameterMap.put("show_url", setting.getSiteUrl()); parameterMap.put("paymethod", "directPay"); parameterMap.put("exter_invoke_ip", request.getLocalAddr()); parameterMap.put("extra_common_param", "osxx"); parameterMap.put("sign", generateSign(parameterMap)); return parameterMap; }
From source file:net.shopxx.plugin.alipayDirect.AlipayDirectPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { Setting setting = SettingUtils.get(); PluginConfig pluginConfig = getPluginConfig(); Payment payment = getPayment(sn);/*w ww . j av a 2s. c om*/ Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("service", "create_direct_pay_by_user"); parameterMap.put("partner", pluginConfig.getAttribute("partner")); parameterMap.put("_input_charset", "utf-8"); parameterMap.put("sign_type", "MD5"); parameterMap.put("return_url", getNotifyUrl(sn, NotifyMethod.sync)); parameterMap.put("notify_url", getNotifyUrl(sn, NotifyMethod.async)); parameterMap.put("out_trade_no", sn); parameterMap.put("subject", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 60)); parameterMap.put("body", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 600)); parameterMap.put("payment_type", "1"); parameterMap.put("seller_id", pluginConfig.getAttribute("partner")); parameterMap.put("total_fee", payment.getAmount().setScale(2).toString()); parameterMap.put("show_url", setting.getSiteUrl()); parameterMap.put("paymethod", "directPay"); parameterMap.put("exter_invoke_ip", request.getLocalAddr()); parameterMap.put("extra_common_param", "shopxx"); parameterMap.put("sign", generateSign(parameterMap)); return parameterMap; }
From source file:net.groupbuy.plugin.tenpayBank.TenpayBankPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { PluginConfig pluginConfig = getPluginConfig(); Payment payment = getPayment(sn);//from w ww. j a v a 2 s . c o m Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("trade_mode", "1"); parameterMap.put("partner", pluginConfig.getAttribute("partner")); parameterMap.put("input_charset", "utf-8"); parameterMap.put("sign_type", "MD5"); parameterMap.put("return_url", getNotifyUrl(sn, NotifyMethod.sync)); parameterMap.put("notify_url", getNotifyUrl(sn, NotifyMethod.async)); parameterMap.put("out_trade_no", sn); parameterMap.put("subject", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 30)); parameterMap.put("body", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 30)); String bank = request.getParameter(BANK_PARAMETER_NAME); parameterMap.put("bank_type", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK); parameterMap.put("seller_id", pluginConfig.getAttribute("partner")); parameterMap.put("total_fee", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString()); parameterMap.put("fee_type", "1"); parameterMap.put("spbill_create_ip", request.getLocalAddr()); parameterMap.put("attach", "shopxx"); parameterMap.put("sign", generateSign(parameterMap)); return parameterMap; }
From source file:com.dp2345.plugin.tenpayBank.TenpayBankPlugin.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 a 2 s. co m*/ Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("trade_mode", "1"); parameterMap.put("partner", pluginConfig.getAttribute("partner")); parameterMap.put("input_charset", "utf-8"); parameterMap.put("sign_type", "MD5"); parameterMap.put("return_url", getNotifyUrl(sn, NotifyMethod.sync)); parameterMap.put("notify_url", getNotifyUrl(sn, NotifyMethod.async)); parameterMap.put("out_trade_no", sn); parameterMap.put("subject", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 30)); parameterMap.put("body", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 30)); String bank = request.getParameter(BANK_PARAMETER_NAME); parameterMap.put("bank_type", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK); parameterMap.put("seller_id", pluginConfig.getAttribute("partner")); parameterMap.put("total_fee", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString()); parameterMap.put("fee_type", "1"); parameterMap.put("spbill_create_ip", request.getLocalAddr()); parameterMap.put("attach", "dp2345"); parameterMap.put("sign", generateSign(parameterMap)); return parameterMap; }
From source file:gov.guilin.plugin.tenpayBank.TenpayBankPlugin.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 HashMap<String, Object>(); parameterMap.put("trade_mode", "1"); parameterMap.put("partner", pluginConfig.getAttribute("partner")); parameterMap.put("input_charset", "utf-8"); parameterMap.put("sign_type", "MD5"); parameterMap.put("return_url", getNotifyUrl(sn, NotifyMethod.sync)); parameterMap.put("notify_url", getNotifyUrl(sn, NotifyMethod.async)); parameterMap.put("out_trade_no", sn); parameterMap.put("subject", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 30)); parameterMap.put("body", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 30)); String bank = request.getParameter(BANK_PARAMETER_NAME); parameterMap.put("bank_type", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK); parameterMap.put("seller_id", pluginConfig.getAttribute("partner")); parameterMap.put("total_fee", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString()); parameterMap.put("fee_type", "1"); parameterMap.put("spbill_create_ip", request.getLocalAddr()); parameterMap.put("attach", "guilin"); parameterMap.put("sign", generateSign(parameterMap)); return parameterMap; }
From source file:net.osxx.plugin.tenpayBank.TenpayBankPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { PluginConfig pluginConfig = getPluginConfig(); Payment payment = getPayment(sn);/* ww w . j a v a2 s . c o m*/ Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("trade_mode", "1"); parameterMap.put("partner", pluginConfig.getAttribute("partner")); parameterMap.put("input_charset", "utf-8"); parameterMap.put("sign_type", "MD5"); parameterMap.put("return_url", getNotifyUrl(sn, NotifyMethod.sync)); parameterMap.put("notify_url", getNotifyUrl(sn, NotifyMethod.async)); parameterMap.put("out_trade_no", sn); parameterMap.put("subject", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 30)); parameterMap.put("body", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 30)); String bank = request.getParameter(BANK_PARAMETER_NAME); parameterMap.put("bank_type", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK); parameterMap.put("seller_id", pluginConfig.getAttribute("partner")); parameterMap.put("total_fee", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString()); parameterMap.put("fee_type", "1"); parameterMap.put("spbill_create_ip", request.getLocalAddr()); parameterMap.put("attach", "osxx"); parameterMap.put("sign", generateSign(parameterMap)); return parameterMap; }
From source file:com.sammyun.plugin.tenpayBank.TenpayBankPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { PluginConfig pluginConfig = getPluginConfig(); Payment payment = getPayment(sn);// ww w.j a v a2s . c o m Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("trade_mode", "1"); parameterMap.put("partner", pluginConfig.getAttribute("partner")); parameterMap.put("input_charset", "utf-8"); parameterMap.put("sign_type", "MD5"); parameterMap.put("return_url", getNotifyUrl(sn, NotifyMethod.sync)); parameterMap.put("notify_url", getNotifyUrl(sn, NotifyMethod.async)); parameterMap.put("out_trade_no", sn); parameterMap.put("subject", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 30)); parameterMap.put("body", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 30)); String bank = request.getParameter(BANK_PARAMETER_NAME); parameterMap.put("bank_type", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK); parameterMap.put("seller_id", pluginConfig.getAttribute("partner")); parameterMap.put("total_fee", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString()); parameterMap.put("fee_type", "1"); parameterMap.put("spbill_create_ip", request.getLocalAddr()); parameterMap.put("attach", "preschoolEdu"); parameterMap.put("sign", generateSign(parameterMap)); return parameterMap; }
From source file:net.shopxx.plugin.tenpayBankPayment.TenpayBankPaymentPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { PluginConfig pluginConfig = getPluginConfig(); PaymentLog paymentLog = getPaymentLog(sn); Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("trade_mode", "1"); parameterMap.put("partner", pluginConfig.getAttribute("partner")); parameterMap.put("input_charset", "utf-8"); parameterMap.put("sign_type", "MD5"); parameterMap.put("return_url", getNotifyUrl(PaymentPlugin.NotifyMethod.sync)); parameterMap.put("notify_url", getNotifyUrl(PaymentPlugin.NotifyMethod.async)); parameterMap.put("out_trade_no", sn); parameterMap.put("subject", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 30)); parameterMap.put("body", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 30)); String bank = request.getParameter(BANK_PARAMETER_NAME); parameterMap.put("bank_type", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK); parameterMap.put("seller_id", pluginConfig.getAttribute("partner")); parameterMap.put("total_fee", paymentLog.getAmount().multiply(new BigDecimal(100)).setScale(0).toString()); parameterMap.put("fee_type", "1"); parameterMap.put("spbill_create_ip", request.getLocalAddr()); parameterMap.put("attach", "shopxx"); parameterMap.put("sign", generateSign(parameterMap)); return parameterMap; }
From source file:com.jd.survey.web.survey.PublicSurveyController.java
/** * Handles the post from the submit page * @param proceed/*from www .j a v a2 s . c o m*/ * @param survey * @param bindingResult * @param uiModel * @param httpServletRequest * @return */ @RequestMapping(value = "/submit", method = RequestMethod.POST, produces = "text/html") public String submitSurvey(@RequestParam(value = "id", required = true) Long surveyId, @RequestParam(value = "_submit", required = false) String proceedAction, Model uiModel, HttpServletRequest httpServletRequest) { log.info("submitPost(open): id= " + surveyId); try { if (proceedAction != null) { //submit button uiModel.asMap().clear(); Survey survey = surveyService.survey_submit(surveyId); SurveyDefinition surveyDefinition = surveySettingsService .surveyDefinition_findById(survey.getTypeId()); //survey definition not open to the public if (!surveyDefinition.getIsPublic()) { //attempt to access a private survey definition from a public open url log.warn(SURVEY_NOT_PUBLIC_WARNING_MESSAGE + httpServletRequest.getPathInfo() + FROM_IP_WARNING_MESSAGE + httpServletRequest.getLocalAddr()); return "accessDenied"; } //Attempt to access a survey from different IP Address if (!survey.getIpAddress().equalsIgnoreCase(httpServletRequest.getLocalAddr())) { log.warn( UNAUTHORIZED_ATTEMPT_TO_ACCESS_SURVEY_WARNING_MESSAGE + httpServletRequest.getPathInfo() + FROM_IP_WARNING_MESSAGE + httpServletRequest.getLocalAddr()); return "accessDenied"; } if (surveyDefinition.getAllowMultipleSubmissions()) { return "redirect:/open/" + encodeUrlPathSegment(survey.getTypeId().toString(), httpServletRequest) + "?list"; } else { uiModel.asMap().clear(); StringWriter sw = new StringWriter(); VelocityContext velocityContext = new VelocityContext(); Velocity.evaluate(velocityContext, sw, "velocity-log", surveyDefinition.getCompletedSurveyTemplate()); uiModel.addAttribute("completedMessage", sw.toString().trim()); return "surveys/submitted"; } } else { uiModel.asMap().clear(); Survey survey = surveyService.survey_findById(surveyId); SurveyDefinition surveyDefinition = surveySettingsService .surveyDefinition_findById(survey.getTypeId()); //survey definition not open to the public if (!surveyDefinition.getIsPublic()) { //attempt to access a private survey definition from a public open url log.warn(SURVEY_NOT_PUBLIC_WARNING_MESSAGE + httpServletRequest.getPathInfo() + FROM_IP_WARNING_MESSAGE + httpServletRequest.getLocalAddr()); return "accessDenied"; } //Attempt to access a survey from different IP Address if (!survey.getIpAddress().equalsIgnoreCase(httpServletRequest.getLocalAddr())) { log.warn( UNAUTHORIZED_ATTEMPT_TO_ACCESS_SURVEY_WARNING_MESSAGE + httpServletRequest.getPathInfo() + FROM_IP_WARNING_MESSAGE + httpServletRequest.getLocalAddr()); return "accessDenied"; } List<SurveyPage> surveyPages = surveyService.surveyPage_getAll(surveyId, messageSource.getMessage(DATE_FORMAT, null, LocaleContextHolder.getLocale())); Short order = (short) surveyPages.size(); return "redirect:/open/" + encodeUrlPathSegment(survey.getId().toString(), httpServletRequest) + "/" + encodeUrlPathSegment(order.toString(), httpServletRequest); } } catch (Exception e) { log.error(e.getMessage(), e); throw (new RuntimeException(e)); } }