Wicket 1.4.5 + JBoss Portal 2.7.2: Ajax Requests are not recognized by JBoss
Portal
-----------------------------------------------------------------------------------
Key: WICKET-2707
URL: https://issues.apache.org/jira/browse/WICKET-2707
Project: Wicket
Issue Type: Bug
Components: wicket-portlet
Affects Versions: 1.4.5
Environment: Windows XP SP3
jdk1.5.0_15
Wicket 1.4.5
JBoss Portal 2.7.2
Spring 2.5.2
Reporter: Uttam Phalnikar
While testing Wicket 1.4.5 based portlets on JBoss Portal 2.7.2, it was
realized that JBoss is not recognizing the Ajax Requests. After some debugging,
the root cause turned out to be following code from wicket-ajax.js.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if (Wicket.isPortlet()) {
// first check if a query string is provided
var qs = this.url.indexOf('?');
if (qs==-1) {
qs = this.url.indexOf('&');
}
if (qs>-1) {
var query = this.url.substring(qs+1);
// ensure the query is not empty
if (query && query.length > 0) {
// cut off query part from original url
this.url = this.url.substring(0,qs);
// ensure query ends with &
if (query.charAt(query.length-1)!='&') {
query += "&";
}
// post the query string instead to support portlets
// for which you cannot modify/append to the url
return this.post(query);
}
}
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
For some reason this JS code converts query string into POST data. JBoss portal
server code tries to read "action" parameter in the query string & fails to
recognize the request. As a fix, I had to comment out the this "if" loop.
In addition, it was found that while redirecting the request from WicketPortet
to WicketFilter, the "wicket-ajax" header gets lost. That confuses the Wicket
code. As a fix, I had to change "createUrl" JS function from wicket-ajax.js to
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
createUrl: function() {
var createdUrl;
if (this.randomURL == false)
createdUrl = this.url;
else
createdUrl = this.url + (this.url.indexOf("?")>-1 ? "&"
: "?") + "random=" + Math.random();
if (Wicket.isPortlet()) {
var qs = createdUrl.indexOf('?');
if (qs==-1) {
createdUrl = createdUrl + "?wicket:ajax=true";
}else{
createdUrl = createdUrl + "&wicket:ajax=true";
}
}
return createdUrl;
},
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.