You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Benjamin Ernst <be...@gmail.com> on 2009/02/05 16:30:23 UTC
Problems Ajax with Portlet 2.0 in Liferay 5.2.1
Hi,
I am Testing the new Portlet 2.0 with Liferay and have some problems with
Ajax-calls.
I am using wicket 1.4-SNAPSHOT(Revision 741130) and Liferay Portal Standard
Edition 5.2.1 (Augustine / Build 5201 / February 3, 2009).
I have a simple page with one label and one Ajaxlink:
public HomePage(final PageParameters parameters) {
final Label label = new Label("label", new
PropertyModel<Integer>(this, "value"));
label.setOutputMarkupId(true);
add(label);
AjaxLink link = new AjaxLink("link")
{
@Override
public void onClick(AjaxRequestTarget target) {
value = value + 1;
target.addComponent(label);
}
};
add(link);
}
The portlet is shown correctly but when I click the Ajaxlink nothing
happens. In the Ajax-Debug-Log appears the following text:
INFO:
INFO: Initiating Ajax POST request on
http://localhost:8080/web/guest/home?random=0.9410006487742066
INFO: Invoking pre-call handler(s)...
INFO: Received ajax response (84 characters)
INFO:
The requested resource (/ACE_PortletTest-1.0-SNAPSHOT/portlettest/) is not
available
ERROR: Error while parsing response: Could not find root <ajax-response>
element
INFO: Invoking post-call handler(s)...
INFO: Invoking failure handler(s)...
This is the log form Java when the Ajax-Link is clicked:
DEBUG - 0-SNAPSHOT] - servletPath=/ACETEST, pathInfo=/invoke,
queryString=null, name=null
DEBUG - 0-SNAPSHOT] - Path Based Forward
DEBUG - WicketPortlet - Portlet "RESOURCE_PHASE" for wicket
url:/portlettest/?wicket:interface=:0:link::IBehaviorListener:0:
DEBUG - 0-SNAPSHOT] - servletPath=/portlettest/,
pathInfo=null, queryString=wicket:interface=:0:link::IBehaviorListener:0:,
name=null
DEBUG - 0-SNAPSHOT] - Path Based Include
DEBUG - WicketPortlet - redirect url after inclusion:null
DEBUG - WicketPortlet - end of request, wicket
url:/portlettest/?wicket:interface=:0:link::IBehaviorListener:0:
DEBUG - 0-SNAPSHOT] - Disabling the response for futher
output
DEBUG - 0-SNAPSHOT] - The Response is vehiculed using a
wrapper: com.liferay.portal.servlet.AbsoluteRedirectsResponse
Here is my web.xml and my portlet.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>ACE_PortletTest</display-name>
<context-param>
<param-name>org.apache.wicket.detectPortletContext</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>configuration</param-name>
<param-value>development</param-value>
<!-- param-value>deployment</param-value -->
</context-param>
<filter>
<filter-name>wicket.ACE_PortletTest</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>de.acando.ace.WicketApplication</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>wicket.ACE_PortletTest</filter-name>
<url-pattern>/portlettest/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
</web-app>
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
<portlet>
<description>ACE Test</description>
<portlet-name>ACETEST</portlet-name>
<display-name>ACETEST</display-name>
<portlet-class>org.apache.wicket.protocol.http.portlet.WicketPortlet</portlet-class>
<init-param>
<name>wicketFilterPath</name>
<value>/portlettest</value>
</init-param>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
<portlet-mode>EDIT</portlet-mode>
</supports>
<supports>
<mime-type>text/xml</mime-type>
<portlet-mode>VIEW</portlet-mode>
<portlet-mode>EDIT</portlet-mode>
</supports>
<portlet-info>
<title>ACE Portlet Test</title>
<keywords>ACE Portlet Test</keywords>
</portlet-info>
</portlet>
<container-runtime-option>
<name>javax.portlet.escapeXml</name>
<value>false</value>
</container-runtime-option>
</portlet-app>
I have no idea whats wrong.
Thanks for any help in advance,
-- Benjamin
Re: Problems Ajax with Portlet 2.0 in Liferay 5.2.1
Posted by Benjamin Ernst <be...@gmail.com>.
Thanks Thijs, this works!
-- Benjamin
On Thu, Feb 5, 2009 at 6:38 PM, Thijs Vonk <vo...@gmail.com> wrote:
> This is an issue with Liferay (see
> http://issues.liferay.com/browse/LPS-1911)
> You can probably fix it by making sure that portlet-name (in portlet.xml)
> and the wicketfilter mapping url-pattern are identical (portlet.xml &
> web.xml)
>
>
>
> On 2/5/09 4:30 PM, Benjamin Ernst wrote:
>
>> Hi,
>>
>> I am Testing the new Portlet 2.0 with Liferay and have some problems with
>> Ajax-calls.
>>
>> I am using wicket 1.4-SNAPSHOT(Revision 741130) and Liferay Portal
>> Standard
>> Edition 5.2.1 (Augustine / Build 5201 / February 3, 2009).
>>
>> I have a simple page with one label and one Ajaxlink:
>>
>> public HomePage(final PageParameters parameters) {
>>
>> final Label label = new Label("label", new
>> PropertyModel<Integer>(this, "value"));
>> label.setOutputMarkupId(true);
>> add(label);
>>
>> AjaxLink link = new AjaxLink("link")
>> {
>>
>> @Override
>> public void onClick(AjaxRequestTarget target) {
>> value = value + 1;
>> target.addComponent(label);
>> }
>>
>> };
>> add(link);
>> }
>>
>> The portlet is shown correctly but when I click the Ajaxlink nothing
>> happens. In the Ajax-Debug-Log appears the following text:
>>
>> INFO:
>> INFO: Initiating Ajax POST request on
>> http://localhost:8080/web/guest/home?random=0.9410006487742066
>> INFO: Invoking pre-call handler(s)...
>> INFO: Received ajax response (84 characters)
>> INFO:
>> The requested resource (/ACE_PortletTest-1.0-SNAPSHOT/portlettest/) is not
>> available
>> ERROR: Error while parsing response: Could not find root<ajax-response>
>> element
>> INFO: Invoking post-call handler(s)...
>> INFO: Invoking failure handler(s)...
>>
>> This is the log form Java when the Ajax-Link is clicked:
>>
>> DEBUG - 0-SNAPSHOT] - servletPath=/ACETEST,
>> pathInfo=/invoke,
>> queryString=null, name=null
>> DEBUG - 0-SNAPSHOT] - Path Based Forward
>> DEBUG - WicketPortlet - Portlet "RESOURCE_PHASE" for wicket
>> url:/portlettest/?wicket:interface=:0:link::IBehaviorListener:0:
>> DEBUG - 0-SNAPSHOT] - servletPath=/portlettest/,
>> pathInfo=null, queryString=wicket:interface=:0:link::IBehaviorListener:0:,
>> name=null
>> DEBUG - 0-SNAPSHOT] - Path Based Include
>> DEBUG - WicketPortlet - redirect url after inclusion:null
>> DEBUG - WicketPortlet - end of request, wicket
>> url:/portlettest/?wicket:interface=:0:link::IBehaviorListener:0:
>> DEBUG - 0-SNAPSHOT] - Disabling the response for futher
>> output
>> DEBUG - 0-SNAPSHOT] - The Response is vehiculed using a
>> wrapper: com.liferay.portal.servlet.AbsoluteRedirectsResponse
>>
>> Here is my web.xml and my portlet.xml:
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="
>> http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
>> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>> version="2.4">
>>
>> <display-name>ACE_PortletTest</display-name>
>>
>> <context-param>
>> <param-name>org.apache.wicket.detectPortletContext</param-name>
>> <param-value>true</param-value>
>> </context-param>
>>
>> <context-param>
>> <param-name>configuration</param-name>
>> <param-value>development</param-value>
>> <!-- param-value>deployment</param-value -->
>> </context-param>
>>
>> <filter>
>> <filter-name>wicket.ACE_PortletTest</filter-name>
>>
>> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
>> <init-param>
>> <param-name>applicationClassName</param-name>
>> <param-value>de.acando.ace.WicketApplication</param-value>
>> </init-param>
>> </filter>
>>
>> <filter-mapping>
>> <filter-name>wicket.ACE_PortletTest</filter-name>
>> <url-pattern>/portlettest/*</url-pattern>
>> <dispatcher>REQUEST</dispatcher>
>> <dispatcher>FORWARD</dispatcher>
>> <dispatcher>INCLUDE</dispatcher>
>> </filter-mapping>
>> </web-app>
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <portlet-app xmlns="
>> http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"
>> xsi:schemaLocation="
>> http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
>> http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
>> <portlet>
>> <description>ACE Test</description>
>> <portlet-name>ACETEST</portlet-name>
>> <display-name>ACETEST</display-name>
>>
>>
>> <portlet-class>org.apache.wicket.protocol.http.portlet.WicketPortlet</portlet-class>
>> <init-param>
>> <name>wicketFilterPath</name>
>> <value>/portlettest</value>
>> </init-param>
>> <supports>
>> <mime-type>text/html</mime-type>
>> <portlet-mode>VIEW</portlet-mode>
>> <portlet-mode>EDIT</portlet-mode>
>> </supports>
>> <supports>
>> <mime-type>text/xml</mime-type>
>> <portlet-mode>VIEW</portlet-mode>
>> <portlet-mode>EDIT</portlet-mode>
>> </supports>
>> <portlet-info>
>> <title>ACE Portlet Test</title>
>> <keywords>ACE Portlet Test</keywords>
>> </portlet-info>
>> </portlet>
>> <container-runtime-option>
>> <name>javax.portlet.escapeXml</name>
>> <value>false</value>
>> </container-runtime-option>
>> </portlet-app>
>>
>>
>> I have no idea whats wrong.
>>
>> Thanks for any help in advance,
>>
>> -- Benjamin
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Problems Ajax with Portlet 2.0 in Liferay 5.2.1
Posted by Thijs Vonk <vo...@gmail.com>.
This is an issue with Liferay (see
http://issues.liferay.com/browse/LPS-1911)
You can probably fix it by making sure that portlet-name (in
portlet.xml) and the wicketfilter mapping url-pattern are identical
(portlet.xml & web.xml)
On 2/5/09 4:30 PM, Benjamin Ernst wrote:
> Hi,
>
> I am Testing the new Portlet 2.0 with Liferay and have some problems with
> Ajax-calls.
>
> I am using wicket 1.4-SNAPSHOT(Revision 741130) and Liferay Portal Standard
> Edition 5.2.1 (Augustine / Build 5201 / February 3, 2009).
>
> I have a simple page with one label and one Ajaxlink:
>
> public HomePage(final PageParameters parameters) {
>
> final Label label = new Label("label", new
> PropertyModel<Integer>(this, "value"));
> label.setOutputMarkupId(true);
> add(label);
>
> AjaxLink link = new AjaxLink("link")
> {
>
> @Override
> public void onClick(AjaxRequestTarget target) {
> value = value + 1;
> target.addComponent(label);
> }
>
> };
> add(link);
> }
>
> The portlet is shown correctly but when I click the Ajaxlink nothing
> happens. In the Ajax-Debug-Log appears the following text:
>
> INFO:
> INFO: Initiating Ajax POST request on
> http://localhost:8080/web/guest/home?random=0.9410006487742066
> INFO: Invoking pre-call handler(s)...
> INFO: Received ajax response (84 characters)
> INFO:
> The requested resource (/ACE_PortletTest-1.0-SNAPSHOT/portlettest/) is not
> available
> ERROR: Error while parsing response: Could not find root<ajax-response>
> element
> INFO: Invoking post-call handler(s)...
> INFO: Invoking failure handler(s)...
>
> This is the log form Java when the Ajax-Link is clicked:
>
> DEBUG - 0-SNAPSHOT] - servletPath=/ACETEST, pathInfo=/invoke,
> queryString=null, name=null
> DEBUG - 0-SNAPSHOT] - Path Based Forward
> DEBUG - WicketPortlet - Portlet "RESOURCE_PHASE" for wicket
> url:/portlettest/?wicket:interface=:0:link::IBehaviorListener:0:
> DEBUG - 0-SNAPSHOT] - servletPath=/portlettest/,
> pathInfo=null, queryString=wicket:interface=:0:link::IBehaviorListener:0:,
> name=null
> DEBUG - 0-SNAPSHOT] - Path Based Include
> DEBUG - WicketPortlet - redirect url after inclusion:null
> DEBUG - WicketPortlet - end of request, wicket
> url:/portlettest/?wicket:interface=:0:link::IBehaviorListener:0:
> DEBUG - 0-SNAPSHOT] - Disabling the response for futher
> output
> DEBUG - 0-SNAPSHOT] - The Response is vehiculed using a
> wrapper: com.liferay.portal.servlet.AbsoluteRedirectsResponse
>
> Here is my web.xml and my portlet.xml:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
> version="2.4">
>
> <display-name>ACE_PortletTest</display-name>
>
> <context-param>
> <param-name>org.apache.wicket.detectPortletContext</param-name>
> <param-value>true</param-value>
> </context-param>
>
> <context-param>
> <param-name>configuration</param-name>
> <param-value>development</param-value>
> <!-- param-value>deployment</param-value -->
> </context-param>
>
> <filter>
> <filter-name>wicket.ACE_PortletTest</filter-name>
>
> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
> <init-param>
> <param-name>applicationClassName</param-name>
> <param-value>de.acando.ace.WicketApplication</param-value>
> </init-param>
> </filter>
>
> <filter-mapping>
> <filter-name>wicket.ACE_PortletTest</filter-name>
> <url-pattern>/portlettest/*</url-pattern>
> <dispatcher>REQUEST</dispatcher>
> <dispatcher>FORWARD</dispatcher>
> <dispatcher>INCLUDE</dispatcher>
> </filter-mapping>
> </web-app>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"
> xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
> http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
> <portlet>
> <description>ACE Test</description>
> <portlet-name>ACETEST</portlet-name>
> <display-name>ACETEST</display-name>
>
> <portlet-class>org.apache.wicket.protocol.http.portlet.WicketPortlet</portlet-class>
> <init-param>
> <name>wicketFilterPath</name>
> <value>/portlettest</value>
> </init-param>
> <supports>
> <mime-type>text/html</mime-type>
> <portlet-mode>VIEW</portlet-mode>
> <portlet-mode>EDIT</portlet-mode>
> </supports>
> <supports>
> <mime-type>text/xml</mime-type>
> <portlet-mode>VIEW</portlet-mode>
> <portlet-mode>EDIT</portlet-mode>
> </supports>
> <portlet-info>
> <title>ACE Portlet Test</title>
> <keywords>ACE Portlet Test</keywords>
> </portlet-info>
> </portlet>
> <container-runtime-option>
> <name>javax.portlet.escapeXml</name>
> <value>false</value>
> </container-runtime-option>
> </portlet-app>
>
>
> I have no idea whats wrong.
>
> Thanks for any help in advance,
>
> -- Benjamin
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org