@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2012 the original author or authors .
* Copyright 2002 - 2014 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -13,9 +13,11 @@
@@ -13,9 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License .
* /
package org.springframework.web.servlet.view.tiles3 ;
import org.apache.tiles.request.render.Renderer ;
import org.springframework.web.servlet.view.UrlBasedViewResolver ;
/ * *
@ -24,6 +26,7 @@ import org.springframework.web.servlet.view.UrlBasedViewResolver;
@@ -24,6 +26,7 @@ import org.springframework.web.servlet.view.UrlBasedViewResolver;
*
* @author Nicolas Le Bas
* @author Rossen Stoyanchev
* @author Juergen Hoeller
* @since 3 . 2
* /
public class TilesViewResolver extends UrlBasedViewResolver {
@ -31,24 +34,35 @@ public class TilesViewResolver extends UrlBasedViewResolver {
@@ -31,24 +34,35 @@ public class TilesViewResolver extends UrlBasedViewResolver {
private Renderer renderer ;
public TilesViewResolver ( ) {
setViewClass ( requiredViewClass ( ) ) ;
}
/ * *
* Requires { @link TilesView } .
* /
@Override
protected Class < ? > getViewClass ( ) {
protected Class < ? > required ViewClass( ) {
return TilesView . class ;
}
/ * *
* Set the { @link Renderer } to use . If not set , by default
* { @link org . apache . tiles . renderer . DefinitionRenderer } is used .
* Set the { @link Renderer } to use . If not specified , a default
* { @link org . apache . tiles . renderer . DefinitionRenderer } w ill be used .
* @see TilesView # setRenderer ( Renderer )
* /
public void setRenderer ( Renderer renderer ) {
this . renderer = renderer ;
}
@Override
protected TilesView buildView ( String viewName ) throws Exception {
TilesView view = ( TilesView ) super . buildView ( viewName ) ;
view . setRenderer ( this . renderer ) ;
if ( this . renderer ! = null ) {
view . setRenderer ( this . renderer ) ;
}
return view ;
}