如何使用Ext插件自定义com.liferay.portlet.wiki.action.GetPageAttachmentAction

如何使用Ext插件自定义com.liferay.portlet.wiki.action.GetPageAttachmentAction,liferay,liferay-6,Liferay,Liferay 6,我正在使用Liferay 6.2,我想修改GetPageAttachmentAction 我想在StrutExecute中添加以下代码,以便在文件名中包含标题: 公共行动前向结构执行 ActionMapping ActionMapping,ActionForm ActionForm, HttpServletRequest请求,HttpServletResponse响应 抛出异常{ long nodeId=paramultil.getLongrequest,nodeId; String title

我正在使用Liferay 6.2,我想修改GetPageAttachmentAction

我想在StrutExecute中添加以下代码,以便在文件名中包含标题:

公共行动前向结构执行 ActionMapping ActionMapping,ActionForm ActionForm, HttpServletRequest请求,HttpServletResponse响应 抛出异常{ long nodeId=paramultil.getLongrequest,nodeId; String title=paramultil.getStringrequest,title; 字符串文件名=ParamUtil.getStringrequest,文件名; //这是找我的零钱: int pos=fileName.indexOfCharPool.SLASH; 如果pos>=0{ title=fileName.substring0,位置; fileName=fileName.substringpos+1; } ... 如果我通过使用自定义类扩展BaseStrutsPortletAction来为这个更改创建一个钩子插件,那么它不会提供StrutExecute来覆盖


我应该改用Ext插件吗?如果是,请建议我修改GetPageAttachmentAction的Ext插件配置。

您可以选择:钩子插件或Ext插件

但钩子在这里似乎更有意义:

公共类MyGetPageAttachmentAction扩展BaseStrutsPortletAction{ 公开诉讼 StrutsPortletAction原始StrutsPortletAction, PortletConfig PortletConfig,ActionRequest ActionRequest, 动作回应动作回应 抛出异常{ String title=paramultil.getStringactionRequest,title; 字符串文件名=ParamUtil.getStringactionRequest,文件名; //您的代码: int pos=fileName.indexOfCharPool.SLASH; 如果pos>=0{ title=fileName.substring0,位置; fileName=fileName.substringpos+1; } //Wrap request添加新参数原始请求参数是不可变的 DynamicActionRequest DynamicActionRequest=新DynamicActionRequestactionRequest,true; dynamicActionRequest.setParameterfileName,文件名; dynamicActionRequest.setParametertitle,标题; //并将其委托给原始操作 originalStrutsPortletAction.processActionportletConfig、dynamicActionRequest、actionResponse; } }
根据您的问题,我猜您已经在liferay hook.xml中进行了正确的设置。您能在strutExecute中显示您想要更改的内容吗?我想在strutExecute方法调用的getFile方法中添加代码,以分离文件wiki标题和文件名。因此,我想添加以下代码int pos=fileName.indexOfCharPool.SLASH;if pos!=-1{title=fileName.substring0,pos;fileName=fileName.substringpos+1;}我将这些信息集成到了您的问题中