You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Uttam Phalnikar (JIRA)" <ji...@apache.org> on 2010/01/29 03:51:34 UTC

[jira] Created: (WICKET-2707) Wicket 1.4.5 + JBoss Portal 2.7.2: Ajax Requests are not recognized by JBoss Portal

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.


[jira] Assigned: (WICKET-2707) Wicket 1.4.5 + JBoss Portal 2.7.2: Ajax Requests are not recognized by JBoss Portal

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2707?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg reassigned WICKET-2707:
-------------------------------------

    Assignee: Ate Douma

> 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
>            Assignee: Ate Douma
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> 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.


[jira] Resolved: (WICKET-2707) Wicket 1.4.5 + JBoss Portal 2.7.2: Ajax Requests are not recognized by JBoss Portal

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2707?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-2707.
-----------------------------------

      Assignee: Igor Vaynberg  (was: Ate Douma)
    Resolution: Won't Fix

please try with latest version of jboss portal. this was done this way on purpose, so i assume it should work

> 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
>            Assignee: Igor Vaynberg
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> 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.