You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Lenart (Updated) (JIRA)" <ji...@apache.org> on 2011/12/09 09:18:40 UTC
[jira] [Updated] (WW-3328) make sitemesh plugin
OldDecorator2NewStrutsFreemarkerDecorator configurable
[ https://issues.apache.org/jira/browse/WW-3328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Lenart updated WW-3328:
------------------------------
Fix Version/s: 3.x
> 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: zhouyanming
> Assignee: musachy
> Fix For: 3.x
>
>
> struts2 supports sitemesh2.4 now, https://issues.apache.org/struts/browse/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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira