Merge pull request #92 from ntruchsess/master
decode query-string by standard URLDecoder
This commit is contained in:
commit
3ca296ca96
2 changed files with 7 additions and 8 deletions
|
@ -5,9 +5,11 @@ import java.io.BufferedWriter;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.URLDecoder;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
@ -216,10 +218,11 @@ public class RouteServer extends Thread
|
|||
}
|
||||
|
||||
|
||||
private static HashMap<String,String> getUrlParams( String url )
|
||||
private static HashMap<String,String> getUrlParams( String url ) throws UnsupportedEncodingException
|
||||
{
|
||||
HashMap<String,String> params = new HashMap<String,String>();
|
||||
StringTokenizer tk = new StringTokenizer( url, "?&" );
|
||||
String decoded = URLDecoder.decode( url, "UTF-8" );
|
||||
StringTokenizer tk = new StringTokenizer( decoded, "?&" );
|
||||
while( tk.hasMoreTokens() )
|
||||
{
|
||||
String t = tk.nextToken();
|
||||
|
|
|
@ -72,8 +72,6 @@ public class ServerHandler extends RequestHandler {
|
|||
if (lonLats == null) throw new IllegalArgumentException( "lonlats parameter not set" );
|
||||
|
||||
String[] coords = lonLats.split("\\|");
|
||||
if (coords.length < 2)
|
||||
coords = lonLats.split("%7C");
|
||||
if (coords.length < 2)
|
||||
throw new IllegalArgumentException( "we need two lat/lon points at least!" );
|
||||
|
||||
|
@ -81,8 +79,6 @@ public class ServerHandler extends RequestHandler {
|
|||
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 ) );
|
||||
|
|
Loading…
Reference in a new issue