Message Boards

How to call custom MVCResourceCommand from .jsp file in 7.1

Jani Oksanen, modified 4 Years ago.

How to call custom MVCResourceCommand from .jsp file in 7.1

New Member Posts: 12 Join Date: 8/29/17 Recent Posts
Hello!
I'm currently developing custom assetpublisher fragment for 7.1 dxp and my goal is to make modifications to RSS-feed.
I'm following this https://portal.liferay.dev/docs/7-1/tutorials/-/knowledge_base/t/mvc-resource-command example to implement custom resourceCommand call. I have created CustomRSSMVCResourceCommand class which implements MVCResourceCommand. Problem is that my custom class is never called and that's why my system.out will be never printed and my redirect page is plank(when clicked on portal page). How do I implement this call so that it works correctly?

@Component(immediate = true, property ={ "javax.portlet.name="+AssetPublisherPortletKeys.ASSET_PUBLISHER,"mvc.command.name="/custom/RSS"}
,service = MVCResourceCommand.class)
public class CustomRSSMVCResourceCommand implements MVCResourceCommand{

    @Override
    public boolean serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse){
    System.out.println("Testing testing");
    
    return false;
    
    }
}


and i'm calling it on assetPublisher view.jsp file with


<liferay-portlet:resourceurl id="/custom/RSS" varImpl="customRSS" />
<liferay-rss:rss resourceURL="<%=customRSS%>" I have also tried but this does not work either <portlet:resourceURL id="/custom/RSS" var="customRSS" />
<aui:a href="<%=customRSS%>">link for RSS</aui:a>

Thanks for help!