List of usage examples for org.apache.commons.httpclient HttpsURL HttpsURL
public HttpsURL(char[] paramArrayOfChar, String paramString) throws URIException, NullPointerException
From source file:org.apache.cocoon.components.source.impl.WebDAVSource.java
/** * Get a collection child./*from w ww .j a v a 2 s. c o m*/ * * @see org.apache.excalibur.source.TraversableSource#getChild(java.lang.String) */ 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(), eventfactory); } catch (URIException e) { throw new SourceException("Failed to create child", e); } }
From source file:org.apache.cocoon.components.source.impl.WebDAVSource.java
/** * Get the collection children.//from w w w.j a v a2 s.c o m * * @see org.apache.excalibur.source.TraversableSource#getChildren() */ public Collection getChildren() throws SourceException { 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(), this.eventfactory); src.enableLogging(getLogger()); children.add(src); } } catch (HttpException e) { if (getLogger().isDebugEnabled()) { final String message = "Unable to get WebDAV children. Server responded " + e.getReasonCode() + " (" + e.getReason() + ") - " + e.getMessage(); getLogger().debug(message); } throw new SourceException("Failed to get WebDAV collection children.", e); } catch (SourceException e) { throw e; } catch (IOException e) { throw new SourceException("Failed to get WebDAV collection children.", e); } return children; }
From source file:org.apache.cocoon.components.source.impl.WebDAVSource.java
/** * Get the parent.//from www. ja va 2s. c o m * * @see org.apache.excalibur.source.TraversableSource#getParent() */ public Source getParent() throws SourceException { String path; if (this.url.getEscapedPath().endsWith("/")) { path = ".."; } 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(), eventfactory); } catch (URIException e) { throw new SourceException("Failed to create parent", e); } }
From source file:org.apache.webdav.ant.Utils.java
public static HttpURL createHttpURL(HttpURL base, String relative) throws URIException { if (base instanceof HttpsURL) { return new HttpsURL((HttpsURL) base, relative); } else {/* w w w . j a va 2 s .c om*/ return new HttpURL(base, relative); } }
From source file:org.apache.webdav.lib.WebdavResource.java
/** * Set the HttpURL for this WebdavResource. * It must be put an escaped path part of the http URL as an argument. * * @param httpURL The specified HttpURL. * @param additionalPath The added relative path. * @param action The action to decide, which properties to find. * @param depth The depth.// w w w . jav a2 s. c o m * @exception HttpException * @exception IOException * @see #setHttpURL(java.lang.String) * @see #setUserInfo(java.lang.String, java.lang.String) * @see #setPath(java.lang.String) * @see #setDefaultAction(int) */ public void setHttpURL(HttpURL httpURL, String additionalPath, int action, int depth) throws HttpException, IOException { setHttpURL(httpURL instanceof HttpsURL ? new HttpsURL((HttpsURL) httpURL, additionalPath) : new HttpURL(httpURL, additionalPath), action, depth); }
From source file:org.apache.webdav.lib.WebdavResource.java
/** * Set the HttpURL for this WebdavResource. * It must be put an escaped path part of the http URL as an argument. * * @param httpURL The specified HttpURL. * @param additionalPath The added relative path. * @param action The action to decide, which properties to find. * @exception HttpException//from w ww .ja v a 2s. c o m * @exception IOException * @see #setHttpURL(java.lang.String) * @see #setUserInfo(java.lang.String, java.lang.String) * @see #setPath(java.lang.String) * @see #setDefaultAction(int) */ public void setHttpURL(HttpURL httpURL, String additionalPath, int action) throws HttpException, IOException { setHttpURL(httpURL instanceof HttpsURL ? new HttpsURL((HttpsURL) httpURL, additionalPath) : new HttpURL(httpURL, additionalPath), action, defaultDepth); }
From source file:org.apache.webdav.lib.WebdavResource.java
/** * Set the HttpURL for this WebdavResource. * * @param httpURL The specified HttpURL. * @param additionalPath The added relative path. * @exception HttpException//from ww w. j a va 2 s . co m * @exception IOException * @see #setHttpURL(java.lang.String) * @see #setUserInfo(java.lang.String, java.lang.String) * @see #setPath(java.lang.String) */ public void setHttpURL(HttpURL httpURL, String additionalPath) throws HttpException, IOException { setHttpURL(httpURL instanceof HttpsURL ? new HttpsURL((HttpsURL) httpURL, additionalPath) : new HttpURL(httpURL, additionalPath), defaultAction, defaultDepth); }
From source file:pl.nask.hsn2.NewUrlObject.java
public NewUrlObject(String url, String origin, String type) throws URIException { this.originalUrl = url; this.origin = origin; this.type = type; String scheme = getSchemeFromUri(); if (scheme != null) { if (scheme.equals("https")) { this.uri = new HttpsURL(originalUrl, Charset.forName("UTF-8").name());//Default charset is UTF-8 but this isn't handled correctly in getters methods!!! } else if (scheme.equals("http")) { this.uri = new HttpURL(originalUrl, Charset.forName("UTF-8").name()); } else {/*from w w w . j a v a 2s.c o m*/ this.uri = new URI(originalUrl, false, Charset.forName("UTF-8").name()); } } else { throw new URIException("Can't find scheme (protocol name)."); } }