[ 
https://issues.apache.org/jira/browse/WW-3328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lukasz Lenart closed WW-3328.
-----------------------------
    Resolution: Won't Fix

> make sitemesh plugin OldDecorator2NewStrutsFreemarkerDecorator configurable
> ---------------------------------------------------------------------------
>
>                 Key: WW-3328
>                 URL: https://issues.apache.org/jira/browse/WW-3328
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - SiteMesh
>            Reporter: Yanming Zhou
>            Assignee: Musachy Barroso
>            Priority: Major
>             Fix For: 6.1.0
>
>
> struts2 supports sitemesh2.4 now, WW-3291
> 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) {
>               super(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();
>                               content.writeBody(writer);
>                               
> response.getWriter().write(HtmlUtils.compress(replacement.split(","), 
> writer.toString())); 
>                               return;
>               } else {
>                       super.render(content, request, response, 
> servletContext, ctx);
>               }
>       }
> }



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to