Index: extensions/jiwigo-ws-api/pom.xml
===================================================================
--- extensions/jiwigo-ws-api/pom.xml	(revision 9394)
+++ extensions/jiwigo-ws-api/pom.xml	(revision 9430)
@@ -3,5 +3,5 @@
   <groupId>fr.mael.jiwigo</groupId>
   <artifactId>jiwigo-ws-api</artifactId>
-  <version>0.13.1</version>
+  <version>0.13.1.1</version>
 
 
Index: extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/CategoryDao.java
===================================================================
--- extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/CategoryDao.java	(revision 9394)
+++ extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/CategoryDao.java	(revision 9430)
@@ -11,4 +11,5 @@
 import fr.mael.jiwigo.transverse.enumeration.CategoryEnum;
 import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
+import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
 import fr.mael.jiwigo.transverse.session.SessionManager;
 import fr.mael.jiwigo.transverse.util.Tools;
@@ -81,6 +82,7 @@
      * @return the list of categories
      * @throws IOException
+     * @throws ProxyAuthenticationException
      */
-    public List<Category> list(boolean recursive) throws IOException {
+    public List<Category> list(boolean recursive) throws IOException, ProxyAuthenticationException {
 	Document doc = sessionManager.executeReturnDocument(MethodsEnum.LISTER_CATEGORIES.getLabel(), "recursive",
 		String.valueOf(recursive));
@@ -112,6 +114,7 @@
      * @param category the category to create
      * @return true if the category is successfully created
+     * @throws ProxyAuthenticationException
      */
-    public boolean create(Category category) {
+    public boolean create(Category category) throws ProxyAuthenticationException {
 	try {
 	    if (category.getDirectParent() != null) {
Index: extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/CommentDao.java
===================================================================
--- extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/CommentDao.java	(revision 9394)
+++ extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/CommentDao.java	(revision 9430)
@@ -10,4 +10,5 @@
 import fr.mael.jiwigo.om.Comment;
 import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
+import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
 import fr.mael.jiwigo.transverse.session.SessionManager;
 import fr.mael.jiwigo.transverse.util.Tools;
@@ -80,8 +81,9 @@
      * @return list of comments
      * @throws IOException
+     * @throws ProxyAuthenticationException
      */
-    public List<Comment> list(Integer idImage) throws IOException {
+    public List<Comment> list(Integer idImage) throws IOException, ProxyAuthenticationException {
 	Document doc = (sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
-		.valueOf(idImage)));
+		.valueOf(idImage), "comments_per_page", "100"));
 	Element element = doc.getRootElement().getChild("image").getChild("comments");
 	List<Element> listElement = (List<Element>) element.getChildren("comment");
@@ -103,6 +105,7 @@
      * @return the key
      * @throws IOException
+     * @throws ProxyAuthenticationException
      */
-    public String getKey(Integer idImage) throws IOException {
+    public String getKey(Integer idImage) throws IOException, ProxyAuthenticationException {
 	Document doc = (sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
 		.valueOf(idImage)));
@@ -116,6 +119,7 @@
      * @return true if the comment is successfully added
      * @throws IOException
+     * @throws ProxyAuthenticationException
      */
-    public boolean create(Comment commentaire) throws IOException {
+    public boolean create(Comment commentaire) throws IOException, ProxyAuthenticationException {
 	String key = getKey(commentaire.getImageId());
 	try {
Index: extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/ImageDao.java
===================================================================
--- extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/ImageDao.java	(revision 9394)
+++ extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/ImageDao.java	(revision 9430)
@@ -13,4 +13,5 @@
 import fr.mael.jiwigo.om.Image;
 import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
+import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
 import fr.mael.jiwigo.transverse.exception.WrongChunkSizeException;
 import fr.mael.jiwigo.transverse.session.SessionManager;
@@ -98,6 +99,7 @@
      * @return the list of images
      * @throws IOException
-     */
-    public List<Image> list(boolean refresh) throws IOException {
+     * @throws ProxyAuthenticationException
+     */
+    public List<Image> list(boolean refresh) throws IOException, ProxyAuthenticationException {
 	return listByCategory(null, refresh);
     }
@@ -108,6 +110,8 @@
      * @return the list of images
      * @throws IOException
-     */
-    public List<Image> listByCategory(Integer categoryId, boolean refresh) throws IOException {
+     * @throws ProxyAuthenticationException
+     */
+    public List<Image> listByCategory(Integer categoryId, boolean refresh) throws IOException,
+	    ProxyAuthenticationException {
 	if (refresh || cache.get(categoryId) == null) {
 	    Document doc = null;
@@ -207,6 +211,7 @@
      * @param tagId ids of the tags
      * @throws IOException
-     */
-    public boolean addTags(Integer imageId, String tagId) throws IOException {
+     * @throws ProxyAuthenticationException
+     */
+    public boolean addTags(Integer imageId, String tagId) throws IOException, ProxyAuthenticationException {
 	Document doc = sessionManager.executeReturnDocument(MethodsEnum.SET_INFO.getLabel(), "image_id", String
 		.valueOf(imageId), "tag_ids", tagId);
@@ -248,6 +253,7 @@
      * @return the list of images matching the string
      * @throws IOException
-     */
-    public List<Image> search(String searchString) throws IOException {
+     * @throws ProxyAuthenticationException
+     */
+    public List<Image> search(String searchString) throws IOException, ProxyAuthenticationException {
 	Document doc = sessionManager.executeReturnDocument(MethodsEnum.SEARCH.getLabel(), "query", searchString);
 	LOG.debug(doc);
Index: extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/TagDao.java
===================================================================
--- extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/TagDao.java	(revision 9394)
+++ extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/TagDao.java	(revision 9430)
@@ -12,4 +12,5 @@
 import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
 import fr.mael.jiwigo.transverse.enumeration.TagEnum;
+import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
 import fr.mael.jiwigo.transverse.session.SessionManager;
 import fr.mael.jiwigo.transverse.util.Tools;
@@ -53,6 +54,7 @@
      * @return the list of tags
      * @throws IOException
+     * @throws ProxyAuthenticationException
      */
-    public List<Tag> list() throws IOException {
+    public List<Tag> list() throws IOException, ProxyAuthenticationException {
 	Document doc = sessionManager.executeReturnDocument(MethodsEnum.TAGS_ADMIN_LIST.getLabel());
 	//	System.out.println(Outil.documentToString(doc));
@@ -84,6 +86,7 @@
      * @param tag the tag to create
      * @return true if the tag as been successfully created
+     * @throws ProxyAuthenticationException
      */
-    public boolean create(Tag tag) {
+    public boolean create(Tag tag) throws ProxyAuthenticationException {
 	try {
 	    return Tools.checkOk(sessionManager.executeReturnDocument(MethodsEnum.ADD_TAG.getLabel(), "name", tag
@@ -100,6 +103,7 @@
      * @return the tags list
      * @throws IOException
+     * @throws ProxyAuthenticationException
      */
-    public List<Tag> tagsForImage(Image image) throws IOException {
+    public List<Tag> tagsForImage(Image image) throws IOException, ProxyAuthenticationException {
 	Document doc = sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
 		.valueOf(image.getIdentifier()));
Index: extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/CategoryService.java
===================================================================
--- extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/CategoryService.java	(revision 9394)
+++ extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/CategoryService.java	(revision 9430)
@@ -6,4 +6,5 @@
 import fr.mael.jiwigo.dao.CategoryDao;
 import fr.mael.jiwigo.om.Category;
+import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
 import fr.mael.jiwigo.transverse.session.SessionManager;
 
@@ -76,6 +77,7 @@
      * @return the list of categories
      * @throws IOException
+     * @throws ProxyAuthenticationException
      */
-    public List<Category> list(boolean recursive) throws IOException {
+    public List<Category> list(boolean recursive) throws IOException, ProxyAuthenticationException {
 	return CategoryDao.getInstance(sessionManager).list(recursive);
     }
@@ -85,6 +87,7 @@
      * @return list of categories
      * @throws IOException
+     * @throws ProxyAuthenticationException
      */
-    public List<Category> makeTree() throws IOException {
+    public List<Category> makeTree() throws IOException, ProxyAuthenticationException {
 	List<Category> list = CategoryDao.getInstance(sessionManager).list(true);
 	for (Category category : list) {
@@ -109,6 +112,7 @@
      * @param parent parent category
      * @return true if successful
+     * @throws ProxyAuthenticationException
      */
-    public boolean create(String nom, Integer parent) {
+    public boolean create(String nom, Integer parent) throws ProxyAuthenticationException {
 	Category category = new Category();
 	category.setDirectParent(parent);
@@ -121,6 +125,7 @@
      * @param nom name of the category
      * @return true if successful
+     * @throws ProxyAuthenticationException
      */
-    public boolean create(String nom) {
+    public boolean create(String nom) throws ProxyAuthenticationException {
 	Category category = new Category();
 	category.setName(nom);
Index: extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/CommentService.java
===================================================================
--- extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/CommentService.java	(revision 9394)
+++ extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/CommentService.java	(revision 9430)
@@ -6,4 +6,5 @@
 import fr.mael.jiwigo.dao.CommentDao;
 import fr.mael.jiwigo.om.Comment;
+import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
 import fr.mael.jiwigo.transverse.session.SessionManager;
 
@@ -75,6 +76,7 @@
      * @return the list of comments
      * @throws IOException
+     * @throws ProxyAuthenticationException
      */
-    public List<Comment> list(Integer imageId) throws IOException {
+    public List<Comment> list(Integer imageId) throws IOException, ProxyAuthenticationException {
 	return CommentDao.getInstance(sessionManager).list(imageId);
     }
@@ -87,6 +89,8 @@
      * @return true if successful
      * @throws IOException
+     * @throws ProxyAuthenticationException
      */
-    public boolean create(String content, Integer imageId, String auteur) throws IOException {
+    public boolean create(String content, Integer imageId, String auteur) throws IOException,
+	    ProxyAuthenticationException {
 	Comment comment = new Comment();
 	comment.setContent(content);
Index: extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/ImageService.java
===================================================================
--- extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/ImageService.java	(revision 9394)
+++ extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/ImageService.java	(revision 9430)
@@ -7,4 +7,5 @@
 import fr.mael.jiwigo.dao.ImageDao;
 import fr.mael.jiwigo.om.Image;
+import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
 import fr.mael.jiwigo.transverse.session.SessionManager;
 import fr.mael.jiwigo.transverse.util.ImagesUtil;
@@ -80,6 +81,8 @@
      * @return the list of images
      * @throws IOException
+     * @throws ProxyAuthenticationException
      */
-    public List<Image> listByCategory(Integer categoryId, boolean rafraichir) throws IOException {
+    public List<Image> listByCategory(Integer categoryId, boolean rafraichir) throws IOException,
+	    ProxyAuthenticationException {
 	return ImageDao.getInstance(sessionManager).listByCategory(categoryId, rafraichir);
     }
@@ -139,6 +142,7 @@
      * @return true if successful
      * @throws IOException
+     * @throws ProxyAuthenticationException
      */
-    public boolean addTags(Image image, String tagId) throws IOException {
+    public boolean addTags(Image image, String tagId) throws IOException, ProxyAuthenticationException {
 	return ImageDao.getInstance(sessionManager).addTags(image.getIdentifier(), tagId);
     }
@@ -149,6 +153,7 @@
      * @return images matching the string
      * @throws IOException
+     * @throws ProxyAuthenticationException
      */
-    public List<Image> search(String queryString) throws IOException {
+    public List<Image> search(String queryString) throws IOException, ProxyAuthenticationException {
 	return ImageDao.getInstance(sessionManager).search(queryString);
     }
Index: extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/TagService.java
===================================================================
--- extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/TagService.java	(revision 9394)
+++ extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/TagService.java	(revision 9430)
@@ -7,4 +7,5 @@
 import fr.mael.jiwigo.om.Image;
 import fr.mael.jiwigo.om.Tag;
+import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
 import fr.mael.jiwigo.transverse.session.SessionManager;
 
@@ -76,6 +77,7 @@
      * @return le list of tags
      * @throws IOException
+     * @throws ProxyAuthenticationException
      */
-    public List<Tag> list() throws IOException {
+    public List<Tag> list() throws IOException, ProxyAuthenticationException {
 	return TagDao.getInstance(sessionManager).list();
     }
@@ -86,6 +88,7 @@
      * @return true if the tag is created
      * @throws IOException
+     * @throws ProxyAuthenticationException
      */
-    public boolean create(String nom) throws IOException {
+    public boolean create(String nom) throws IOException, ProxyAuthenticationException {
 	Tag tag = new Tag();
 	tag.setName(nom);
@@ -98,6 +101,7 @@
      * @return the list of tags
      * @throws IOException
+     * @throws ProxyAuthenticationException
      */
-    public List<Tag> tagsForImage(Image image) throws IOException {
+    public List<Tag> tagsForImage(Image image) throws IOException, ProxyAuthenticationException {
 	return TagDao.getInstance(sessionManager).tagsForImage(image);
     }
Index: extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/exception/ProxyAuthenticationException.java
===================================================================
--- extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/exception/ProxyAuthenticationException.java	(revision 9430)
+++ extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/exception/ProxyAuthenticationException.java	(revision 9430)
@@ -0,0 +1,8 @@
+package fr.mael.jiwigo.transverse.exception;
+
+public class ProxyAuthenticationException extends Exception {
+    public ProxyAuthenticationException(String msg) {
+	super(msg);
+    }
+
+}
Index: extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/session/SessionManager.java
===================================================================
--- extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/session/SessionManager.java	(revision 9394)
+++ extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/session/SessionManager.java	(revision 9430)
@@ -8,5 +8,4 @@
 import org.apache.commons.httpclient.HostConfiguration;
 import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
 import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
 import org.apache.commons.httpclient.UsernamePasswordCredentials;
@@ -18,4 +17,5 @@
 
 import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
+import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
 import fr.mael.jiwigo.transverse.util.Tools;
 
@@ -125,7 +125,10 @@
     /**
      * Connection method
-     * @return true if successful
-     */
-    public boolean processLogin() {
+     *
+     * @return 0 if Ok, 1 if not Ok (reason not specified), 2 if proxy error
+     *
+     *
+     */
+    public int processLogin() {
 	Document doc;
 	//configures the proxy
@@ -139,11 +142,19 @@
 	    }
 	}
+	//	try {
 	try {
 	    doc = executeReturnDocument(MethodsEnum.LOGIN.getLabel(), "username", login, "password", password);
-	    return Tools.checkOk(doc);
+	    return (Tools.checkOk(doc) ? 0 : 1);
+	} catch (IOException e) {
+	    LOG.debug(Tools.getStackTrace(e));
+	    return 1;
+	} catch (ProxyAuthenticationException e) {
+	    LOG.debug(Tools.getStackTrace(e));
+	    return 2;
 	} catch (Exception e) {
-	    LOG.error(Tools.getStackTrace(e));
-	}
-	return false;
+	    LOG.debug(Tools.getStackTrace(e));
+	    return 1;
+	}
+
     }
 
@@ -154,6 +165,8 @@
      * @return the result
      * @throws UnsupportedEncodingException
-     */
-    public String executeReturnString(String methode, String... parametres) throws UnsupportedEncodingException {
+     * @throws ProxyAuthenticationException
+     */
+    public String executeReturnString(String methode, String... parametres) throws UnsupportedEncodingException,
+	    ProxyAuthenticationException {
 	if (parametres.length % 2 != 0 && !(parametres == null)) {
 	    try {
@@ -174,7 +187,9 @@
 	method.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
 	//end
-
 	try {
-	    client.executeMethod(method);
+	    int test = client.executeMethod(method);
+	    if (test == 407) {
+		throw new ProxyAuthenticationException("Proxy configuration exception. Check username and password");
+	    }
 	    InputStream streamResponse = method.getResponseBodyAsStream();
 	    //	    System.out.println(Outil.readInputStreamAsString(streamResponse));
@@ -183,14 +198,6 @@
 	    LOG.debug(toReturn);
 	    return toReturn;
-	} catch (HttpException e) {
-	    // TODO Auto-generated catch block
-	    LOG.error(Tools.getStackTrace(e));
 	} catch (IOException e) {
-	    // TODO Auto-generated catch block
-	    LOG.error(Tools.getStackTrace(e));
-	} catch (IllegalArgumentException e) {
-	    LOG.error(Tools.getStackTrace(e));
-	} finally {
-	    method.releaseConnection();
+
 	}
 	return null;
@@ -204,8 +211,11 @@
      * @return the result
      * @throws IOException
-     */
-    public Document executeReturnDocument(String methode, String... parametres) throws IOException {
+     * @throws ProxyAuthenticationException
+     */
+    public Document executeReturnDocument(String methode, String... parametres) throws IOException,
+	    ProxyAuthenticationException {
 	try {
-	    return Tools.stringToDocument(executeReturnString(methode, parametres));
+	    String returnedString = executeReturnString(methode, parametres);
+	    return Tools.stringToDocument(returnedString);
 	} catch (JDOMException e) {
 	    // TODO Auto-generated catch block
@@ -220,6 +230,7 @@
      * @param methode the method to execute
      * @return the result
-     */
-    public Document executeReturnDocument(String methode) {
+     * @throws ProxyAuthenticationException
+     */
+    public Document executeReturnDocument(String methode) throws ProxyAuthenticationException {
 	try {
 	    return Tools.stringToDocument(executeReturnString(methode));
