留言板

Specify javax.portlet.action in friendly URL mapping routes.xml file?

Phoenix Zerin,修改在12 年前。

Specify javax.portlet.action in friendly URL mapping routes.xml file?

Junior Member 帖子: 60 加入日期: 11-6-28 最近的帖子
For my MVC plugin portlet, I have the following route defined in my friendly URL mapping file:

<!--?xml version="1.0"?-->

<routes>
	<route>
		<pattern>/detail/{image:\d+}/from/{referrer}</pattern>
		<implicit-parameter name="javax.portlet.action">doViewDetail</implicit-parameter>
	</route>
</routes>


Liferay *does* generate the URL correctly when I add the following code to my portlet's JSPs:


<portlet:actionurl name="doViewDetail" var="detailURL">
	<portlet:param name="image" value="<%= Long.toString(image.getImageId()) %>" />
</portlet:actionurl>


The above evaluates to http://.../-/photolibrary/detail/12301/?p_auth=ud04ptaE&...

But when I go to the generated URL, it does not use the correct action (it executes the portlet's doView() method instead).

What do I need to do to fix this?
Phoenix Zerin,修改在12 年前。

RE: Specify javax.portlet.action in friendly URL mapping routes.xml file? (答复)

Junior Member 帖子: 60 加入日期: 11-6-28 最近的帖子
Figured it out. I needed to add the following:

<implicit-parameter name="p_p_lifecycle">1</implicit-parameter>


My routes.xml file now looks like this:

<!--?xml version="1.0"?-->

<routes>
    <route>
        <pattern>/detail/{image:\d+}/from/{referrer}</pattern>
        <implicit-parameter name="p_p_lifecycle">1</implicit-parameter>
        <implicit-parameter name="javax.portlet.action">doViewDetail</implicit-parameter>
    </route>
</routes>
thumbnail
Stian Sigvartsen,修改在10 年前。

RE: Specify javax.portlet.action in friendly URL mapping routes.xml file?

Regular Member 帖子: 103 加入日期: 10-8-27 最近的帖子
Do you/anyone know if this works with Liferay 6.1? I've got a very similar URL route, but when requesting the URL manually it is responding with "forbidden" and "You do not have permission to access the requested resource" page content rendered.

-Stian
thumbnail
Jack Bakker,修改在7 年前。

RE: Specify javax.portlet.action in friendly URL mapping routes.xml file?

Liferay Master 帖子: 978 加入日期: 10-1-3 最近的帖子
Hey Stian, is 6.1 some forgotton Norse island somewhere ? Oh look at the time, it's 2016 already...

I know in 6.2 you'd have to add something like the following for the portlet you want to open up to access an action without the auth token

auth.token.ignore.portlets=82,myportletnamespace