Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.HttpURL


                req = overrideParams(req, name, value);
            }
        }

        /* Process the current source URL in relation to the configured one */
        HttpURL src = (super.source == null ? null : new HttpURL(super.source));
        if (this.url != null) src = (src == null ? this.url : new HttpURL(this.url, src));
        if (src == null) throw new ProcessingException("No URL specified");
        if (src.isRelativeURI()) {
            throw new ProcessingException("Invalid URL \"" + src.toString() + "\"");
        }

        /* Configure the method with the resolved URL */
        HostConfiguration hc = new HostConfiguration();
        hc.setHost(src);
        this.method.setHostConfiguration(hc);
        this.method.setPath(src.getPath());
        this.method.setQueryString(src.getQuery());

        /* And now process the query string (from the parameters above) */
        if (qry.size() > 0) {
            String qs = this.method.getQueryString();
            NameValuePair nvpa[] = new NameValuePair[qry.size()];
View Full Code Here


                throw new ProcessingException("Missing the \"url\" parameter");
            }
            path =  par.getParameter("path", null);
            if (path == null)
                path =  request.getRequestURI();
            destination = new HttpURL(url);
           
      }
View Full Code Here

  public static HttpClient createConnection(String hostname, int port, String username,
      String password, FileSystemOptions fileSystemOptions) throws FileSystemException {
    // Create an Http client
    HttpClient client;
    try {
      final HttpURL url = new HttpURL(username, password, hostname, port, "/");

      // WebdavResource resource = null;
      WebdavResource resource = new WebdavResource() {
      };
View Full Code Here

    public Source getChild(String childName) throws SourceException {
        if (!isCollection()) {
            throw new SourceException(getSecureURI() + " is not a collection.");
        }
        try {
            HttpURL childURL;
            if (this.url instanceof HttpsURL) {
                childURL = new HttpsURL((HttpsURL) this.url, childName);
            } else {
                childURL = new HttpURL(this.url, childName);
            }
            return WebDAVSource.newWebDAVSource(childURL, this.protocol, getLogger());
        } catch (URIException e) {
            throw new SourceException("Failed to create child", e);
        }       
View Full Code Here

        initResource(WebdavResource.BASIC, DepthSupport.DEPTH_1);
        ArrayList children = new ArrayList();
        try {
            WebdavResource[] resources = this.resource.listWebdavResources();
            for (int i = 0; i < resources.length; i++) {
                HttpURL childURL;
                if (this.url instanceof HttpsURL) {
                    childURL = new HttpsURL((HttpsURL) this.url,resources[i].getName());
                } else {
                    childURL = new HttpURL(this.url,resources[i].getName());
                }
                WebDAVSource src = WebDAVSource.newWebDAVSource(resources[i],
                                                                childURL,
                                                                this.protocol,
                                                                getLogger());
View Full Code Here

        }
        else {
            path = ".";
        }
        try {
            HttpURL parentURL;
            if (url instanceof HttpsURL) {
                parentURL = new HttpsURL((HttpsURL) this.url, path);
            } else {
                parentURL = new HttpURL(this.url, path);
            }
            return WebDAVSource.newWebDAVSource(parentURL, this.protocol, getLogger());
        } catch (URIException e) {
            throw new SourceException("Failed to create parent", e);
        }
View Full Code Here

            this.getLogger().debug("Creating source object for " + location);
        }

        final String protocol = location.substring(0, location.indexOf(':'));

    HttpURL url = new HttpURL("http://" + location.substring(location.indexOf(':')+3));      
    String principal = url.getUser();
    String password = url.getPassword();
    location = url.getHost() + ":" + url.getPort();
    if(url.getPathQuery() != null) location += url.getPathQuery();

        if(principal == null || password == null) {
      String queryString = url.getQuery();
      SourceParameters locationParameters = new SourceParameters(queryString);
      principal = locationParameters.getParameter("principal", principal);
      password = locationParameters.getParameter("password", password);
        }
View Full Code Here

        }

        /* Create the base URL */
        String url = configuration.getChild("url").getValue(null);
        try {
            if (url != null) this.url = new HttpURL(url);
        } catch (URIException e) {
            throw new ConfigurationException("Cannot process URL \"" + url + "\" specified"
                    + " at " + configuration.getChild("url").getLocation());
        }

View Full Code Here

                req = overrideParams(req, name, value);
            }
        }

        /* Process the current source URL in relation to the configured one */
        HttpURL src = (super.source == null ? null : new HttpURL(super.source));
        if (this.url != null) src = (src == null ? this.url : new HttpURL(this.url, src));
        if (src == null) throw new ProcessingException("No URL specified");
        if (src.isRelativeURI()) {
            throw new ProcessingException("Invalid URL \"" + src.toString() + "\"");
        }

        /* Configure the method with the resolved URL */
        HostConfiguration hc = new HostConfiguration();
        hc.setHost(src);
        this.method.setHostConfiguration(hc);
        this.method.setPath(src.getPath());
        this.method.setQueryString(src.getQuery());

        /* And now process the query string (from the parameters above) */
        if (qry.size() > 0) {
            String qs = this.method.getQueryString();
            NameValuePair nvpa[] = new NameValuePair[qry.size()];
View Full Code Here

                throw new ProcessingException("Missing the \"url\" parameter");
            }
            path =  par.getParameter("path", null);
            if (path == null)
                path =  request.getRequestURI();
            destination = new HttpURL(url);
           
      }
View Full Code Here

TOP

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

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.