Ignore:
Timestamp:
Feb 28, 2011, 7:40:53 PM (13 years ago)
Author:
mlg
Message:

Modifications to handle proxy error.
Two types of error are handled : proxy address error and proxy authentication error.
Connecting to jiwigo via a proxy seems to work (tried with my own server... gonna have to try with an external server).
version is 0.13.1.1

Location:
extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/CategoryDao.java

    r9392 r9430  
    1111import fr.mael.jiwigo.transverse.enumeration.CategoryEnum;
    1212import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
     13import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    1314import fr.mael.jiwigo.transverse.session.SessionManager;
    1415import fr.mael.jiwigo.transverse.util.Tools;
     
    8182     * @return the list of categories
    8283     * @throws IOException
     84     * @throws ProxyAuthenticationException
    8385     */
    84     public List<Category> list(boolean recursive) throws IOException {
     86    public List<Category> list(boolean recursive) throws IOException, ProxyAuthenticationException {
    8587        Document doc = sessionManager.executeReturnDocument(MethodsEnum.LISTER_CATEGORIES.getLabel(), "recursive",
    8688                String.valueOf(recursive));
     
    112114     * @param category the category to create
    113115     * @return true if the category is successfully created
     116     * @throws ProxyAuthenticationException
    114117     */
    115     public boolean create(Category category) {
     118    public boolean create(Category category) throws ProxyAuthenticationException {
    116119        try {
    117120            if (category.getDirectParent() != null) {
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/CommentDao.java

    r9392 r9430  
    1010import fr.mael.jiwigo.om.Comment;
    1111import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
     12import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    1213import fr.mael.jiwigo.transverse.session.SessionManager;
    1314import fr.mael.jiwigo.transverse.util.Tools;
     
    8081     * @return list of comments
    8182     * @throws IOException
     83     * @throws ProxyAuthenticationException
    8284     */
    83     public List<Comment> list(Integer idImage) throws IOException {
     85    public List<Comment> list(Integer idImage) throws IOException, ProxyAuthenticationException {
    8486        Document doc = (sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
    85                 .valueOf(idImage)));
     87                .valueOf(idImage), "comments_per_page", "100"));
    8688        Element element = doc.getRootElement().getChild("image").getChild("comments");
    8789        List<Element> listElement = (List<Element>) element.getChildren("comment");
     
    103105     * @return the key
    104106     * @throws IOException
     107     * @throws ProxyAuthenticationException
    105108     */
    106     public String getKey(Integer idImage) throws IOException {
     109    public String getKey(Integer idImage) throws IOException, ProxyAuthenticationException {
    107110        Document doc = (sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
    108111                .valueOf(idImage)));
     
    116119     * @return true if the comment is successfully added
    117120     * @throws IOException
     121     * @throws ProxyAuthenticationException
    118122     */
    119     public boolean create(Comment commentaire) throws IOException {
     123    public boolean create(Comment commentaire) throws IOException, ProxyAuthenticationException {
    120124        String key = getKey(commentaire.getImageId());
    121125        try {
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/ImageDao.java

    r9394 r9430  
    1313import fr.mael.jiwigo.om.Image;
    1414import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
     15import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    1516import fr.mael.jiwigo.transverse.exception.WrongChunkSizeException;
    1617import fr.mael.jiwigo.transverse.session.SessionManager;
     
    9899     * @return the list of images
    99100     * @throws IOException
    100      */
    101     public List<Image> list(boolean refresh) throws IOException {
     101     * @throws ProxyAuthenticationException
     102     */
     103    public List<Image> list(boolean refresh) throws IOException, ProxyAuthenticationException {
    102104        return listByCategory(null, refresh);
    103105    }
     
    108110     * @return the list of images
    109111     * @throws IOException
    110      */
    111     public List<Image> listByCategory(Integer categoryId, boolean refresh) throws IOException {
     112     * @throws ProxyAuthenticationException
     113     */
     114    public List<Image> listByCategory(Integer categoryId, boolean refresh) throws IOException,
     115            ProxyAuthenticationException {
    112116        if (refresh || cache.get(categoryId) == null) {
    113117            Document doc = null;
     
    207211     * @param tagId ids of the tags
    208212     * @throws IOException
    209      */
    210     public boolean addTags(Integer imageId, String tagId) throws IOException {
     213     * @throws ProxyAuthenticationException
     214     */
     215    public boolean addTags(Integer imageId, String tagId) throws IOException, ProxyAuthenticationException {
    211216        Document doc = sessionManager.executeReturnDocument(MethodsEnum.SET_INFO.getLabel(), "image_id", String
    212217                .valueOf(imageId), "tag_ids", tagId);
     
    248253     * @return the list of images matching the string
    249254     * @throws IOException
    250      */
    251     public List<Image> search(String searchString) throws IOException {
     255     * @throws ProxyAuthenticationException
     256     */
     257    public List<Image> search(String searchString) throws IOException, ProxyAuthenticationException {
    252258        Document doc = sessionManager.executeReturnDocument(MethodsEnum.SEARCH.getLabel(), "query", searchString);
    253259        LOG.debug(doc);
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/TagDao.java

    r9392 r9430  
    1212import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
    1313import fr.mael.jiwigo.transverse.enumeration.TagEnum;
     14import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    1415import fr.mael.jiwigo.transverse.session.SessionManager;
    1516import fr.mael.jiwigo.transverse.util.Tools;
     
    5354     * @return the list of tags
    5455     * @throws IOException
     56     * @throws ProxyAuthenticationException
    5557     */
    56     public List<Tag> list() throws IOException {
     58    public List<Tag> list() throws IOException, ProxyAuthenticationException {
    5759        Document doc = sessionManager.executeReturnDocument(MethodsEnum.TAGS_ADMIN_LIST.getLabel());
    5860        //      System.out.println(Outil.documentToString(doc));
     
    8486     * @param tag the tag to create
    8587     * @return true if the tag as been successfully created
     88     * @throws ProxyAuthenticationException
    8689     */
    87     public boolean create(Tag tag) {
     90    public boolean create(Tag tag) throws ProxyAuthenticationException {
    8891        try {
    8992            return Tools.checkOk(sessionManager.executeReturnDocument(MethodsEnum.ADD_TAG.getLabel(), "name", tag
     
    100103     * @return the tags list
    101104     * @throws IOException
     105     * @throws ProxyAuthenticationException
    102106     */
    103     public List<Tag> tagsForImage(Image image) throws IOException {
     107    public List<Tag> tagsForImage(Image image) throws IOException, ProxyAuthenticationException {
    104108        Document doc = sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
    105109                .valueOf(image.getIdentifier()));
Note: See TracChangeset for help on using the changeset viewer.