alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Spring Framework example source code file (PetSitesRedirectController.java)

This example Spring Framework source code file (PetSitesRedirectController.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Spring Framework tags/keywords

actionresponse, controller, controller, exception, modelattribute, petsitesredirectcontroller, properties, properties, requestmapping, requestmapping, string, string, util, view

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

 

new blog posts

 

Copyright 1998-2021 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.