[英]API parameter google App Engine(java)
I am developing google endpoints API's but I got unexpected output from following code. 我正在开发Google端点API,但是从以下代码中得到了意外的输出。 when I insert email myemail@hostname.com then endpoint API convert this email to myemail%40hostname.com so could you please tell me how can I solve this issue?
当我插入电子邮件myemail@hostname.com时,端点API将此电子邮件转换为myemail%40hostname.com,所以请您告诉我如何解决此问题?
@ApiMethod(name="login")
public User userLogin(@Named("email")final String email,@Named("password")final String pwd)
{
return userLoginResponse(email, pwd);
}
Special characters like "@" are encoded using UTF-8. 特殊字符(例如“ @”)使用UTF-8进行编码。 Use the
URLDecoder
class to decode the email id. 使用
URLDecoder
类解码电子邮件ID。
import java.net.URLDecoder;
...
@ApiMethod(name="login")
public User userLogin(@Named("email")final String email,@Named("password")final String pwd)
{
try {
decodedEmail = URLDecoder.decode(email,"UTF-8");
}
catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return userLoginResponse(decodedEmail, pwd);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.