Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package WebRequest;
- import org.json.JSONObject;
- public class WebLoginClass {
- private WebRequest richiesta_web;
- private String username;
- private String password;
- private static String URL_Login = "localhost:8080/MyLibreria/LoginAndroid";
- public WebLoginClass(){
- richiesta_web = new WebRequest();
- }
- public void setUsername(String username) { //
- this.username = username;
- }
- public void setPassword(String password) {
- this.password = password;
- }
- public int effettuaLogin() throws Exception{
- if(password == null || username == null)
- throw new Exception();
- richiesta_web.aggiungiParametro("username", username);
- richiesta_web.aggiungiParametro("password" , password);
- richiesta_web.setURL(URL_Login);
- richiesta_web.inviaRichiesta();
- String result = richiesta_web.getRisultatoRichiesta();
- richiesta_web.svuotaParametri();
- JSONObject my_object = new JSONObject(result);
- return my_object.getInt("msg");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement