Ilyas Patel
unread,Jun 4, 2012, 5:38:34 PM6/4/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to SiteMesh 3 Users
I use SiteMesh 2 xml configuration to add specific headers and footers
to a page depending on a URL (for our main site).
I would like to now add a different header and footer if the HTTP
Referer is within a specific list and I don’t want to use the
decorators.xml we use for the main site. I am trying to use Java based
configuration as documented on the SiteMesh site.
To keep things simple this is what I have so far:
public class PartnerFilter extends ConfigurableSiteMeshFilter {
@Override
protected void applyCustomConfiguration(SiteMeshFilterBuilder
builder) {
builder.setCustomDecoratorSelector(new
SomeDecoratorSelector());
}
@Override
public void init(FilterConfig filterConfig) throws
ServletException {
SiteMeshFilterBuilder builder = new SiteMeshFilterBuilder();
applyCustomConfiguration(builder);
}
@Override
public void doFilter(ServletRequest request, ServletResponse
response, FilterChain chain)throws IOException, ServletException {
chain.doFilter(request, response);
}
class SomeDecoratorSelector implements
DecoratorSelector<WebAppContext> {
String decorator;
@Override
public String[] selectDecoratorPaths(Content content,
WebAppContext context) throws IOException {
decorator = "/WEB-INF/decoratorsPartnerSites.xml";
return decorator.split(",");
}
}
}
The decoratorsPartnerSites.xml file specified in the class file is not
being recognised. I have tried decorators.html and this does not work
either. Is there a way to not use the normal decorators.xml on a per
request basis?
I am fairly new to Java so any assistance would be grateful.