3

I'm passing the some values url from flex to java example: URL format:

../mahesh/initUser.do?method=fwdAccDetails&securityId=mUuB3/p/ky5JhZPY5T8Znf01YCcIarIalQiGEXPMMsOkWDX+KtT4fx2gMML+uup8

After I'm tiring to get "securityId" values in java like

request.getParameter("securityId")

But I'm getting following values only

mUuB3/p/ky5JhZPY5T8Znf01YCcIarIalQiGEXPMMsOkWDX KtT4fx2gMML uup8

  • symbol getting empty space in java side..

Here is my Flex code:

navigateToURL(new URLRequest('../mahesh/initUser.do?method=fwdAccDetails&securityId='+value+'),'_s‌​elf');

I didn't get full values.. any one can help me how I will get correct values in Java..

Engineer
  • 47,849
  • 12
  • 88
  • 91
Mahesh
  • 31
  • 5
  • 3
    when an URL gets decoded, `+` signs are replaced by a space. Can't you use another character? You could also re-encode the output. – Tim S. Jan 18 '13 at 08:16
  • @TimS. Thanx for your reply. sorry..i dont know how to encode in client side then decode in server side.. Can you please explain u have time..do u have any example – Mahesh Jan 18 '13 at 08:19
  • @Engineer: i'm newly for flex.. can you give any example.. i'm using following url passing navigateToURL(new URLRequest('../mahesh/initUser.do?method=fwdAccDetails&securityId='+value+'),'_self'); – Mahesh Jan 18 '13 at 08:21

2 Answers2

1

You should use the encodeURIComponent()-Function to properly encode your securityId.

value = encodeURIComponent(value);
navigateToURL(new URLRequest('../mahesh/initUser.do?method=fwdAccDetails&securityId='+value+'),'_s‌​elf');

That way your String will be correct on the Java side.

If you want to read more about proper escaping, have a look at When are you supposed to use escape instead of encodeURI / encodeURIComponent? (Same arguments apply for Flex and JavaScript).

Community
  • 1
  • 1
Gregor
  • 4,306
  • 1
  • 22
  • 37
  • :i'm passing following values from flex L3CKYDr49ppJR4kZlDvM+tR2ElxAtpa/yro4ozB/6odCuKD7AcyjWzveOoj/2lJZ After i'm getting the values in java URLCodec encoder = new URLCodec(); String result = encoder.encode(request.getParameter("id")); System.out.println("resultd--"+id); Finally its printing following values L3CKYDr49ppJR4kZlDvM+tR2ElxAtpa%2Fyro4ozB%2F6odCuKD7AcyjWzveOoj%2F2lJZnow slash symbol not displaying can you help me..? – Mahesh Jan 18 '13 at 09:02
0

i just resolve my issue for following code in a javURLDecoder.decode(param1AfterEncoding.replace("+", "%2B"), "UTF-8").replace("%2B", "+") Now its working fine only.. i dint other special character will work fine.. i will check it later..

Mahesh
  • 31
  • 5