Fórum
Bridge impl 4.0.1 causes illegal argument exception
Micael Ericsson, modificado 7 Anos atrás.
Bridge impl 4.0.1 causes illegal argument exception
Regular Member Postagens: 169 Data de Entrada: 11/12/12 Postagens Recentes
Our portlets are running on Liferay 6.2. We would like to move our liferay faces from 4.2.5-ga6 to their new artifact id and version numbers. These are the new dependencies:
Upon running portlets with new dependecies IllegalArgumentException is thrown. Debugging class BridgeURLActionImpl I found problem at row 205:
Via Git I examined https://github.com/liferay/liferay-portal/blob/6.2.x/portal-impl/src/com/liferay/portlet/PortletURLImpl.java
In master branch the same method has the following code:
According to Liferay version scheme com.liferay.faces.bridge.impl version 4.x should work with Liferay 6.2, but I don't get it to work.
Am I missing something or is this a bug in BridgeURLActionImpl/PortletURLImpl.java combination?
I have tried with 4.0.1-SNAPSHOT of bridge impl. When looking at 4.x version in Git it has the same problem.
<dependency>
<groupId>com.liferay.faces</groupId>
<artifactId>com.liferay.faces.alloy</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.liferay.faces</groupId>
<artifactId>com.liferay.faces.bridge.api</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.liferay.faces</groupId>
<artifactId>com.liferay.faces.bridge.impl</artifactId>
<version>4.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.liferay.faces</groupId>
<artifactId>com.liferay.faces.util</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.liferay.faces</groupId>
<artifactId>com.liferay.faces.portal</artifactId>
<version>2.0.0</version>
</dependency>
Upon running portlets with new dependecies IllegalArgumentException is thrown. Debugging class BridgeURLActionImpl I found problem at row 205:
// According to the Bridge Spec, the "javax.portlet.faces.PortletMode"" parameter must not be
// "carried forward to the generated reference." According to a clarification in the Portlet 3.0
// JavaDoc for BaseURL#setProperty(String,String), setting the parameter to null will remove it.
portletURL.setParameter(Bridge.PORTLET_MODE_PARAMETER, (String) null);
Via Git I examined https://github.com/liferay/liferay-portal/blob/6.2.x/portal-impl/src/com/liferay/portlet/PortletURLImpl.java
@Override
public void setParameter(String name, String value, boolean append) {
if ((name == null) || (value == null)) {
throw new IllegalArgumentException();
}
setParameter(name, new String[] {value}, append);
}
In master branch the same method has the following code:
public void setParameter(String name, String value, boolean append) {
if (name == null) {
throw new IllegalArgumentException();
}
if (value == null) {
removeParameter(name);
return;
}
setParameter(name, new String[] {value}, append);
}
According to Liferay version scheme com.liferay.faces.bridge.impl version 4.x should work with Liferay 6.2, but I don't get it to work.
Am I missing something or is this a bug in BridgeURLActionImpl/PortletURLImpl.java combination?
I have tried with 4.0.1-SNAPSHOT of bridge impl. When looking at 4.x version in Git it has the same problem.
Neil Griffin, modificado 7 Anos atrás.
RE: Bridge impl 4.0.1 causes illegal argument exception
Liferay Legend Postagens: 2655 Data de Entrada: 27/07/05 Postagens Recentes
Hi Micael,
You might be missing this dependency:
If you visit www.liferayfaces.org there is a new portlet on the home page that will help you choose the correct dependencies for your Liferay + JSF configuration.
Kind Regards,
Neil
You might be missing this dependency:
<dependency>
<groupid>com.liferay.faces</groupid>
<artifactid>com.liferay.faces.bridge.ext</artifactid>
<version>3.0.0</version>
</dependency>
If you visit www.liferayfaces.org there is a new portlet on the home page that will help you choose the correct dependencies for your Liferay + JSF configuration.
Kind Regards,
Neil
Micael Ericsson, modificado 7 Anos atrás.
RE: Bridge impl 4.0.1 causes illegal argument exception
Regular Member Postagens: 169 Data de Entrada: 11/12/12 Postagens Recentes
I include bridge ext and followed version guide line (replaced jsf-api and jsf-impl with javax.faces and javax.faces.api).
Now everything is running as expected with a first test. It looks promising.
The friendly urls are almost there. We have a p_auth tag that needs to be excluded.
Current friendly url mapping:
With first 2 implicit parameter friendly url works except that p_auth is shown. Ignoring or excluding p_auth doesn't work. Should it be possible to exclude p_auth from friendly url?
Now everything is running as expected with a first test. It looks promising.
The friendly urls are almost there. We have a p_auth tag that needs to be excluded.
Current friendly url mapping:
<route>
<pattern>/ansokan</pattern>
<implicit-parameter name="_facesViewIdRender">/views/ansokan.xhtml</implicit-parameter>
<implicit-parameter name="p_p_lifecycle">1</implicit-parameter>
<ignored-parameter>p_auth</ignored-parameter>
</route>
With first 2 implicit parameter friendly url works except that p_auth is shown. Ignoring or excluding p_auth doesn't work. Should it be possible to exclude p_auth from friendly url?
Kyle Joseph Stiemann, modificado 7 Anos atrás.
RE: Bridge impl 4.0.1 causes illegal argument exception
Liferay Master Postagens: 760 Data de Entrada: 14/01/13 Postagens Recentes
Hi Micael,
The p_auth parameter can be removed, but since it protects your portlet from Cross-Site Request Forgery (CSRF), you may not want to do that. Instead it'd probably be better to do something like this:
<route>
<pattern>/ansokan/{p_auth}</pattern>
<implicit-parameter name="_facesViewIdRender">/views/ansokan.xhtml</implicit-parameter>
<implicit-parameter name="p_p_lifecycle">1</implicit-parameter>
</route>
However, if you're sure that you want to remove the paramter, Liferay does give you the option of disabling it. But the p_auth parameter cannot be removed or suppressed using friendly URL features. Instead you need to disable it via portal properties or an init-param. If you are sure you want to remove the parameter, I'd recommend disabling it only for your portlet via an init-param in your portlet.xml:
<init-param>
<name>check-auth-token</name>
<value>false</value>
</init-param>
- Kyle
The p_auth parameter can be removed, but since it protects your portlet from Cross-Site Request Forgery (CSRF), you may not want to do that. Instead it'd probably be better to do something like this:
<route>
<pattern>/ansokan/{p_auth}</pattern>
<implicit-parameter name="_facesViewIdRender">/views/ansokan.xhtml</implicit-parameter>
<implicit-parameter name="p_p_lifecycle">1</implicit-parameter>
</route>
However, if you're sure that you want to remove the paramter, Liferay does give you the option of disabling it. But the p_auth parameter cannot be removed or suppressed using friendly URL features. Instead you need to disable it via portal properties or an init-param. If you are sure you want to remove the parameter, I'd recommend disabling it only for your portlet via an init-param in your portlet.xml:
<init-param>
<name>check-auth-token</name>
<value>false</value>
</init-param>
- Kyle
Juan Gonzalez, modificado 7 Anos atrás.
Moved to Liferay Faces category
Liferay Legend Postagens: 3089 Data de Entrada: 28/10/08 Postagens Recentes
Moved to Liferay Faces category