net.sourceforge.xconf.toolbox.spring.mvc
Class RedirectViewResolver

java.lang.Object
  extended by net.sourceforge.xconf.toolbox.spring.mvc.RedirectViewResolver
All Implemented Interfaces:
Ordered, ViewResolver

public class RedirectViewResolver
extends Object
implements ViewResolver, Ordered

A ViewResolver implementation that maps view names to redirect URLs. This class is useful if you want to avoid programmatically creating Spring RedirectViews within your controller classes. You can always use the Spring ResourceBundleViewResolver to mix multiple view types, but this provides a nice alternative if all you would use the resource bundle is to map view names to either redirects or some other view technologies without any localisation.

All you need to do is to set the order property of this class so that the DispatchServlet uses this class before any of your other ViewResolvers.

Author:
Tom Czarniecki

Field Summary
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
RedirectViewResolver()
           
 
Method Summary
 int getOrder()
           
 View resolveViewName(String viewName, Locale locale)
          Returns the configured RedirectView, or null if no view is found for the name.
 void setAppendModelParams(boolean appendModelParams)
          Set whether to return a RedirectView that appends model parameters to the query string (true by default).
 void setContextRelative(boolean contextRelative)
          Set whether to interpret the given URL as relative to the current ServletContext (false by default).
 void setHttp10Compatible(boolean http10Compatible)
          Set whether to stay compatible with HTTP 1.0 clients (true by default).
 void setOrder(int order)
           
 void setViews(Properties views)
          Set view name / redirect URL pairs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RedirectViewResolver

public RedirectViewResolver()
Method Detail

getOrder

public int getOrder()
Specified by:
getOrder in interface Ordered

setOrder

public void setOrder(int order)

setViews

public void setViews(Properties views)
Set view name / redirect URL pairs.


setContextRelative

public void setContextRelative(boolean contextRelative)
Set whether to interpret the given URL as relative to the current ServletContext (false by default).


setHttp10Compatible

public void setHttp10Compatible(boolean http10Compatible)
Set whether to stay compatible with HTTP 1.0 clients (true by default).


setAppendModelParams

public void setAppendModelParams(boolean appendModelParams)
Set whether to return a RedirectView that appends model parameters to the query string (true by default).


resolveViewName

public View resolveViewName(String viewName,
                            Locale locale)
                     throws Exception
Returns the configured RedirectView, or null if no view is found for the name.

Specified by:
resolveViewName in interface ViewResolver
Throws:
Exception


Copyright © 2007 Thomas Czarniecki. All Rights Reserved.