jon*_*jon 1 java string escaping
我的客户端应用程序将一个字符串发送到服务器端进行解码.有问题的字符串可能包含"+"字符.我的问题是当我想要处理字符串时,它会消除'+'字符消失(可能被视为连接运算符.我怎么能解决这个问题?字符串不是正确的类型吗?我应该使用字节[]代替?
客户端:
$.ajax({
type: "GET",
url: "my/url/DecryptString",
data: "encryptedString="+$("#myStringInput").val(),
...
Run Code Online (Sandbox Code Playgroud)
服务器端代码:
...
public String decryptString(@QueryParam("encryptedString") String encryptedString) {
logger.info("=====> decryptString()");
String decryptedString = null;
Properties properties = new Properties();
logger.debug("encryptedString: " + encryptedString);
// get crypto properties
try {
properties.load(toto.class.getResourceAsStream("/config.properties"));
} catch (IOException e1) {
logger.error(e1.getStackTrace());
}
if(properties.isEmpty()) {
logger.error("Properties file is EMPTY!");
}
String encodeKey = properties.getProperty("toto.crypt.encodeKey");
decryptedString = Crypto.Decrypt(encodeKey, encryptedString.toString());
return decryptedString;
}
Run Code Online (Sandbox Code Playgroud)
在客户端作为加密字符串传递的字符串是:'7NFASg ++ qLOSfDXBR8wzcw =='
以下是服务器端的跟踪:
DEBUG encryptedString:7NFASg qLOSfDXBR8wzcw ==
| 归档时间: |
|
| 查看次数: |
903 次 |
| 最近记录: |