mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-17 17:19:51 +00:00
Extract JSON get stops parameters to method
This commit is contained in:
parent
4a7743d094
commit
7acd4a0afa
21 changed files with 95 additions and 106 deletions
|
@ -20,14 +20,12 @@ package de.schildbach.pte;
|
|||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
import de.schildbach.pte.dto.Product;
|
||||
import de.schildbach.pte.dto.QueryDeparturesResult;
|
||||
import de.schildbach.pte.util.ParserUtils;
|
||||
|
||||
/**
|
||||
* @author Andreas Schildbach
|
||||
|
@ -171,14 +169,12 @@ public class NriProvider extends AbstractHafasProvider
|
|||
return xmlQueryDepartures(uri.toString(), stationId);
|
||||
}
|
||||
|
||||
private static final String AUTOCOMPLETE_URI = API_BASE
|
||||
+ "ajax-getstop.exe/ony?start=1&tpl=suggest2json&REQ0JourneyStopsS0A=255&REQ0JourneyStopsS0B=5&REQ0JourneyStopsB=12&getstop=1&noSession=yes&REQ0JourneyStopsS0G=%s?&js=true&";
|
||||
|
||||
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
|
||||
{
|
||||
final String uri = String.format(Locale.ENGLISH, AUTOCOMPLETE_URI, ParserUtils.urlEncode(constraint.toString(), ISO_8859_1));
|
||||
final StringBuilder uri = new StringBuilder(getStopEndpoint);
|
||||
uri.append(jsonGetStopsParameters(constraint));
|
||||
|
||||
return jsonGetStops(uri);
|
||||
return jsonGetStops(uri.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue