Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.HttpURL


    private HttpURL getURL(String u)
    {
        try
        {
            HttpURL url = new HttpURL(u);

            //System.out.println(user + ":"+ pass);
            url.setUserinfo(user, pass);

            return url;
        }
        catch(Exception ex)
        {
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

    protected void performSearchMethod(String query) throws SAXException {
        try {
            DOMStreamer propertyStreamer = new DOMStreamer(this.xmlConsumer);
            OptionsMethod optionsMethod = new OptionsMethod(this.targetUrl);
            SearchMethod searchMethod = new SearchMethod(this.targetUrl, query);
            HttpURL url = new HttpURL(this.targetUrl);
            HttpState state = new HttpState();
            state.setCredentials(null, new UsernamePasswordCredentials(
                    url.getUser(),
                    url.getPassword()));                      
            HttpConnection conn = new HttpConnection(url.getHost(), url.getPort());
            WebdavResource resource = new WebdavResource(new HttpURL(this.targetUrl));
            if(!resource.exists()) {
                throw new SAXException("The WebDAV resource don't exist");
            }
            optionsMethod.execute(state, conn);
            if(!optionsMethod.isAllowed("SEARCH")) {
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

     */
    public Source getParent() throws SourceException {
        String path = isCollection()?"..":".";
     
        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

        int index = location.indexOf(':');
        if (index != -1) {
            location = location.substring(index+3);
        }
       
        HttpURL url;
        if (this.secure) {
            url = new HttpsURL("https://" + location);
        } else {
            url = new HttpURL("http://" + location);
        }
       
        return WebDAVSource.newWebDAVSource(url, this.protocol, getLogger());
    }
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

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.