Methods Summary |
---|
public java.lang.String | externalise(java.lang.String address)
if ( !enabled || address.length() < 255 ){
return( address );
}
String target = (String)map.get( address );
if ( target == null ){
target = address;
}
// System.out.println( "AEProxyAddressMapper: externalise " + address + " -> " + target );
return( target );
|
public java.net.URL | externalise(java.net.URL url)
if ( !enabled ){
return( url );
}
String host = url.getHost();
if ( host.length() < 255 ){
return( url );
}
String new_host = externalise( host );
String url_str = url.toString();
int pos = url_str.indexOf( host );
if ( pos == -1 ){
Debug.out( "inconsistent url '" + url_str + "' / '" + host + "'" );
return( url );
}
String new_url_str = url_str.substring(0,pos) +
new_host + url_str.substring(pos+host.length());
try{
return( new URL( new_url_str ));
}catch( MalformedURLException e ){
Debug.printStackTrace(e);
return( url );
}
|
public static com.aelitis.azureus.core.proxy.AEProxyAddressMapper | getSingleton()
return( singleton );
|
public java.lang.String | internalise(java.lang.String address)
if ( !enabled ){
return( address );
}
if ( address.length() < 256 ){
return( address );
}
String target;
try{
this_mon.enter();
target = (String)reverse_map.get( address );
if ( target == null ){
target = prefix + (next_value++);
while( target.length() < 255 ){
target += "0";
}
map.put( target, address );
reverse_map.put( address, target );
}
}finally{
this_mon.exit();
}
// System.out.println( "AEProxyAddressMapper: internalise " + address + " -> " + target );
return( target );
|
public java.net.URL | internalise(java.net.URL url)
if ( !enabled ){
return( url );
}
String host = url.getHost();
if ( host.length() < 256 ){
return( url );
}
String new_host = internalise( host );
String url_str = url.toString();
int pos = url_str.indexOf( host );
if ( pos == -1 ){
Debug.out( "inconsistent url '" + url_str + "' / '" + host + "'" );
return( url );
}
String new_url_str = url_str.substring(0,pos) +
new_host + url_str.substring(pos+host.length());
try{
return( new URL( new_url_str ));
}catch( MalformedURLException e ){
Debug.printStackTrace(e);
return( url );
}
|