/Users/detro/workspace-nb/JAEBI-BlueToothJ2MEClient/src/LoginRequestProcessor.java

Vai alla documentazione di questo file.
00001 import org.jaebi.midlet.bt.btException.BtIOException;
00002 import org.jaebi.midlet.bt.requestProcessing.XRequestProcessor;
00003 import org.jaebi.midlet.bt.requestProcessing.RequestProcessor;
00004 import org.jaebi.midlet.bt.responseHandling.AccountingResponseHandler;
00005 /*
00006  * LoginRequestProcessor.java
00007  *
00008  * Created on 21 giugno 2005, 13.52
00009  *
00010  * To change this template, choose Tools | Options and locate the template under
00011  * the Source Creation and Management node. Right-click the template and choose
00012  * Open. You can then make changes to the template in the Source Editor.
00013  */
00014 
00025 public class LoginRequestProcessor extends RequestProcessor{
00026     
00027     private String nickName;
00028     private static final String USERTYPE = "Midlet";
00029     
00031     public LoginRequestProcessor() {
00032     }
00033     
00034     
00035     public void setNickName(String nickName){
00036         this.nickName = nickName.trim();
00037     }
00038     
00039     
00040     public void run(){
00041         String response = "";
00042         String requestBeginMarker = "[login]";
00043         String requestEndMarker = "[/login]";
00044         String responseBeginMarker = "[login_response]";
00045         String responseEndMarker = "[/login_response]";
00046         
00047         try{
00048             this.sendRequest(requestBeginMarker + this.nickName + " " + USERTYPE + requestEndMarker);
00049             response= this.getResponseContent(responseBeginMarker, responseEndMarker);
00050         }
00051         catch(BtIOException e){
00052             
00053             /*
00054              * si è verificato un errore durante la comunicazione. Lo notifico
00055              * attraverso l'handler
00056              */
00057             this.handler.connectionError();
00058             return;
00059         }
00060         
00061         
00062        
00063         if (response.equals("ok"))
00064             ((AccountingResponseHandler)handler).loginCorrect("Autenticazione effettuata con successo");
00065         else
00066             ((AccountingResponseHandler)handler).loginIncorrect("Autenticazione non riuscita causa errore interno o username errato");
00067         
00068     }
00069     
00070 }

Generato il Thu Jun 23 00:02:59 2005 per JAEBI - BlueTooth J2ME Midlet Client da  doxygen 1.4.3