1 23 24 package org.apache.webdav.connector; 25 26 import javax.resource.cci.ConnectionSpec ; 27 import javax.resource.spi.ConnectionRequestInfo ; 28 29 import org.apache.commons.httpclient.HttpURL; 30 import org.apache.commons.httpclient.HttpsURL; 31 import org.apache.commons.httpclient.URIException; 32 33 39 public class WebDAVConnectionSpec implements ConnectionSpec , ConnectionRequestInfo { 40 41 42 protected HttpURL httpURL; 43 protected int timeout; 44 45 51 public WebDAVConnectionSpec(HttpURL httpURL, int timeout) { 52 this.httpURL = httpURL; 53 this.timeout = timeout; 54 55 } 56 57 66 public WebDAVConnectionSpec(String url, String userName, String password, int timeout) throws URIException { 67 this.httpURL = url.startsWith("https") ? new HttpsURL(url) : new HttpURL(url); 68 this.httpURL.setUserinfo(userName, password); 69 this.timeout = timeout; 70 } 71 72 protected HttpURL getHttpURL() { 73 return httpURL; 74 } 75 76 protected int getTimeout() { 77 return timeout; 78 } 79 } 80 | Popular Tags |