I'm currently using the Grails portlets plugin and I'm exploring how to properly route AJAX methods.
It seems like <portlet:actionURL>
is only able to map to methods that return models for GSPs, while <portlet:resourceURL>
doesn't seem to have any effect in my portlet.
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()}";
When attempting to hit these URLs with an AJAX GET
or POST
request, my methods aren't being triggered (for resourceURL) or only a view is rendered (actionURL).
Does anyone know the proper way to achieve this using Liferay?