This commit is contained in:
Lorenzo Iovino 2017-07-14 00:06:59 +02:00
parent 71ff3c4820
commit e1622dfaa1
17 changed files with 463 additions and 561 deletions

View file

@ -18,6 +18,11 @@ public class HomeController {
public Response login(String userName, String password) throws RemoteException, NotBoundException, MalformedURLException {
Response res = authService.login(userName,password);
if (res.code == 200){
try {
App.registerForNotifications();
} catch (RemoteException e) {
App.logger.write("AUTH SERVICE: Can't register for notification");
}
App.session = (new Session(new User(userName,password,0), res.data.get("token").toString()));
}
return res;

View file

@ -20,11 +20,6 @@ public class AuthService {
private String baseUrl = Config.getAuthServerURI().concat("/auth");
public Response login(String userName, String password) throws RemoteException, NotBoundException, MalformedURLException {
try {
App.registerForNotifications();
} catch (RemoteException e) {
App.logger.write("AUTH SERVICE: Can't register for notification");
}
IAuth auth = (IAuth) Naming.lookup(baseUrl);
return auth.login(userName, password);
}

View file

@ -36,7 +36,6 @@ public class SendWords extends SwingWorker<Void,Void> {
buffer.flip();
App.clientUDP.send(buffer, App.clientUDPSocketAddress);
System.out.println("SENDED" + sentence);
} catch (UnknownHostException e) {
App.logger.write("SEND WORDS: Host address not correct");
} catch (IOException e) {

View file

@ -35,8 +35,6 @@ public class WaitForPlayers extends SwingWorker<Void,Void> {
while (App.clientTCP.read(buffer) != -1) {
String line = new String(buffer.array(), buffer.position(), buffer.remaining());
buffer.clear();
System.out.println("ASPETTO GAM_STARTED");
System.out.println(line);
if (line.startsWith("MESSAGE")) {
buffer.clear();