Merge pull request #72 from mobconverge/url_encoding

handling url encoded parameters

Sure, not a big deal. However, we really should get rid of the port 443 hack and establish a modproxy setup with an optional ssl endpoint. As soon as there's a handful client's for that API that never wanted to be an API, it will be difficult...
This commit is contained in:
abrensch 2016-12-07 22:00:50 +01:00 committed by GitHub
commit e629a2b2b2

View file

@ -72,12 +72,19 @@ public class ServerHandler extends RequestHandler {
if (lonLats == null) throw new IllegalArgumentException( "lonlats parameter not set" );
String[] coords = lonLats.split("\\|");
if (coords.length < 2) throw new IllegalArgumentException( "we need two lat/lon points at least!" );
if (coords.length < 2)
coords = lonLats.split("%7C");
if (coords.length < 2)
throw new IllegalArgumentException( "we need two lat/lon points at least!" );
List<OsmNodeNamed> wplist = new ArrayList<OsmNodeNamed>();
for (int i = 0; i < coords.length; i++)
{
String[] lonLat = coords[i].split(",");
if (lonLat.length < 2)
lonLat = coords[i].split("%2C");
if (lonLat.length < 2)
throw new IllegalArgumentException( "we need two lat/lon points at least!" );
wplist.add( readPosition( lonLat[0], lonLat[1], "via" + i ) );
}