Project

General

Profile

Defect #823

Velocity plugin causing other Servoy clients in same thread to receive wrong datatypes

Added by Marc Boegem almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Urgent
Category:
velocity
Target version:
-
Start date:
09/29/2014
Due date:
% Done:

0%

Estimated time:
Browser (if web client):

Description

As reported previously, the velocity plugin is still causing other Servoy clients in the same Java thread to receive wrong datatypes.
ie. javascript date vs. java.sql.date

In this particular situation, the velocity plugin has been used to serve an html5 application.
It will handle GET and POST requests and return a data object to the template in order to be rendered and returned to the browser.

functions used:
  • getVersion()
  • toJSON() > to get incoming headers and parameters to readable text and to convert a custom JS associative array(Object) to txt in order to store in DB
  • fromJSON() > to parse the latter JSON into an associative array again.
  • createCookie()
  • createErrorResponse()
  • createResponse() > this will return an object holding data and information on the template to be used.

Associated revisions

Revision 1146 (diff)
Added by Patrick Talbot almost 7 years ago

Fix for issue #823

Revision 1147 (diff)
Added by Patrick Talbot almost 7 years ago

Fix for issue #823 + better JSON serialization in Velocity response for non string objects.

History

#1

Updated by Patrick Talbot almost 7 years ago

  • Status changed from New to In Progress

I've changed the way the wrapping of RecordWrapper operates, as well as the fromJSON() method, this should not touch the current ServoyWrapFactory of the Context.currentContext() yet still work fine for Servoy objects.
So v3.3.5 should fix your issue.
Please update and let me know about it.

#2

Updated by Marc Boegem almost 7 years ago

This doesn't seem completely solved.
Results are way better, but datatypes seem to be altered after PUT requests to the server.
The situation:
- Freshly launched servoy server
- Start webclient, which will successfully run through the onOpenSolution method
- Do a PUT using query AJAX request
- Start web client again, now it receives a date in the wrong data type again.

example PUT request:
$.ajax({
url: "../dienst.json",
data: $("#dienst-form-accept").serializeArray(),
type: "PUT",
error: function(){
alert("De server kon niet worden bereikt, herstart de app en probeer het opnieuw");
},
success: function(data) {
if(data.result.error) {
if(data.result.type 'error' || data.result.type 'fatal') {
$('#error-popupDialog a').hide();
onErrorBack();
}
if(data.result.msg) {
$('#error-popupDialog h3').html(data.result.msg);
$("#error-popupDialog").popup();
$("#error-popupDialog").popup('open');
}
} else {
window.history.back();
}
}
});

#3

Updated by Patrick Talbot almost 7 years ago

  • Status changed from In Progress to Closed

Fixed in v3.3.6

Also available in: Atom PDF