Java 类org.apache.commons.httpclient.HttpsURL 实例源码

项目:jakarta-slide-webdavclient    文件:Utils.java   
public static HttpURL createHttpURL(HttpURL base, String relative) 
    throws URIException
{
  if (base instanceof HttpsURL) {
     return new HttpsURL((HttpsURL)base, relative);
  } else {
     return new HttpURL(base, relative);
  }
}
项目:jakarta-slide-webdavclient    文件:Utils.java   
public static HttpURL createHttpURL(String url) throws URIException
{
   if (url.startsWith("https://")) {
      return new HttpsURL(url);
   } else {
      return new HttpURL(url);
   }
}
项目:jakarta-slide-webdavclient    文件:WebdavResource.java   
/**
 * Get the HttpURL except for userinfo.
 *
 * @return httpURL the http URL.
 */
public HttpURL getHttpURLExceptForUserInfo()
    throws URIException {

    return httpURL instanceof HttpsURL ? new HttpsURL(httpURL.getRawURI())
                                       : new HttpURL(httpURL.getRawURI());
}
项目:karma-exchange    文件:ServletUtil.java   
private static String getBaseUri(HttpServletRequest req, boolean alwaysSpecifyPort) {
  URI requestUri = getRequestUri(req);
  int port = requestUri.getPort();
  String scheme = requestUri.getScheme();
  if ((port == -1) && alwaysSpecifyPort) {
    if (scheme.equalsIgnoreCase(new String(HttpURL.DEFAULT_SCHEME))) {
      port = HttpURL.DEFAULT_PORT;
    } else if (scheme.equalsIgnoreCase(new String(HttpsURL.DEFAULT_SCHEME))) {
      port = HttpsURL.DEFAULT_PORT;
    }
  }
  String portString = port == -1 ? "" : ":" + port;
  return scheme + "://" + requestUri.getHost() + portString;
}
项目:jakarta-slide-webdavclient    文件:Client.java   
private static HttpURL uriToHttpURL(String uri) throws URIException {
    return uri.startsWith("https") ? new HttpsURL(uri)
                                   : new HttpURL(uri);
}
项目:jakarta-slide-webdavclient    文件:WebdavFile.java   
/**
 * @param url file path
 * @param user user name
 * @param pass password
 */
public WebdavFile(URL url, String user, String pass) throws URIException {
  this(url.getProtocol().equals("https")
      ? new HttpsURL(user, pass, url.getHost(), url.getPort(), url.getPath())
      : new HttpURL(user, pass, url.getHost(), url.getPort(), url.getPath()));
}
项目:jakarta-slide-webdavclient    文件: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.
 * @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);
}
项目:jakarta-slide-webdavclient    文件: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
 * @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);
}
项目:jakarta-slide-webdavclient    文件:WebdavResource.java   
/**
 * Set the HttpURL for this WebdavResource.
 *
 * @param httpURL The specified HttpURL.
 * @param additionalPath The added relative path.
 * @exception HttpException
 * @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);
}
项目:jakarta-slide-webdavclient    文件:WebdavResource.java   
/**
 * Set the HttpURL of this WebdavResource.
 * It must be put an escaped http URL as an argument.
 *
 * @param escapedHttpURL The escaped http URL string.
 * @exception HttpException
 * @exception IOException
 * @see #setHttpURL(HttpURL)
 * @see #setUserInfo(java.lang.String, java.lang.String)
 * @see #setPath(java.lang.String)
 */
public void setHttpURL(String escapedHttpURL)
    throws HttpException, IOException {

    setHttpURL(escapedHttpURL.startsWith("https")
               ? new HttpsURL(escapedHttpURL)
               : new HttpURL(escapedHttpURL));
}
项目:jakarta-slide-webdavclient    文件:WebDAVConnectionSpec.java   
/**
 * Creates a specification where the {@link WebDAVConnection} shall go to.
 * 
 * @param url path string of the Slide (WebDAV) server
 * @param userName user name for login to the Slide (WebDAV) server
 * @param password password for login to the Slide (WebDAV) server
 * @param timeout timeout of the externally controlled transaction 
 * @throws URIException if the given uri is not a valid one
 */
public WebDAVConnectionSpec(String url, String userName, String password, int timeout) throws URIException {
    this.httpURL = url.startsWith("https") ? new HttpsURL(url) : new HttpURL(url);
    this.httpURL.setUserinfo(userName, password);
    this.timeout = timeout; 
}