Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.HttpException


       
        GetMethod homePageMethod = new GetMethod(url);
        int status = client.executeMethod(homePageMethod);
       
        if (homePageMethod.getStatusCode() != 200) {
            throw new HttpException("HTTP Status Code is " + homePageMethod.getStatusCode());
        }
       
        SAXReader reader = new SAXReader();
        return reader.read(homePageMethod.getResponseBodyAsStream());
       
View Full Code Here


       
        GetMethod homePageMethod = new GetMethod(url);
        int status = client.executeMethod(homePageMethod);
       
        if (homePageMethod.getStatusCode() != 200) {
            throw new HttpException("HTTP Status Code is " + homePageMethod.getStatusCode());
        }
       
        DOMParser parser = new DOMParser();
        parser.setFeature("http://xml.org/sax/features/namespaces", false);
       
View Full Code Here

            servicePrincipal = "HTTP/" + uri.getHost();
        }
        try {
            credentials.createGSSContext(servicePrincipal);
        } catch (PrivilegedActionException e) {
            throw new HttpException("PrivilegedActionException", e);
        } catch (GSSException e) {
            throw new HttpException("GSSException", e);
        }
        GSSContext gssContext = credentials.getGSSContext();
        try {
            // hack because HttpClient preemtive auth is broken wrt spnego as at 3.0.1
            if (getParams().isAuthenticationPreemptive()) {
View Full Code Here

    int statusCode = client.executeMethod(method);
     
    if (statusCode != HttpStatus.SC_OK)  {
      log.error("HTTP post response statusCode: " +statusCode + ", statusLine: " + method.getStatusLine());
      //do something aggressive here
      throw new HttpException("got back a failure from server");
    }
    //implicitly "else"
    log.info("got success back from the remote collector; response length "+ method.getResponseContentLength());

      //FIXME: should parse acks here
View Full Code Here

  }

  SPFile root = directoryService.getRoot();

        if (homeUrlPath.indexOf(root.getResourceUrlPath()) != 0)  {
            throw (new HttpException("Bad URL Path: "+homeUrlPath
              +" NOT Under Root URL Path"));
        }

  /* Pending: Currently a file path is equivalent to its url path */
  String homeFilePath = homeUrlPath.substring(
View Full Code Here

  public void setHomeDirectory(String homeFilePath, String homeUrlPath)
        throws Exception  {

    File f = new File(homeFilePath);
    if (! f.isAbsolute()) {
        throw new HttpException(
      "Bad File Path: Requires an Absolute Home File Path");
    }

    homeDirectory = new SPFile(homeFilePath, this);
View Full Code Here

    SPResourceNode theNode = null;

    String rootPath = root.getAbsolutePath();
    String filePath = aFile.getAbsolutePath();
    if (filePath.indexOf(rootPath) < 0)  {
            throw (new HttpException("Bad File Path: "+filePath
              +" NOT Under Root = "+rootPath));
    }

//System.out.println("SPDirectoryService: IN expandCache() for aFile = "+aFile.getAbsolutePath());
View Full Code Here

      SPResourceNode theNode = getNodeFromServer(aFile);

      if (theNode == null)  { //try to create a new node in Server

      if (! inCache(aFile.getParentFile()) )  {
          throw new HttpException("Bad File Path: "+aFile.getParent());
      }

      SPWebFolder parentDir = (SPWebFolder)
        getNodeFromCache((SPFile) aFile.getParentFile());

      String parentUrlPath = parentDir.getResourceUrlPath();

      if (parentDir.hasWriteAccess())   {
    SPWebFile newNode = new SPWebFile(client,
        parentUrlPath+aFile.getName());
    int statusCode = newNode.putFileContent("");
    if ( statusCode == HttpStatus.SC_OK) {
        parentDir.addWebFile(newNode);
        this.fileCache.put(aFile, newNode);
        theNode = (SPResourceNode) newNode;
    }
      } else {
    throw new HttpException("Write Access Denied in "
            +parentUrlPath+" ("+HttpStatus.SC_FORBIDDEN+")");
      }
      }

      return theNode;
View Full Code Here

  throws Exception {

    SPResourceNode thisNode = getResourceNode();

    if (thisNode == null)  {
  throw new HttpException("RESOURCE NOT FOUND for File = "
      +getAbsolutePath());
    }

    if (thisNode.isWebFolder())  {
  return null;
View Full Code Here

  long timeout) throws Exception {

    SPResourceNode thisNode = getResourceNode();

    if (thisNode == null)  {
  throw new HttpException("RESOURCE NOT FOUND for File = "
      +getAbsolutePath());
    }

    if (thisNode.isWebFolder())  {
  return null;
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.