|
Spring Framework example source code file (PetSitesRedirectController.java)
The Spring Framework PetSitesRedirectController.java source code
package org.springframework.samples.petportal.portlet;
import java.util.Properties;
import javax.portlet.ActionResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* This Controller demonstrates a redirect to a website that is external
* to the portlet. The 'petsites-portlet' HandlerMapping will map to this
* view whenever in VIEW mode. See 'WEB-INF/context/petsites-portlet.xml'
* for details.
*
* @author John A. Lewis
* @author Mark Fisher
* @author Juergen Hoeller
*/
@Controller
@RequestMapping("VIEW")
public class PetSitesRedirectController {
private Properties petSites;
public void setPetSites(Properties petSites) {
this.petSites = petSites;
}
@ModelAttribute("petSites")
public Properties getPetSites() {
return this.petSites;
}
@RequestMapping // default render
public String showPetSites() {
return "petSitesView";
}
@RequestMapping // default action
public void doRedirect(@RequestParam("url") String url, ActionResponse response) throws Exception {
response.sendRedirect(url);
}
}
Other Spring Framework examples (source code examples)Here is a short list of links related to this Spring Framework PetSitesRedirectController.java source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.