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.osxx.plugin.tenpayDirect.TenpayDirectPlugin.java

@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);/*  www.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));
    parameterMap.put("bank_type", "DEFAULT");
    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.tenpayDirect.TenpayDirectPlugin.java

@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);//from w  ww.ja  va2 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));
    parameterMap.put("bank_type", "DEFAULT");
    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.tenpayEscowPayment.TenpayEscowPaymentPlugin.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", "2");
    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));
    parameterMap.put("trans_type", "1");
    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:net.shopxx.plugin.tenpayDirectPayment.TenpayDirectPaymentPlugin.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));
    parameterMap.put("bank_type", "DEFAULT");
    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.PrivateSurveyController.java

/**
 * Prepares to edit a survey page //from  w  w  w  .  j a  va 2 s. c  om
 * @param surveyId
 * @param order
 * @param uiModel
 * @param principal
 * @return
 */
@Secured({ "ROLE_ADMIN", "ROLE_SURVEY_ADMIN", "ROLE_SURVEY_PARTICIPANT" })
@RequestMapping(value = "/{id}/{po}", produces = "text/html")
public String editSurveyPage(@PathVariable("id") Long surveyId, @PathVariable("po") Short order, Model uiModel,
        Principal principal, HttpServletRequest httpServletRequest) {
    log.info("editSurveyPage surveyId=" + surveyId + " pageOrder" + order);
    try {
        String login = principal.getName();
        Survey survey = surveyService.survey_findById(surveyId);
        //Check if the user is authorized
        if (!survey.getLogin().equals(login)) {
            log.warn(UNAUTHORIZED_ATTEMPT_TO_ACCESS_SURVEY_WARNING_MESSAGE + surveyId
                    + REQUEST_PATH_WARNING_MESSAGE + httpServletRequest.getPathInfo()
                    + FROM_USER_LOGIN_WARNING_MESSAGE + principal.getName() + FROM_IP_WARNING_MESSAGE
                    + httpServletRequest.getLocalAddr());
            return "accessDenied";

        }

        //Check that the survey was not submitted
        if (!(survey.getStatus().equals(SurveyStatus.I) || survey.getStatus().equals(SurveyStatus.R))) {
            log.warn(UNAUTHORIZED_ATTEMPT_TO_EDIT_SUBMITTED_SURVEY_WARNING_MESSAGE + surveyId
                    + REQUEST_PATH_WARNING_MESSAGE + httpServletRequest.getPathInfo()
                    + FROM_USER_LOGIN_WARNING_MESSAGE + principal.getName() + FROM_IP_WARNING_MESSAGE
                    + httpServletRequest.getLocalAddr());
            return "accessDenied";

        }

        SurveyPage surveyPage = surveyService.surveyPage_get(surveyId, order,
                messageSource.getMessage(DATE_FORMAT, null, LocaleContextHolder.getLocale()));

        //randomize the questions order
        if (surveyPage.getRandomizeQuestions()) {
            Collections.shuffle(surveyPage.getQuestionAnswers(), new Random(System.nanoTime()));
        }

        //randomize the questions options orders
        for (QuestionAnswer questionAnswer : surveyPage.getQuestionAnswers()) {
            questionAnswer.getQuestion()
                    .setOptionsList(new ArrayList<QuestionOption>(questionAnswer.getQuestion().getOptions()));
            if (questionAnswer.getQuestion().getRandomizeOptions()) {
                Collections.shuffle(questionAnswer.getQuestion().getOptionsList(),
                        new Random(System.nanoTime()));
            }
        }

        List<SurveyPage> surveyPages = surveyService.surveyPage_getAll(surveyId,
                messageSource.getMessage(DATE_FORMAT, null, LocaleContextHolder.getLocale()));
        uiModel.addAttribute("survey_base_path", "private");
        uiModel.addAttribute("survey", surveyPage.getSurvey());
        uiModel.addAttribute("surveyDefinition",
                surveySettingsService.surveyDefinition_findById(surveyPage.getSurvey().getTypeId()));

        uiModel.addAttribute("surveyPage", surveyPage);
        uiModel.addAttribute("surveyPages", surveyPages);
        return "surveys/page";
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw (new RuntimeException(e));
    }
}

From source file:com.jd.survey.web.settings.QuestionController.java

