Fórum
Jquery getJson not handling large amounts of data
Neelesh Sahay, modificado 6 Anos atrás.
Jquery getJson not handling large amounts of data
New Member Postagens: 14 Data de Entrada: 21/07/17 Postagens Recentes
Hi,
I have been migrating an application from Oracle webcenter to Liferay 7 dxp.
There is a jquery (ajax) call $.getJSON which retrieves a large amount of data as application/json format. It works perfectly in webcenter, but does not work in Liferay. If I reduce the data, it works fine which leads me to that Liferay/tomcat is not allowing that amount of data.
I updated the connector in the server.xml
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8" maxPostSize="-1" />
Even tried specific numbers but it still fails.
I also wrote is an ajax method, but still no luck.
Is there any other way to increase the POST size or another way to resolve this in Liferay/tomcat 8?
Thanks,
Neelesh
I have been migrating an application from Oracle webcenter to Liferay 7 dxp.
There is a jquery (ajax) call $.getJSON which retrieves a large amount of data as application/json format. It works perfectly in webcenter, but does not work in Liferay. If I reduce the data, it works fine which leads me to that Liferay/tomcat is not allowing that amount of data.
I updated the connector in the server.xml
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8" maxPostSize="-1" />
Even tried specific numbers but it still fails.
I also wrote is an ajax method, but still no luck.
Is there any other way to increase the POST size or another way to resolve this in Liferay/tomcat 8?
Thanks,
Neelesh
Daniele Baggio, modificado 6 Anos atrás.
RE: Jquery getJson not handling large amounts of data
Expert Postagens: 336 Data de Entrada: 05/12/08 Postagens Recentes
Can you specify the data amount for the POST and the excepted json result?
Neelesh Sahay, modificado 6 Anos atrás.
RE: Jquery getJson not handling large amounts of data
New Member Postagens: 14 Data de Entrada: 21/07/17 Postagens Recentes
An example of the JSON Created is attached.
A quick print out of the String.getBytes.length() returns 6990 is the max I can go with out it breaking. Anything over that breaks.
A quick print out of the String.getBytes.length() returns 6990 is the max I can go with out it breaking. Anything over that breaks.
Anexos:
Neelesh Sahay, modificado 6 Anos atrás.
RE: Jquery getJson not handling large amounts of data
New Member Postagens: 14 Data de Entrada: 21/07/17 Postagens Recentes
Once this data returns to the ajax, it is processed using the following method.
If it is larger than 214 records in the JSON, it does not even go inside the success.
function getVendorsByCriteriaLookup() {
console.log("Entered getData");
$.getJSON('${getData}',
{
ajax : 'true', dataType : 'json', type : 'POST'
},
function (data) {
var i=0;
console.log("Entered data: "+ data.length);
$.each(data, function (index, vendor) {
console.log("vendor: "+ vendor);
var vendorStr = vendor.split(':');
arrVendor=new Array(vendorStr[0],vendorStr[1],vendorStr[2],vendorStr[3]) ;
i++;
});
console.log("Loop completed");
setTheDataINA DropDownList();
console.log("drop down set");
try{
if($("#vendorBackSelect").val()!=null && $("#vendorBackSelect").val()!=''){
$("#vendorInputSelectId").val($("#vendorBackSelect").val());
}
}catch(e){}
});
If it is larger than 214 records in the JSON, it does not even go inside the success.
function getVendorsByCriteriaLookup() {
console.log("Entered getData");
$.getJSON('${getData}',
{
ajax : 'true', dataType : 'json', type : 'POST'
},
function (data) {
var i=0;
console.log("Entered data: "+ data.length);
$.each(data, function (index, vendor) {
console.log("vendor: "+ vendor);
var vendorStr = vendor.split(':');
arrVendor=new Array(vendorStr[0],vendorStr[1],vendorStr[2],vendorStr[3]) ;
i++;
});
console.log("Loop completed");
setTheDataINA DropDownList();
console.log("drop down set");
try{
if($("#vendorBackSelect").val()!=null && $("#vendorBackSelect").val()!=''){
$("#vendorInputSelectId").val($("#vendorBackSelect").val());
}
}catch(e){}
});
Neelesh Sahay, modificado 6 Anos atrás.
RE: Jquery getJson not handling large amounts of data
New Member Postagens: 14 Data de Entrada: 21/07/17 Postagens Recentes
I solved it using Liferay AUI
Thanks,
Neelesh
Thanks,
Neelesh
Daniele Baggio, modificado 6 Anos atrás.
RE: Jquery getJson not handling large amounts of data
Expert Postagens: 336 Data de Entrada: 05/12/08 Postagens Recentes
Ok, A.io.request is a good integrated library for ajax operations. Never a problem in years of using.
Very odd the jquery way.. 13k of json is a small/medium size data to me.
@baxtheman
Very odd the jquery way.. 13k of json is a small/medium size data to me.
@baxtheman
Neelesh Sahay, modificado 6 Anos atrás.
RE: Jquery getJson not handling large amounts of data
New Member Postagens: 14 Data de Entrada: 21/07/17 Postagens Recentes
Yes, I could not understand why this was the case.
The Jquery way was working just fine in webcenter.
Thanks,
Neelesh
The Jquery way was working just fine in webcenter.
Thanks,
Neelesh