Index: /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/transverse/session/SessionManager.java
===================================================================
--- /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/transverse/session/SessionManager.java	(revision 7218)
+++ /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/transverse/session/SessionManager.java	(revision 7219)
@@ -3,7 +3,6 @@
 import java.io.IOException;
 import java.io.InputStream;
-
+import java.io.UnsupportedEncodingException;
 import javax.swing.JOptionPane;
-
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpException;
@@ -11,8 +10,8 @@
 import org.jdom.Document;
 import org.jdom.JDOMException;
-
 import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
 import fr.mael.jiwigo.transverse.util.Messages;
 import fr.mael.jiwigo.transverse.util.Outil;
+
 
 /**
@@ -46,185 +45,198 @@
  */
 public class SessionManager {
-    /**
-     * Logger
-     */
-    public static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory
-	    .getLog(SessionManager.class);
-    /**
-     * the entered login
-     */
-    private String login;
-    /**
-     * the entered password
-     */
-    private String motDePasse;
-    /**
-     * the url of the site
-     */
-    private String url;
-    /**
-     * the http client
-     */
-    private HttpClient client;
-
-    /**
-     * Constructor
-     * @param login the login
-     * @param motDePasse the password
-     * @param url the url of the site
-     */
-    public SessionManager(String login, String motDePasse, String url) {
-	this.login = login;
-	this.motDePasse = motDePasse;
-	this.url = url + "/ws.php";
-	client = new HttpClient();
-	//Using of a Linux user agent. cause... it's better 8)
-	client.getParams().setParameter("http.useragent",
-		"Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1");
-    }
-
-    /**
-     * Connection method
-     * @return true if successful
-     */
-    public boolean processLogin() {
-	Document doc;
-	try {
-	    doc = executerReturnDocument(MethodsEnum.LOGIN.getLabel(), "username", login, "password", motDePasse);
-	    return Outil.checkOk(doc);
-	} catch (Exception e) {
-	    LOG.error(Outil.getStackTrace(e));
-	}
-	return false;
-
-    }
-
-    /**
-     * Executes a method on the webservice and returns the result as a string
-     * @param methode the method to execute
-     * @param parametres the parameters of the method. Must be even : the name of the parameter followed by its value
-     * @return the result
-     */
-    public String executerReturnString(String methode, String... parametres) {
-	if (parametres.length % 2 != 0 && !(parametres == null)) {
-	    try {
-		throw new Exception("Le nombre de parametres doit etre pair");
-	    } catch (Exception e) {
-		LOG.error(Outil.getStackTrace(e));
+
+	/**
+	 * Logger
+	 */
+	public static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(SessionManager.class);
+	/**
+	 * the entered login
+	 */
+	private String login;
+	/**
+	 * the entered password
+	 */
+	private String motDePasse;
+	/**
+	 * the url of the site
+	 */
+	private String url;
+	/**
+	 * the http client
+	 */
+	private HttpClient client;
+
+
+	/**
+	 * Constructor
+	 * @param login the login
+	 * @param motDePasse the password
+	 * @param url the url of the site
+	 */
+	public SessionManager(String login, String motDePasse, String url) {
+		this.login = login;
+		this.motDePasse = motDePasse;
+		this.url = url + "/ws.php";
+		client = new HttpClient();
+		//Using of a Linux user agent. cause... it's better 8)
+		client.getParams().setParameter("http.useragent",
+				"Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1");
+	}
+
+
+	/**
+	 * Connection method
+	 * @return true if successful
+	 */
+	public boolean processLogin() {
+		Document doc;
+		try {
+			doc = executerReturnDocument(MethodsEnum.LOGIN.getLabel(), "username", login, "password", motDePasse);
+			return Outil.checkOk(doc);
+		} catch (Exception e) {
+			LOG.error(Outil.getStackTrace(e));
+		}
+		return false;
+
+	}
+
+
+	/**
+	 * Executes a method on the webservice and returns the result as a string
+	 * @param methode the method to execute
+	 * @param parametres the parameters of the method. Must be even : the name of the parameter followed by its value
+	 * @return the result
+	 * @throws UnsupportedEncodingException 
+	 */
+	public String executerReturnString(String methode, String... parametres) throws UnsupportedEncodingException {
+		if (parametres.length % 2 != 0 && !(parametres == null)) {
+			try {
+				throw new Exception("Le nombre de parametres doit etre pair");
+			} catch (Exception e) {
+				LOG.error(Outil.getStackTrace(e));
+				return null;
+			}
+		}
+		PostMethod method = new PostMethod(url);
+		method.addParameter("method", methode);
+		for (int i = 0; i < parametres.length; i += 2) {
+			method.addParameter(parametres[i], parametres[i + 1]);
+
+		}
+		//begin bug:0001833
+		method.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
+		//end
+
+		try {
+			client.executeMethod(method);
+			InputStream streamResponse = method.getResponseBodyAsStream();
+			//	    System.out.println(Outil.readInputStreamAsString(streamResponse));
+			//	    String toReturn = method.getResponseBodyAsString();
+			String toReturn = Outil.readInputStreamAsString(streamResponse);
+			LOG.debug(toReturn);
+			return toReturn;
+		} catch (HttpException e) {
+			// TODO Auto-generated catch block
+			LOG.error(Outil.getStackTrace(e));
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			LOG.error(Outil.getStackTrace(e));
+		} catch (IllegalArgumentException e) {
+			LOG.error(Outil.getStackTrace(e));
+			JOptionPane.showMessageDialog(null, Messages.getMessage("connexionDialog_connexionError"),
+					Messages.getMessage("error"), JOptionPane.ERROR_MESSAGE);
+		} finally {
+			method.releaseConnection();
+		}
 		return null;
-	    }
-	}
-	PostMethod method = new PostMethod(url);
-	method.addParameter("method", methode);
-	for (int i = 0; i < parametres.length; i += 2) {
-	    method.addParameter(parametres[i], parametres[i + 1]);
-	}
-	//begin bug:0001833
-	method.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
-	//end
-
-	try {
-	    client.executeMethod(method);
-	    InputStream streamResponse = method.getResponseBodyAsStream();
-	    //	    System.out.println(Outil.readInputStreamAsString(streamResponse));
-	    //	    String toReturn = method.getResponseBodyAsString();
-	    String toReturn = Outil.readInputStreamAsString(streamResponse);
-	    LOG.debug(toReturn);
-	    return toReturn;
-	} catch (HttpException e) {
-	    // TODO Auto-generated catch block
-	    LOG.error(Outil.getStackTrace(e));
-	} catch (IOException e) {
-	    // TODO Auto-generated catch block
-	    LOG.error(Outil.getStackTrace(e));
-	} catch (IllegalArgumentException e) {
-	    LOG.error(Outil.getStackTrace(e));
-	    JOptionPane.showMessageDialog(null, Messages.getMessage("connexionDialog_connexionError"), Messages
-		    .getMessage("error"), JOptionPane.ERROR_MESSAGE);
-	} finally {
-	    method.releaseConnection();
-	}
-	return null;
-
-    }
-
-    /**
-     * Executes a method on the webservice and returns the result as a Dom document
-     * @param methode the method to execute
-     * @param parametres the parameters of the method. Must be even : the name of the parameter followed by its value
-     * @return the result
-     * @throws IOException 
-     */
-    public Document executerReturnDocument(String methode, String... parametres) throws IOException {
-	try {
-	    return Outil.stringToDocument(executerReturnString(methode, parametres));
-	} catch (JDOMException e) {
-	    // TODO Auto-generated catch block
-	    LOG.error(Outil.getStackTrace(e));
-	}
-	return null;
-
-    }
-
-    /**
-     * Executes a method on the webservice and returns the result as a Dom document
-     * @param methode the method to execute
-     * @return the result
-     */
-    public Document executerReturnDocument(String methode) {
-	try {
-	    return Outil.stringToDocument(executerReturnString(methode));
-	} catch (JDOMException e) {
-	    // TODO Auto-generated catch block
-	    LOG.error(Outil.getStackTrace(e));
-	} catch (IOException e) {
-	    // TODO Auto-generated catch block
-	    LOG.error(Outil.getStackTrace(e));
-	}
-	return null;
-
-    }
-
-    /**
-     * @return the login
-     */
-    public String getLogin() {
-	return login;
-    }
-
-    /**
-     * @param login the login to set
-     */
-    public void setLogin(String login) {
-	this.login = login;
-    }
-
-    /**
-     * @return the motDePasse
-     */
-    public String getMotDePasse() {
-	return motDePasse;
-    }
-
-    /**
-     * @param motDePasse the motDePasse to set
-     */
-    public void setMotDePasse(String motDePasse) {
-	this.motDePasse = motDePasse;
-    }
-
-    /**
-     * @return the url
-     */
-    public String getUrl() {
-	return url;
-    }
-
-    /**
-     * @param url the url to set
-     */
-    public void setUrl(String url) {
-	this.url = url;
-    }
+
+	}
+
+
+	/**
+	 * Executes a method on the webservice and returns the result as a Dom document
+	 * @param methode the method to execute
+	 * @param parametres the parameters of the method. Must be even : the name of the parameter followed by its value
+	 * @return the result
+	 * @throws IOException 
+	 */
+	public Document executerReturnDocument(String methode, String... parametres) throws IOException {
+		try {
+			return Outil.stringToDocument(executerReturnString(methode, parametres));
+		} catch (JDOMException e) {
+			// TODO Auto-generated catch block
+			LOG.error(Outil.getStackTrace(e));
+		}
+		return null;
+
+	}
+
+
+	/**
+	 * Executes a method on the webservice and returns the result as a Dom document
+	 * @param methode the method to execute
+	 * @return the result
+	 */
+	public Document executerReturnDocument(String methode) {
+		try {
+			return Outil.stringToDocument(executerReturnString(methode));
+		} catch (JDOMException e) {
+			// TODO Auto-generated catch block
+			LOG.error(Outil.getStackTrace(e));
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			LOG.error(Outil.getStackTrace(e));
+		}
+		return null;
+
+	}
+
+
+	/**
+	 * @return the login
+	 */
+	public String getLogin() {
+		return login;
+	}
+
+
+	/**
+	 * @param login the login to set
+	 */
+	public void setLogin(String login) {
+		this.login = login;
+	}
+
+
+	/**
+	 * @return the motDePasse
+	 */
+	public String getMotDePasse() {
+		return motDePasse;
+	}
+
+
+	/**
+	 * @param motDePasse the motDePasse to set
+	 */
+	public void setMotDePasse(String motDePasse) {
+		this.motDePasse = motDePasse;
+	}
+
+
+	/**
+	 * @return the url
+	 */
+	public String getUrl() {
+		return url;
+	}
+
+
+	/**
+	 * @param url the url to set
+	 */
+	public void setUrl(String url) {
+		this.url = url;
+	}
 
 }
