Constructors Summary |
---|
public HttpConnectorAddress()/*,
DefaultConfiguration.LOGGER_RESOURCE_BUNDLE_NAME );*/
/* END -- S1WS_MOD */
|
public HttpConnectorAddress(HostAndPort h)
this(h.getHost(), h.getPort(), h.isSecure());
|
public HttpConnectorAddress(String host, int port)
this(host, port, false);
|
public HttpConnectorAddress(String host, int port, boolean secure)construct an address which indicates the host, port and
security attributes desired.
/* BEGIN -- S1WS_MOD */
/*
this.host = host;
this.port = port;
this.secure = secure;
*/
this(host, port, secure, null);
/* END -- S1WS_MOD */
|
public HttpConnectorAddress(String host, int port, boolean secure, String path)
this.host = host;
this.port = port;
this.secure = secure;
this.path = path;
|
Methods Summary |
---|
private final java.lang.String | asURLSpec(java.lang.String path)Return a string which can be used as the specification to
form an URL.
return this.getConnectorType()
+"://"+this.getAuthority()
+(path != null? path : "");
|
public AuthenticationInfo | getAuthenticationInfo()
return authInfo;
|
private final java.lang.String | getAuthority()Return the authority portion of the URL spec
return this.getHost() + ":" + this.getPort();
|
private static final java.lang.String | getBase64Encoded(java.lang.String clearString)
return new BASE64Encoder().encode(clearString.getBytes());
|
private final java.lang.String | getBasicAuthString()
/* taking care of the descripancies in the Base64Encoder, for very
large lengths of passwords and/or usernames.
Abhijit did the analysis and as per his suggestion, replacing
a newline in Base64 encoded String by newline followed by a space
should work for any length of password, independent of the
web server buffer length. That investigation is still on, but
in the meanwhile, it was found that the replacement of newline
character with empty string "" works. Hence implementing the same.
Date: 10/10/2003.
*/
String enc = this.getBase64Encoded(this.getUser() + ":" + this.getPassword());
/*
String f = "\n"; // System.getProperty("line.separator");
String t = f + " " ;
enc = enc.replaceAll(f, t);
f = "\r\n";
t = f + " ";
enc = enc.replaceAll(f, t);
*/
enc = enc.replaceAll(System.getProperty("line.separator"), "");
return ( AUTHORIZATION_TYPE + enc );
|
public java.lang.String | getConnectorType()get the protocol prefix to be used for a connection for the
receiver
return this.isSecure() ? HTTPS_CONNECTOR : HTTP_CONNECTOR;
|
public java.lang.String | getHost()
return host;
|
private final java.lang.String | getPassword()
return authInfo != null ? authInfo.getPassword() : "";
|
public java.lang.String | getPath()
return path;
|
public int | getPort()
return port;
|
private final java.lang.String | getUser()
return authInfo != null ? authInfo.getUser() : "";
|
public boolean | isSecure()Indicate if the reciever represents a secure address
return secure;
|
private final java.net.URLConnection | makeConnection(java.net.URL url)
return ( url.openConnection() );
|
private final java.net.URLConnection | openConnection(java.net.URL url)
return this.setOptions(this.makeConnection(url));
|
public java.net.URLConnection | openConnection(java.lang.String path)Open a connection using the reciever and the given path
/* BEGIN -- S1WS_MOD */
if (path == null || path.trim().length() == 0)
path = this.path;
/* END -- S1WS_MOD */
return this.openConnection(this.toURL(path));
|
private final java.net.URLConnection | setAuthentication(java.net.URLConnection uc)
if (authInfo != null) {
uc.setRequestProperty(AUTHORIZATION_KEY, this.getBasicAuthString());
}
return uc;
|
public void | setAuthenticationInfo(AuthenticationInfo authInfo)
this.authInfo = authInfo;
|
public void | setHost(java.lang.String host)
this.host = host;
|
private final java.net.URLConnection | setOptions(java.net.URLConnection uc)
uc.setDoOutput(true);
uc.setUseCaches(false);
uc.setRequestProperty("Content-type", "application/octet-stream");
uc.setRequestProperty("Connection", "Keep-Alive");
return this.setAuthentication(uc);
|
public void | setPath(java.lang.String path)
this.path = path;
|
public void | setPort(int port)
this.port = port;
|
public void | setSecure(boolean secure)Set the security attibute
this.secure = secure;
|
private final java.net.URL | toURL(java.lang.String path)
return new URL(this.asURLSpec(path));
|