handling url encoded parameters
This commit is contained in:
parent
d42895880d
commit
0a616c70cc
1 changed files with 8 additions and 1 deletions
|
@ -72,12 +72,19 @@ public class ServerHandler extends RequestHandler {
|
||||||
if (lonLats == null) throw new IllegalArgumentException( "lonlats parameter not set" );
|
if (lonLats == null) throw new IllegalArgumentException( "lonlats parameter not set" );
|
||||||
|
|
||||||
String[] coords = lonLats.split("\\|");
|
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>();
|
List<OsmNodeNamed> wplist = new ArrayList<OsmNodeNamed>();
|
||||||
for (int i = 0; i < coords.length; i++)
|
for (int i = 0; i < coords.length; i++)
|
||||||
{
|
{
|
||||||
String[] lonLat = coords[i].split(",");
|
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 ) );
|
wplist.add( readPosition( lonLat[0], lonLat[1], "via" + i ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue