struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "zhouyanming (JIRA)" <>
Subject [jira] Created: (WW-3328) make sitemesh plugin OldDecorator2NewStrutsFreemarkerDecorator configurable
Date Sat, 14 Nov 2009 09:50:13 GMT
make sitemesh plugin OldDecorator2NewStrutsFreemarkerDecorator configurable

                 Key: WW-3328
             Project: Struts 2
          Issue Type: Improvement
          Components: Plugin - SiteMesh
            Reporter: zhouyanming
            Assignee: Musachy Barroso

struts2 supports sitemesh2.4 now,
I'd like to extends the default OldDecorator2NewStrutsFreemarkerDecorator to do something
fantastic,like compress page,render html fragment for AJAX request
I with struts provide a @Inject way.

here is sample code

public class MyOldDecorator2NewStrutsFreemarkerDecorator extends OldDecorator2NewStrutsFreemarkerDecorator

	public static final String X_FRAGMENT = "X-FRAGMENT";

	public MyOldDecorator2NewStrutsFreemarkerDecorator(Decorator oldDecorator) {

	protected void render(Content content, HttpServletRequest request,
			HttpServletResponse response, ServletContext servletContext,
			ActionContext ctx) throws ServletException, IOException {
		String replacement = request.getHeader(X_FRAGMENT);
		if (replacement != null) {
				StringWriter writer = new StringWriter();
				response.getWriter().write(HtmlUtils.compress(replacement.split(","), writer.toString()));

		} else {
			super.render(content, request, response, servletContext, ctx);


This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message