@Override public String getPage() { return oldDecorator.getPage(); }
protected void render(Content content, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext, SiteMeshWebAppContext webAppContext) throws IOException, ServletException { request.setAttribute(PAGE, new Content2HTMLPage(content, request)); // see if the URI path (webapp) is set if (oldDecorator.getURIPath() != null) { // in a security conscious environment, the servlet container // may return null for a given URL if (servletContext.getContext(oldDecorator.getURIPath()) != null) { servletContext = servletContext.getContext(oldDecorator.getURIPath()); } } // get the dispatcher for the decorator RequestDispatcher dispatcher = servletContext.getRequestDispatcher(oldDecorator.getPage()); dispatcher.include(request, response); request.removeAttribute(PAGE); }
public Decorator getDecorator(HttpServletRequest request, Page page) { try { Decorator result = null; final Decorator d = super.getDecorator(request, page); String path = modifyPath(d.getPage(), getExt(request.getHeader("Accept-Language"))); File decFile = new File(config.getServletContext().getRealPath(path)); if (decFile.isFile()) { result = new DefaultDecorator(d.getName(), path, null) { public String getInitParameter(String paramName) { return d.getInitParameter(paramName); } }; } return result == null ? super.getDecorator(request, page) : result; } catch (NullPointerException e) { return super.getDecorator(request, page); } }
@Override public String getName() { return oldDecorator.getName(); }
@Override public String getURIPath() { return oldDecorator.getURIPath(); }
public String getInitParameter(String paramName) { return d.getInitParameter(paramName); } };
@Override public String getRole() { return oldDecorator.getRole(); }
@Override public Iterator getInitParameterNames() { return oldDecorator.getInitParameterNames(); } }
public Decorator getDecorator(HttpServletRequest request, Page page) { try { Decorator result = null; final Decorator d = super.getDecorator(request, page); String path = modifyPath(d.getPage(), getExt(request.getHeader("User-Agent"))); File decFile = new File(config.getServletContext().getRealPath(path)); if (decFile.isFile()) { result = new DefaultDecorator(d.getName(), path, null) { public String getInitParameter(String paramName) { return d.getInitParameter(paramName); } }; } return result == null ? super.getDecorator(request, page) : result; } catch (NullPointerException e) { return super.getDecorator(request, page); } }
@Override public Decorator getDecorator(HttpServletRequest request, Page page) { Decorator d = super.getDecorator(request, page); return getResolvedDecorator(d, d.getName(), request); } public Decorator getResolvedDecorator(Decorator current, String name, HttpServletRequest request) { if (name.equalsIgnoreCase("default")) { return getNamedDecorator(request, "externalPartnerDefault"); } return current; }
if (oldDecorator.getURIPath() != null) { if (servletContext.getContext(oldDecorator.getURIPath()) != null) { servletContext = servletContext.getContext(oldDecorator.getURIPath());
@Override public String getInitParameter(String param) { return oldDecorator.getInitParameter(param); }
/** Retrieve Decorator named in 'name' attribute. Checks the role if specified. */ public Decorator getNamedDecorator(HttpServletRequest request, String name) { Decorator result = null; try { result = configLoader.getDecoratorByName(name); } catch (ServletException e) { e.printStackTrace(); } if (result == null || (result.getRole() != null && !request.isUserInRole(result.getRole()))) { // if the result is null or the user is not in the role return super.getNamedDecorator(request, name); } else { return result; } } }
String decoratorName = parent.getDecorator(request, page).getName(); if (decoratorName != null) { decoratorName += '-' + properties.getProperty(os);
public String getInitParameter(String paramName) { return d.getInitParameter(paramName); } };
public com.opensymphony.sitemesh.Decorator selectDecorator(Content content, SiteMeshContext context) { SiteMeshWebAppContext webAppContext = (SiteMeshWebAppContext) context; HttpServletRequest request = webAppContext.getRequest(); com.opensymphony.module.sitemesh.Decorator decorator = decoratorMapper.getDecorator(request, new Content2HTMLPage(content, request)); if (decorator == null || decorator.getPage() == null) { return new NoDecorator(); } else { return new OldDecorator2NewStrutsFreemarkerDecorator(decorator); } } }
"Matched decorator mapper plugin with key " + desc.getPluginKey() + ":" + desc.getKey() + " on path " + httpServletRequest.getServletPath() + ". Returning decorator named " + decorator.getName());
public com.opensymphony.sitemesh.Decorator selectDecorator(Content content, SiteMeshContext context) { SiteMeshWebAppContext webAppContext = (SiteMeshWebAppContext) context; HttpServletRequest request = webAppContext.getRequest(); Decorator decorator = decoratorMapper.getDecorator(request, new Content2HTMLPage(content, request)); if (decorator == null || decorator.getPage() == null) { return new NoDecorator(); } else { return new OldDecorator2NewStrutsVelocityDecorator(decorator); } } }