0
votes

I'm using the grails portlets plugin, and I'm trying to figure out how to route ajax methods.

<portlet:actionURL> seems to only map to methods which can return models to GSPs, <portlet:resourceURL> doesn't get hit in my portlet at all, it seems.

class MyPortlet {
    def title = 'MyPortlet'
    def description = '''
        My Portlet
        '''
    def displayName = 'MyPortlet'
    def supports = ['text/html': ['view']]

    def liferay_display_category = 'MyPortlet'
    def liferay_portlet_header_portlet_css = [
...
    ]

    def liferay_portlet_header_portlet_javascript = [
...
    ]

    def renderView = {
        [...]
    }

    def actionView = {
        [...]
    }
}

JS:

this.portletUrl = "${portletResponse.createResourceURL()}";
or this.portletUrl = "${portletResponse.createActionURL()}";

If I hit either of these URLs with an AJAX GET or POST request, I either don't hit my methods (for resourceURL) or only seem to render a view (actionURL).

Any idea how to do this properly through liferay?

1

1 Answers

0
votes

Use DWR and your problems go away.