Announcement Announcement Module
Collapse
No announcement yet.
Controller return http url for php application Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Controller return http url for php application

    I have two application.
    One is PHP(http://11.11.11.11/index.php?route=catalog/common) application, and the other is Spring MVC(http://12.12.12.12/sample) application.

    if PHP send post data to MVC and MVC get data successfully.
    i want send data to PHP with post, not get.

    I was wondering what should be implemented in any way.

    This is controller.

    1. return with redirect
    but, data is appended URL. (http://12.12.12.12?route=catalog/com...Millis=111111&....)
    Code:
    @RequestMapping("test.do")
    public String test(@RequestParam(value = "test") String test,
    			@RequestParam(value = "returnUrl") String returnUrl, Model model) {
    	Map resultMap = custonService.test(test);
    
    	model.addAttribute("currentTimeMillis",	resultMap.get("currentTimeMillis"));
    	model.addAttribute("currentDate", resultMap.get("currentDate"));
    	model.addAttribute("returnInputParam", resultMap.get("returnInputParam"));
    
    	return "redirect:" + returnUrl;
    }
    2. return redirect with RedirectView
    but, i can't varified any data from post or get.
    Code:
    @RequestMapping("test.do")
    public ModelAndView test(@RequestParam(value = "test") String test,
    			@RequestParam(value = "returnUrl") String returnUrl) {
    	ModelAndView modelAndView = new ModelAndView();
    	modelAndView.getModel().put("currentTimeMillis", resultMap.get("currentTimeMillis"));
    	modelAndView.getModel().put("currentDate", resultMap.get("currentDate"));
    	modelAndView.getModel().put("returnInputParam", resultMap.get("returnInputParam"));
    
    	RedirectView rv = new RedirectView(returnUrl);
    	rv.setExposeModelAttributes(false);
    	modelAndView.setView(rv);
    
    	return modelAndView;
    }
    3. return with forward
    i got 404 error with url with like this : /sample/http:/12.12.12.12/index.php
    missing ?route=catalog/common.
    Code:
    @RequestMapping("test.do")
    public String test(@RequestParam(value = "test") String test,
    			@RequestParam(value = "returnUrl") String returnUrl, Model model) {
    	Map resultMap = custonService.test(test);
    
    	model.addAttribute("currentTimeMillis", resultMap.get("currentTimeMillis"));
    	model.addAttribute("currentDate", resultMap.get("currentDate"));
    	model.addAttribute("returnInputParam", resultMap.get("returnInputParam"));
    
    	return "forward:" + returnUrl;
    }
    Last edited by plane11; Nov 14th, 2012, 07:34 AM.
Working...
X