1 7 package org.meshcms.core; 8 9 import java.util.*; 10 import javax.servlet.http.*; 11 import com.opensymphony.module.sitemesh.*; 12 import com.opensymphony.module.sitemesh.mapper.*; 13 14 24 public class RequestDecoratorMapper extends AbstractDecoratorMapper { 25 private String decoratorParameter = null; 26 27 public void init(Config config, Properties properties, DecoratorMapper parent) throws InstantiationException { 28 super.init(config, properties, parent); 29 decoratorParameter = properties.getProperty("decorator.parameter", "decorator"); 30 } 31 32 public Decorator getDecorator(HttpServletRequest request, Page page) { 33 Decorator result = null; 34 String decorator = (String ) request.getAttribute(decoratorParameter); 35 36 if (decorator != null) { 37 result = getNamedDecorator(request, decorator); 38 } 39 40 return result == null ? super.getDecorator(request, page) : result; 41 } 42 } 43 | Popular Tags |