简体   繁体   中英

API parameter google App Engine(java)

I am developing google endpoints API's but I got unexpected output from following code. 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?

@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. Use the URLDecoder class to decode the email 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);   
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM