mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-18 16:29:51 +00:00
Hafas: Use setters for non-standard character encodings, rather than the constructor parameter.
This commit is contained in:
parent
27f60db22b
commit
10d04bcb39
16 changed files with 53 additions and 26 deletions
|
@ -98,9 +98,9 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
private Product[] productsMap;
|
||||
private @Nullable String accessId = null;
|
||||
private @Nullable String clientType = "ANDROID";
|
||||
private Charset jsonGetStopsEncoding;
|
||||
private Charset jsonGetStopsEncoding = Charsets.ISO_8859_1;
|
||||
private boolean jsonGetStopsUseWeight = true;
|
||||
private Charset jsonNearbyLocationsEncoding;
|
||||
private Charset jsonNearbyLocationsEncoding = Charsets.ISO_8859_1;
|
||||
private boolean dominantPlanStopTime = false;
|
||||
private boolean useIso8601 = false;
|
||||
private @Nullable String extXmlEndpoint = null;
|
||||
|
@ -164,12 +164,6 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
|
||||
public AbstractHafasProvider(final NetworkId network, final String stationBoardEndpoint, final String getStopEndpoint, final String queryEndpoint,
|
||||
final Product[] productsMap)
|
||||
{
|
||||
this(network, stationBoardEndpoint, getStopEndpoint, queryEndpoint, productsMap, Charsets.ISO_8859_1);
|
||||
}
|
||||
|
||||
public AbstractHafasProvider(final NetworkId network, final String stationBoardEndpoint, final String getStopEndpoint, final String queryEndpoint,
|
||||
final Product[] productsMap, final Charset jsonEncoding)
|
||||
{
|
||||
super(network);
|
||||
|
||||
|
@ -177,8 +171,6 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
this.getStopEndpoint = getStopEndpoint;
|
||||
this.queryEndpoint = queryEndpoint;
|
||||
this.productsMap = productsMap;
|
||||
this.jsonGetStopsEncoding = jsonEncoding;
|
||||
this.jsonNearbyLocationsEncoding = jsonEncoding;
|
||||
}
|
||||
|
||||
protected void setClientType(final String clientType)
|
||||
|
|
|
@ -44,10 +44,11 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
|
||||
public BvgProvider()
|
||||
{
|
||||
super(NetworkId.BVG, API_BASE_STATION_BOARD + "stboard.exe/dn", API_BASE + "ajax-getstop.bin/dny", API_BASE + "query.bin/dn", PRODUCTS_MAP,
|
||||
Charsets.UTF_8);
|
||||
super(NetworkId.BVG, API_BASE_STATION_BOARD + "stboard.exe/dn", API_BASE + "ajax-getstop.bin/dny", API_BASE + "query.bin/dn", PRODUCTS_MAP);
|
||||
|
||||
setJsonGetStopsUseWeight(false);
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
setJsonNearbyLocationsEncoding(Charsets.UTF_8);
|
||||
setStyles(STYLES);
|
||||
}
|
||||
|
||||
|
|
|
@ -66,9 +66,11 @@ public class InvgProvider extends AbstractHafasProvider
|
|||
|
||||
public InvgProvider()
|
||||
{
|
||||
super(NetworkId.INVG, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP, Charsets.UTF_8);
|
||||
super(NetworkId.INVG, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP);
|
||||
|
||||
setStationBoardCanDoEquivs(false);
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
setJsonNearbyLocationsEncoding(Charsets.UTF_8);
|
||||
setStyles(STYLES);
|
||||
setExtXmlEndpoint(API_BASE + "extxml.exe");
|
||||
}
|
||||
|
|
|
@ -42,7 +42,10 @@ public class JetProvider extends AbstractHafasProvider
|
|||
|
||||
public JetProvider()
|
||||
{
|
||||
super(NetworkId.JET, API_BASE + "stboard.bin/yn", API_BASE + "ajax-getstop.bin/yn", API_BASE + "query.bin/yn", PRODUCTS_MAP, Charsets.UTF_8);
|
||||
super(NetworkId.JET, API_BASE + "stboard.bin/yn", API_BASE + "ajax-getstop.bin/yn", API_BASE + "query.bin/yn", PRODUCTS_MAP);
|
||||
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
setJsonNearbyLocationsEncoding(Charsets.UTF_8);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,7 +34,10 @@ public class LuProvider extends AbstractHafasProvider
|
|||
|
||||
public LuProvider()
|
||||
{
|
||||
super(NetworkId.LU, API_BASE + "stboard.exe/fn", API_BASE + "ajax-getstop.exe/fn", API_BASE + "query.exe/fn", PRODUCTS_MAP, Charsets.UTF_8);
|
||||
super(NetworkId.LU, API_BASE + "stboard.exe/fn", API_BASE + "ajax-getstop.exe/fn", API_BASE + "query.exe/fn", PRODUCTS_MAP);
|
||||
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
setJsonNearbyLocationsEncoding(Charsets.UTF_8);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -40,8 +40,10 @@ public class NasaProvider extends AbstractHafasProvider
|
|||
|
||||
public NasaProvider()
|
||||
{
|
||||
super(NetworkId.NASA, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP, Charsets.UTF_8);
|
||||
super(NetworkId.NASA, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP);
|
||||
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
setJsonNearbyLocationsEncoding(Charsets.UTF_8);
|
||||
setStationBoardHasLocation(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,10 @@ public class NvvProvider extends AbstractHafasProvider
|
|||
|
||||
public NvvProvider()
|
||||
{
|
||||
super(NetworkId.NVV, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP, Charsets.UTF_8);
|
||||
super(NetworkId.NVV, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP);
|
||||
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
setJsonNearbyLocationsEncoding(Charsets.UTF_8);
|
||||
}
|
||||
|
||||
private static final String[] PLACES = { "Frankfurt (Main)", "Offenbach (Main)", "Mainz", "Wiesbaden", "Marburg", "Kassel", "Hanau", "Göttingen",
|
||||
|
|
|
@ -35,7 +35,10 @@ public class PlProvider extends AbstractHafasProvider
|
|||
|
||||
public PlProvider()
|
||||
{
|
||||
super(NetworkId.PL, API_BASE + "stboard.exe/pn", API_BASE + "ajax-getstop.exe/pn", API_BASE + "query.exe/pn", PRODUCTS_MAP, Charsets.UTF_8);
|
||||
super(NetworkId.PL, API_BASE + "stboard.exe/pn", API_BASE + "ajax-getstop.exe/pn", API_BASE + "query.exe/pn", PRODUCTS_MAP);
|
||||
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
setJsonNearbyLocationsEncoding(Charsets.UTF_8);
|
||||
}
|
||||
|
||||
private static final String[] PLACES = { "Warszawa", "Kraków" };
|
||||
|
|
|
@ -40,8 +40,10 @@ public class RsagProvider extends AbstractHafasProvider
|
|||
|
||||
public RsagProvider()
|
||||
{
|
||||
super(NetworkId.RSAG, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP, Charsets.UTF_8);
|
||||
super(NetworkId.RSAG, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP);
|
||||
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
setJsonNearbyLocationsEncoding(Charsets.UTF_8);
|
||||
setStyles(STYLES);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,9 @@ public class RtProvider extends AbstractHafasProvider
|
|||
|
||||
public RtProvider()
|
||||
{
|
||||
super(NetworkId.RT, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP, Charsets.UTF_8);
|
||||
super(NetworkId.RT, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP);
|
||||
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
setJsonNearbyLocationsEncoding(Charsets.ISO_8859_1);
|
||||
setStationBoardHasStationTable(false);
|
||||
}
|
||||
|
|
|
@ -40,8 +40,10 @@ public class SeProvider extends AbstractHafasProvider
|
|||
|
||||
public SeProvider()
|
||||
{
|
||||
super(NetworkId.SE, API_BASE + "stboard.exe/sn", API_BASE + "ajax-getstop.exe/sny", API_BASE + "query.exe/sn", PRODUCTS_MAP, Charsets.UTF_8);
|
||||
super(NetworkId.SE, API_BASE + "stboard.exe/sn", API_BASE + "ajax-getstop.exe/sny", API_BASE + "query.exe/sn", PRODUCTS_MAP);
|
||||
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
setJsonNearbyLocationsEncoding(Charsets.UTF_8);
|
||||
setUseIso8601(true);
|
||||
setStationBoardHasStationTable(false);
|
||||
setStationBoardCanDoEquivs(false);
|
||||
|
|
|
@ -36,7 +36,10 @@ public class ShProvider extends AbstractHafasProvider
|
|||
|
||||
public ShProvider()
|
||||
{
|
||||
super(NetworkId.SH, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP, Charsets.UTF_8);
|
||||
super(NetworkId.SH, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP);
|
||||
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
setJsonNearbyLocationsEncoding(Charsets.UTF_8);
|
||||
}
|
||||
|
||||
private static final String[] PLACES = { "Hamburg", "Kiel", "Lübeck", "Flensburg", "Neumünster" };
|
||||
|
|
|
@ -40,9 +40,11 @@ public class VbbProvider extends AbstractHafasProvider
|
|||
|
||||
public VbbProvider()
|
||||
{
|
||||
super(NetworkId.VBB, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP, Charsets.UTF_8);
|
||||
super(NetworkId.VBB, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP);
|
||||
|
||||
setJsonGetStopsUseWeight(false);
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
setJsonNearbyLocationsEncoding(Charsets.UTF_8);
|
||||
}
|
||||
|
||||
private static final Pattern P_SPLIT_NAME_SU = Pattern.compile("(.*?)(?:\\s+\\((S|U|S\\+U)\\))?");
|
||||
|
|
|
@ -32,7 +32,10 @@ public class VbnProvider extends AbstractHafasProvider
|
|||
|
||||
public VbnProvider()
|
||||
{
|
||||
super(NetworkId.VBN, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dny", API_BASE + "query.exe/dn", PRODUCTS_MAP, Charsets.UTF_8);
|
||||
super(NetworkId.VBN, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dny", API_BASE + "query.exe/dn", PRODUCTS_MAP);
|
||||
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
setJsonNearbyLocationsEncoding(Charsets.UTF_8);
|
||||
}
|
||||
|
||||
private static final String[] PLACES = { "Bremen", "Bremerhaven", "Oldenburg(Oldb)", "Osnabrück", "Göttingen" };
|
||||
|
|
|
@ -38,7 +38,10 @@ public class VsnProvider extends AbstractHafasProvider
|
|||
|
||||
public VsnProvider()
|
||||
{
|
||||
super(NetworkId.VSN, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP, Charsets.UTF_8);
|
||||
super(NetworkId.VSN, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP);
|
||||
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
setJsonNearbyLocationsEncoding(Charsets.UTF_8);
|
||||
}
|
||||
|
||||
private static final String[] PLACES = { "Göttingen" };
|
||||
|
|
|
@ -39,8 +39,10 @@ public class ZvvProvider extends AbstractHafasProvider
|
|||
|
||||
public ZvvProvider()
|
||||
{
|
||||
super(NetworkId.ZVV, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP, Charsets.UTF_8);
|
||||
super(NetworkId.ZVV, API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", PRODUCTS_MAP);
|
||||
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
setJsonNearbyLocationsEncoding(Charsets.UTF_8);
|
||||
setStyles(STYLES);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue