Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.HttpException


               try {
                  Date d = GETLASTMODIFIED_FORMAT.parse(p.getPropertyAsString());
                  return d.getTime();
               }
               catch (ParseException e) {
                  throw new HttpException("Invalid lastmodified property: " +
                        p.getPropertyAsString());
               }
            }
            throw new HttpException("PROPFIND does not return lastmodified.");
         default:
            HttpException ex = new HttpException();
            ex.setReasonCode(status);
            ex.setReason(propFind.getStatusText());
            throw ex;
      }
   }
View Full Code Here


         MkcolMethod mkcol = new MkcolMethod(newColl.getURI());
         mkcol.setFollowRedirects(true);
         generateIfHeader(mkcol, lockToken);
         int status = client.executeMethod(mkcol);
         if (status != WebdavStatus.SC_CREATED) {
            HttpException ex = new HttpException("Can't create collection " +
                                                 newColl);
            ex.setReasonCode(status);
            ex.setReason(mkcol.getStatusText());
            throw ex;
         }
      }
      return created;
   }
View Full Code Here

         case WebdavStatus.SC_OK:
         case WebdavStatus.SC_CREATED:
         case WebdavStatus.SC_NO_CONTENT:
            return;
         default:
            HttpException ex = new HttpException();
            ex.setReason(put.getStatusText());
            ex.setReasonCode(status);
            throw ex;
      }
   }
View Full Code Here

     
      switch (status) {
         case WebdavStatus.SC_OK:
            return get.getResponseBodyAsStream();
         default:
            HttpException ex = new HttpException();
            ex.setReason(get.getStatusText());
            ex.setReasonCode(status);
            throw ex;
      }
     
   }
View Full Code Here

         case WebdavStatus.SC_OK:
         case WebdavStatus.SC_NO_CONTENT:
            return;
        
         default:
            HttpException ex = new HttpException();
            ex.setReasonCode(status);
            ex.setReason(unlock.getStatusText());
            throw ex;
      }
   }
View Full Code Here

         case WebdavStatus.SC_CREATED:
         case WebdavStatus.SC_NO_CONTENT:
             return;
        
         default:
             HttpException ex = new HttpException();
             ex.setReasonCode(status);
             ex.setReason(copy.getStatusText());
             throw ex;
      }
   }
View Full Code Here

         case WebdavStatus.SC_CREATED:
         case WebdavStatus.SC_NO_CONTENT:
             return;

         default:
             HttpException ex = new HttpException();
             ex.setReasonCode(status);
             ex.setReason(move.getStatusText());
             throw ex;
   }
}
View Full Code Here

   }
}

   public static BuildException makeBuildException(String msg, Exception e) {
      if (e instanceof HttpException) {
         HttpException he = (HttpException)e;
         return new BuildException(
               msg + " " + e.getMessage() + " (" +
               (he.getReason() != null
                     ? he.getReason()
                     : HttpStatus.getStatusText(he.getReasonCode())) +
               ")");
        
      } else {
         return new BuildException(msg + " (" + e.toString() + ")", e);
      }
View Full Code Here

            setStatusCode(status);
        }
        // Also accept OK sent by buggy servers.
        if (status != HttpStatus.SC_MULTI_STATUS
            && status != HttpStatus.SC_OK) {
            HttpException ex = new HttpException();
            ex.setReasonCode(status);
            throw ex;
        }
        thisResource = false;

        return method.getResponses();
View Full Code Here

            setStatusCode(method.getStatusLine().getStatusCode());
        }
        // Also accept OK sent by buggy servers.
        if (status != HttpStatus.SC_MULTI_STATUS
            && status != HttpStatus.SC_OK) {
            HttpException ex = new HttpException();
            ex.setReasonCode(status);
            throw ex;
        }
        thisResource = false;

        return method.getResponses();
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.HttpException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.