Skip to content

Commit

Permalink
remove unused legacy procedure from httpserver
Browse files Browse the repository at this point in the history
(deleted  generateSocketAddress(port) )
  • Loading branch information
reger committed Aug 30, 2014
1 parent b02cb18 commit c733531
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 65 deletions.
62 changes: 4 additions & 58 deletions source/net/yacy/http/Jetty9HttpServerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,7 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.security.KeyStore;
import java.util.Enumeration;
import java.util.StringTokenizer;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
Expand Down Expand Up @@ -351,57 +345,10 @@ public void removeUser(String username) {
}
}

@Override
public InetSocketAddress generateSocketAddress(String extendedPortString) throws SocketException {
// parsing the port configuration
String bindIP = null;
int bindPort;

int pos = extendedPortString.indexOf(':');
if (pos != -1) {
bindIP = extendedPortString.substring(0,pos).trim();
extendedPortString = extendedPortString.substring(pos+1);

if (bindIP.length() > 0 && bindIP.charAt(0) == '#') {
final String interfaceName = bindIP.substring(1);
String hostName = null;
if (ConcurrentLog.isFine("SERVER")) ConcurrentLog.fine("SERVER","Trying to determine IP address of interface '" + interfaceName + "'.");

final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
if (interfaces != null) {
while (interfaces.hasMoreElements()) {
final NetworkInterface interf = interfaces.nextElement();
if (interf.getName().equalsIgnoreCase(interfaceName)) {
final Enumeration<InetAddress> addresses = interf.getInetAddresses();
if (addresses != null) {
while (addresses.hasMoreElements()) {
final InetAddress address = addresses.nextElement();
if (address instanceof Inet4Address) {
hostName = address.getHostAddress();
break;
}
}
}
}
}
}
if (hostName == null) {
ConcurrentLog.warn("SERVER", "Unable to find interface with name '" + interfaceName + "'. Binding server to all interfaces");
bindIP = null;
} else {
ConcurrentLog.info("SERVER", "Binding server to interface '" + interfaceName + "' with IP '" + hostName + "'.");
bindIP = hostName;
}
}
}
bindPort = Integer.parseInt(extendedPortString);

return (bindIP == null)
? new InetSocketAddress(bindPort)
: new InetSocketAddress(bindIP, bindPort);

}

/**
* get Jetty version
* @return version_string
*/
@Override
public String getVersion() {
return "Jetty " + Server.getVersion();
Expand Down Expand Up @@ -505,5 +452,4 @@ private SSLContext initSslContext(Switchboard sb) {
return null;
}
}

}
8 changes: 1 addition & 7 deletions source/net/yacy/http/YaCyHttpServer.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@

package net.yacy.http;

import java.net.InetSocketAddress;
import java.net.SocketException;

/**
* Isolation of HttpServer
*
* Development Goal: allow for individual implementation of a HttpServer
* to provide the routines and entry points required by the
* YaCy servlets
*
* currently Jetty implementation is ongoing
*
* Implementation Jetty8HttpServerImpl.java
* Implementation Jetty9HttpServerImpl.java
*/
public interface YaCyHttpServer {

abstract void startupServer() throws Exception;
abstract void stop() throws Exception;
abstract InetSocketAddress generateSocketAddress(String port) throws SocketException;
abstract int getSslPort();
abstract boolean withSSL();
abstract void reconnect(int milsec);
Expand Down

0 comments on commit c733531

Please sign in to comment.