List of usage examples for org.apache.commons.httpclient HttpURL setUser
public void setUser(String paramString) throws URIException, NullPointerException
From source file:org.apache.cocoon.components.source.impl.WebDAVSource.java
/** * Default constructor.//from ww w . j a v a2 s.c o m */ private WebDAVSource(HttpURL url, String protocol) throws URIException { this.protocol = protocol; this.url = url; String qs = url.getQuery(); if (qs != null) { final SourceParameters sp = new SourceParameters(qs); // parse optional start depth and start action qs parameters this.depth = sp.getParameterAsInteger("cocoon:webdav-depth", DepthSupport.DEPTH_1); this.action = sp.getParameterAsInteger("cocoon:webdav-action", WebdavResource.NOACTION); // [UH] FIXME: Why this alternative way of passing in credentials? String principal = url.getUser(); String password = url.getPassword(); if (principal == null || password == null) { principal = sp.getParameter("cocoon:webdav-principal", principal); password = sp.getParameter("cocoon:webdav-password", password); if (principal != null) { url.setUser(principal); url.setPassword(password); } } sp.removeParameter("cocoon:webdav-depth"); sp.removeParameter("cocoon:webdav-action"); sp.removeParameter("cocoon:webdav-principal"); sp.removeParameter("cocoon:webdav-password"); // set the qs without WebdavSource specific parameters url.setQuery(sp.getQueryString()); } }