I am trying to send base64 details from client side(java script) to server(java). In order to reduce the base64 size, I am using lz-string.js as follow:
var base64Data = "0dYWVpjZGVmZ2hpanN0dXZ3eHl6g";
var compressed = LZString.compress(base64Data);
As you aware Once it compressed by LZ the data will look like follow:
Hence I am sending the data to server side by following Ajax call:
var formData = "img="+compressed";
jQuery.blockUI();
jQuery.ajax({
url : "/myapplication/Saverequest",
type: "POST",
data : formData,
cache: false,
async:false,
success: function(data, textStatus, jqXHR) {
");
I can able to retrive the data in my action class(java) as it is. But I cant decomplress the the data. I do requrie the same I sent !(refer : base64Data)
I did use few code in online regarding LZ (LZString.Java) but it is not decompressing the data!!
Please help me to find proper java libs where I can decompress this. Thanks in advance.
This can be done by mentioning UTF-8 encode by follow:
in server.xml under config:
Connector port="8080" protocol="HTTP/1.1 connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"
In HTML/JSP :
meta content="text/html; charset=UTF-8" http-equiv="Content-Type
mentioning in java action class in the beginning:
request.setCharacterEncoding("utf-8");
Most importantly compress/decompress is not working for this. I have used compressToUTF16/decompressFromUTF16. This getting outcome as UTF16 only works!