@Secured({ "ROLE_ADMIN", "ROLE_SURVEY_ADMIN" })
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html")
public String delete(@PathVariable("id") Long id, Principal principal, Model uiModel,
        HttpServletRequest httpServletRequest) {
    log.info("delete(): id=" + id);
    try {/*from w w w.j  a  v  a 2  s .  c o  m*/
        Question question = surveySettingsService.question_findById(id);
        String login = principal.getName();
        User user = userService.user_findByLogin(login);
        //SurveyDefinitionPage surveyDefinitionPage = surveySettingsService.surveyDefinitionPage_findById(surveyDefinitionPageId); 
        //Check if the user is authorized
        if (!securityService.userIsAuthorizedToManageSurvey(question.getPage().getSurveyDefinition().getId(),
                user)
                && !securityService.userBelongsToDepartment(
                        question.getPage().getSurveyDefinition().getDepartment().getId(), user)) {
            log.warn("Unauthorized access to url path " + httpServletRequest.getPathInfo()
                    + " attempted by user login:" + principal.getName() + "from IP:"
                    + httpServletRequest.getLocalAddr());
            return "accessDenied";
        }

        surveySettingsService.question_remove(id);
        uiModel.asMap().clear();
        return "redirect:/settings/surveyDefinitions/" + encodeUrlPathSegment(
                question.getPage().getSurveyDefinition().getId().toString(), httpServletRequest);

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

From source file:com.jd.survey.web.survey.PublicSurveyController.java

/**
 * Updates a survey page//from  w w  w. jav  a 2 s .c o m
 * @param surveyPage
 * @param backAction
 * @param proceedAction
 * @param bindingResult
 * @param uiModel
 * @param httpServletRequest
 * @return
 */
@RequestMapping(method = RequestMethod.POST, produces = "text/html")
public String updateSurveyPage(@Valid SurveyPage surveyPage,
        @RequestParam(value = "_back", required = false) String backAction,
        @RequestParam(value = "_proceed", required = false) String proceedAction, BindingResult bindingResult,
        Model uiModel, HttpServletRequest httpServletRequest) {
    try {

        Short order = surveyPage.getOrder();
        Survey survey = surveyService.survey_findById(surveyPage.getSurvey().getId());
        SurveyDefinition surveyDefinition = surveySettingsService.surveyDefinition_findById(survey.getTypeId());
        if (!surveyDefinition.getIsPublic()) {//survey definition not open to the public
            //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 (proceedAction != null) { //next button
            List<SurveyPage> surveyPages = surveyService.surveyPage_getAll(surveyPage.getSurvey().getId(),
                    messageSource.getMessage(DATE_FORMAT, null, LocaleContextHolder.getLocale()));
            surveyPage.setOrder(surveyPages.get(surveyPage.getOrder() - 1).getOrder());
            surveyPage.setTitle(surveyPages.get(surveyPage.getOrder() - 1).getTitle());
            surveyPage.setInstructions(surveyPages.get(surveyPage.getOrder() - 1).getInstructions());
            surveyPage.setSurvey(survey);
            surveyPage = surveyService.surveyPage_updateSettings(surveyPage);

            //populate the uploaded files
            MultipartHttpServletRequest multiPartRequest = (MultipartHttpServletRequest) httpServletRequest;
            Iterator<String> fileNames = multiPartRequest.getFileNames();
            while (fileNames.hasNext()) {
                String fileName = fileNames.next();
                Long questionId = Long.parseLong(fileName.toUpperCase().replace("FILE", ""));
                for (QuestionAnswer questionAnswer : surveyPage.getQuestionAnswers()) {
                    if (questionAnswer.getQuestion().getId().equals(questionId)
                            && multiPartRequest.getFile(fileName).getBytes().length > 0) {
                        questionAnswer.setSurveyDocument(new SurveyDocument(survey.getId(), questionId,
                                multiPartRequest.getFile(fileName).getName(),
                                multiPartRequest.getFile(fileName).getContentType(),
                                multiPartRequest.getFile(fileName).getBytes()));
                    }
                }
            }

            Policy policy = Policy.getInstance(this.getClass().getResource(POLICY_FILE_LOCATION));
            AntiSamy as = new AntiSamy();
            for (QuestionAnswer questionAnswer : surveyPage.getQuestionAnswers()) {
                if (questionAnswer.getQuestion().getType().getIsTextInput()) {
                    CleanResults cr = as.scan(questionAnswer.getStringAnswerValue(), policy);
                    questionAnswer.setStringAnswerValue(cr.getCleanHTML());
                }
            }

            GlobalSettings globalSettings = applicationSettingsService.getSettings();

            SurveyPageValidator validator = new SurveyPageValidator(
                    messageSource.getMessage(DATE_FORMAT, null, LocaleContextHolder.getLocale()),
                    globalSettings.getValidContentTypes(), globalSettings.getValidImageTypes(),
                    globalSettings.getMaximunFileSize(), globalSettings.getInvalidContentMessage(),
                    globalSettings.getInvalidFileSizeMessage());
            validator.validate(surveyPage, bindingResult);
            if (bindingResult.hasErrors()) {
                /*
                for (ObjectError err :bindingResult.getAllErrors()) {
                   log.info("getObjectName:" + err.getObjectName() + " getCode:" + err.getCode() + " getDefaultMessage:" + err.getDefaultMessage());
                   log.info("toString:" + err.toString());
                } 
                */
                uiModel.addAttribute("survey_base_path", "open");
                uiModel.addAttribute("survey", survey);
                uiModel.addAttribute("surveyDefinition",
                        surveySettingsService.surveyDefinition_findById(survey.getTypeId()));
                uiModel.addAttribute("surveyPage", surveyPage);
                uiModel.addAttribute("surveyPages", surveyPages);
                return "surveys/page";
            }

            surveyService.surveyPage_update(surveyPage,
                    messageSource.getMessage(DATE_FORMAT, null, LocaleContextHolder.getLocale()));
            //get the survey pages from the database again, prvious call updates visibility when there is  branching logic 
            surveyPages = surveyService.surveyPage_getAll(surveyPage.getSurvey().getId(),
                    messageSource.getMessage(DATE_FORMAT, null, LocaleContextHolder.getLocale()));
            order = getNextPageOrder(surveyPages, order);
            if (order.equals((short) 0)) {
                //Submit page
                uiModel.asMap().clear();
                return "redirect:/open/submit/"
                        + encodeUrlPathSegment(surveyPage.getSurvey().getId().toString(), httpServletRequest);
            } else {
                //go to the next page
                uiModel.asMap().clear();
                return "redirect:/open/"
                        + encodeUrlPathSegment(surveyPage.getSurvey().getId().toString(), httpServletRequest)
                        + "/" + encodeUrlPathSegment(order.toString(), httpServletRequest);
            }

        } else {//back button
            List<SurveyPage> surveyPages = surveyService.surveyPage_getAll(surveyPage.getSurvey().getId(),
                    messageSource.getMessage(DATE_FORMAT, null, LocaleContextHolder.getLocale()));
            order = getPreviousPageOrder(surveyPages, order);
            if (order.equals((short) 0)) {
                //Go to the surveyEntries page
                uiModel.asMap().clear();
                return "redirect:/open/"
                        + encodeUrlPathSegment(survey.getTypeId().toString(), httpServletRequest) + "?list";
            } else {
                //go to previous page
                uiModel.asMap().clear();
                return "redirect:/open/" + encodeUrlPathSegment(survey.getId().toString(), httpServletRequest)
                        + "/" + encodeUrlPathSegment(order.toString(), httpServletRequest);

            }
        }

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

}

From source file:com.jd.survey.web.settings.QuestionController.java

@Secured({ "ROLE_ADMIN", "ROLE_SURVEY_ADMIN" })
@RequestMapping(method = RequestMethod.POST, produces = "text/html")
public String create(@RequestParam(value = "_proceed", required = false) String proceed,
        @Valid Question question, BindingResult bindingResult, Principal principal, Model uiModel,
        HttpServletRequest httpServletRequest) {
    log.info("create(): handles " + RequestMethod.POST.toString());

    try {//from   w ww . j a  va  2s .  c  o  m
        String login = principal.getName();
        User user = userService.user_findByLogin(login);
        //SurveyDefinitionPage surveyDefinitionPage = surveySettingsService.surveyDefinitionPage_findById(surveyDefinitionPageId); 
        //Check if the user is authorized

        if (!securityService.userIsAuthorizedToManageSurvey(question.getPage().getSurveyDefinition().getId(),
                user)
                && !securityService.userBelongsToDepartment(
                        question.getPage().getSurveyDefinition().getDepartment().getId(), user)) {
            log.warn("Unauthorized access to url path " + httpServletRequest.getPathInfo()
                    + " attempted by user login:" + principal.getName() + "from IP:"
                    + httpServletRequest.getLocalAddr());
            return "accessDenied";
        }
        //User user = userService.user_findByLogin(principal.getName());
        if (proceed != null) {
            if (bindingResult.hasErrors()) {
                populateEditForm(uiModel, question, user);
                return "settings/questions/create";
            }

            if (!surveySettingsService.question_ValidateDateRange(question)) {
                populateEditForm(uiModel, question, user);
                bindingResult.rejectValue("dateMinimum", "date_format_validation_range");
                return "settings/questions/create";
            }
            //validate Double min max   
            if (!surveySettingsService.question_ValidateMinMaxDoubleValues(question)) {
                populateEditForm(uiModel, question, user);
                bindingResult.rejectValue("decimalMinimum", "field_min_invalid");
                return "settings/questions/create";
            }
            //validate Integer min max   
            if (!surveySettingsService.question_ValidateMinMaxValues(question)) {
                populateEditForm(uiModel, question, user);
                bindingResult.rejectValue("integerMinimum", "field_min_invalid");
                return "settings/questions/create";
            }
            if (question.getType().getIsRating()) {
                SortedSet<QuestionOption> options = new TreeSet<QuestionOption>();
                options.add(new QuestionOption(question, (short) 1, "1", messageSource
                        .getMessage(EXTREMELY_UNSATISFIED_LABEL, null, LocaleContextHolder.getLocale())));
                options.add(new QuestionOption(question, (short) 2, "2",
                        messageSource.getMessage(UNSATISFIED_LABEL, null, LocaleContextHolder.getLocale())));
                options.add(new QuestionOption(question, (short) 3, "3",
                        messageSource.getMessage(NEUTRAL_LABEL, null, LocaleContextHolder.getLocale())));
                options.add(new QuestionOption(question, (short) 4, "4",
                        messageSource.getMessage(SATISFIED_LABEL, null, LocaleContextHolder.getLocale())));
                options.add(new QuestionOption(question, (short) 5, "5", messageSource
                        .getMessage(EXTREMELY_SATISFIED_LABEL, null, LocaleContextHolder.getLocale())));
                question = surveySettingsService.question_merge(question, options);
            }

            //            if (question.getPublishToSocrata().equals(true)){
            //               bindingResult.rejectValue("socrataColumnName", "field_min_invalid");
            //               return "settings/questions/create";   
            //               }

            else {

                Policy questionTextPolicy = Policy
                        .getInstance(this.getClass().getResource(POLICY_FILE_LOCATION));
                AntiSamy emailAs = new AntiSamy();
                CleanResults crQuestionText = emailAs.scan(question.getQuestionText(), questionTextPolicy);
                question.setQuestionText(crQuestionText.getCleanHTML());

                Policy questionTipPolicy = Policy
                        .getInstance(this.getClass().getResource(POLICY_FILE_LOCATION));
                AntiSamy completedSurveyAs = new AntiSamy();
                CleanResults crQuestionTip = completedSurveyAs.scan(question.getTip(), questionTipPolicy);
                question.setTip(crQuestionTip.getCleanHTML());

                question = surveySettingsService.question_merge(question);

            }
            uiModel.asMap().clear();
            return "settings/questions/saved";
        }

        else {
            return "redirect:/settings/surveyDefinitions/" + encodeUrlPathSegment(
                    question.getPage().getSurveyDefinition().getId().toString(), httpServletRequest);
        }
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw (new RuntimeException(e));
    }

}

From source file:net.groupbuy.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.  j a v  a 2 s .  c o  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", "groupbuy");
    parameterMap.put("sign", generateSign(parameterMap));
    return parameterMap;
}

From source file:com.dp2345.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  www  .  j a  va2s  . 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", "dp2345");
    parameterMap.put("sign", generateSign(parameterMap));
    return parameterMap;
}