| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 
 |  
      if (command == Cmdlogin)
      {
        Thread    th = new  Thread()
        {
          public	 void	run()
         {
            String   url  =  "http://"+textField12.getString()+":8080/Login/new-serveur";
            HttpConnection conn = null;
            DataInputStream dis = null;
            DataOutputStream dos = null;
            boolean	trouv = false;
            try
            {
               conn = (HttpConnection)Connector.open(url);
               conn.setRequestProperty("HTTP-Version", "HTTP/1.1");
               conn.setRequestProperty("Connection", "Keep-Alive");
               conn.setRequestMethod(HttpConnection.POST);
            }
            catch (Exception e)
            {
               System.out.println("Erreur de connexion");
            }
            //Envoyer la requête
            try
            {
              dos = new DataOutputStream(conn.openOutputStream());
              dos.writeUTF(UserTF.getString());
              dos.writeUTF(PassTF.getString());
              dos.flush();
              dis = new DataInputStream(conn.openInputStream());
              trouv = dis.readBoolean();
              if (trouv)
              {
                dos.writeUTF(UserTF.getString()); // à cet endroit je reçoie l'exception "Write attempted after request finished"
                dos.writeUTF(PassTF.getString());
                dos.flush();
                DisplayVar.setCurrent(ChoixConnexion);
              }
              else
              {
                Alert  alert = new Alert("Erreur","User name ou password incorrects",null,AlertType.ERROR);
                alert.setTimeout(Alert.FOREVER);
                DisplayVar.setCurrent(alert, LoginScr);
              }
            }
            catch (Exception e)
            {
               Alert  alert = new Alert("Erreur","Une erreur s'est produite lors de la connexion",null,AlertType.ERROR);
               alert.setTimeout(Alert.FOREVER);
               DisplayVar.setCurrent(alert, LoginScr);
            }
            finally
            {
              ... | 
Partager