org.ibisph.mvc.view
Class SimpleClientRedirection

java.lang.Object
  extended by org.ibisph.mvc.view.SimpleClientRedirection
All Implemented Interfaces:
ClientRedirection, org.springframework.web.servlet.View

public class SimpleClientRedirection
extends java.lang.Object
implements org.springframework.web.servlet.View, ClientRedirection

Basic Spring MVC client redirection view implementation. This provides two ways to issue a client redirection to a new address. The first is when the controller sets the URL in the model (using the model name property to access the value), with the second using the specified redirection address property.

This can also be done by the controller returning a view name string of: "redirect:". Another way is to do this: new RedirectView(foo.do), which is contained in the org.springframework.web.servlet.view package. This class was created for view pluggability/XML configuration.

Author:
Garth Braithwaite, STG
See Also:
View

Constructor Summary
SimpleClientRedirection()
          Explicit default constructor
 
Method Summary
 java.lang.String getContentType()
          Spring View required method.
 java.lang.String getRedirectionAddress()
           
 java.lang.String getURLModelName()
           
 void render(java.util.Map modelMap, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Core Spring MVC view implementation method call.
 void setRedirectionAddress(java.lang.String redirectionAddress)
          Sets the default URL redirection address to be used is a URL value is not specified in the model.
 void setURLModelName(java.lang.String urlModelName)
          Sets the model name for the URL parameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleClientRedirection

public SimpleClientRedirection()
Explicit default constructor

Method Detail

getContentType

public java.lang.String getContentType()
Spring View required method.

Specified by:
getContentType in interface org.springframework.web.servlet.View
Returns:
null.

setURLModelName

public void setURLModelName(java.lang.String urlModelName)
Description copied from interface: ClientRedirection
Sets the model name for the URL parameter

Specified by:
setURLModelName in interface ClientRedirection

setRedirectionAddress

public void setRedirectionAddress(java.lang.String redirectionAddress)
Description copied from interface: ClientRedirection
Sets the default URL redirection address to be used is a URL value is not specified in the model.

Specified by:
setRedirectionAddress in interface ClientRedirection

getURLModelName

public java.lang.String getURLModelName()
Specified by:
getURLModelName in interface ClientRedirection
Returns:
the URL parameter model name property.

getRedirectionAddress

public java.lang.String getRedirectionAddress()
Specified by:
getRedirectionAddress in interface ClientRedirection
Returns:
the redirection address property.

render

public void render(java.util.Map modelMap,
                   javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws java.lang.Exception
Core Spring MVC view implementation method call. This view simply issues an HTTP client redirect via the response.sendRedirect call if the model contains a redirection URL parameter, or redirects to the specified redirection address property. If the redirection address property is null, then an exception will be thrown causing the system to display the error view.

Specified by:
render in interface org.springframework.web.servlet.View
Parameters:
modelMap - MVC model map.
request - HTTP request passed from Spring MVC framework - not used.
response - HTTP response passed from Spring MVC framework. This is used to send the HTTP client redirection to either the model URL or the redirection address property.
Throws:
java.lang.Exception