6 |
|
|
7 |
import com.google.gson.Gson; |
import com.google.gson.Gson; |
8 |
|
|
9 |
|
import dk.daoas.adressevedligehold.ServiceConfig; |
10 |
import dk.daoas.adressevedligehold.beans.Address; |
import dk.daoas.adressevedligehold.beans.Address; |
11 |
import dk.daoas.adressevedligehold.util.HttpUtil; |
import dk.daoas.adressevedligehold.util.HttpUtil; |
12 |
|
|
16 |
|
|
17 |
final static Logger logger = Logger.getLogger( OSRMHelper.class.toString() ); |
final static Logger logger = Logger.getLogger( OSRMHelper.class.toString() ); |
18 |
|
|
19 |
|
|
20 |
Gson gson = new Gson(); |
Gson gson = new Gson(); |
21 |
|
|
|
//static OSRMBinding binding = null; |
|
|
|
|
|
final String host = "127.0.0.1"; |
|
|
//final String host = "10.30.2.103"; |
|
22 |
final int port = 5000; |
final int port = 5000; |
23 |
final String base_url = "http://" + host + ":" + port; |
final String base_url = "http://" + ServiceConfig.getInstance().osrmHost + ":" + port; |
|
|
|
24 |
|
|
|
public Address getNearestTableHttp(Address a1, Collection<Address> haystack) { |
|
25 |
|
|
26 |
|
public Address getNearestTableHttp(Address a1, Collection<Address> haystack) throws Exception { |
27 |
|
|
28 |
|
|
29 |
Address bedsteAddress = null; |
Address bedsteAddress = null; |
62 |
System.out.println(txtResponse); |
System.out.println(txtResponse); |
63 |
|
|
64 |
|
|
65 |
System.exit(0); |
throw new Exception("Wrong number of results in matrix"); |
66 |
} |
} |
67 |
|
|
68 |
int bedsteTid = Integer.MAX_VALUE; |
int bedsteTid = Integer.MAX_VALUE; |
79 |
logger.log(Level.SEVERE, "Lookup failed", e); |
logger.log(Level.SEVERE, "Lookup failed", e); |
80 |
System.out.println( sb.toString() ); |
System.out.println( sb.toString() ); |
81 |
System.out.println( a1 ); |
System.out.println( a1 ); |
82 |
System.exit(1); |
throw e; //Re-throw |
83 |
} |
} |
84 |
|
|
85 |
//return gson.fromJson(txtResponse, OSRMResponse.class); |
//return gson.fromJson(txtResponse, OSRMResponse.class); |