I am trying to get a request to get the json file but once i do that I get the Log that i get is that it doesn't see the json file. infact, it only sees the Log below.
Should i get another response than this in order to get the info of the Json file?
This is the link i want to get a request from: https://www.footlocker.nl/INTERSHOP/static/FLE/Footlocker-Site/-/Footlocker/%22%20+%20%22en_US/Release-Calendar/Launchcalendar/launchdata/launchcalendar_feed_all.json
jan. 10, 2021 11:26:59 P.M. okhttp3.internal.platform.Platform log
INFO: <html><head><title>footlocker.nl</title><style>#cmsg{animation: A 1.5s;}@keyframes A{0%{opacity:0;}99%{opacity:0;}100%{opacity:1;}}</style></head><body style="margin:0"><p id="cmsg">Please enable JS and disable any ad blocker</p><script>var dd={'cid':'AHrlqAAAAAMA_bz9MUAng5wAUHCDZw==','hsh':'A55FBF4311ED6F1BF9911EB71931D5','t':'fe','s':17434,'host':'geo.captcha-delivery.com'}</script><script src="https://ct.captcha-delivery.com/c.js"></script></body></html>
And this is my code:
public FootlockerV2() {
tester();
}
public void tester() {
var loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
//httpClient maken.
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
httpClient.addInterceptor(chain -> {
Request request = chain.request();
Request.Builder newRequest = request.newBuilder()
.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " +
"(KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36")
.header("authority", "www.footlocker.nl")
.header("scheme", "https")
.header("cache-control", "no-cache")
.header("path", "/INTERSHOP/static/FLE/Footlocker-Site/-/Footlocker/%22%20+%20%22en_US/Release-Calendar/Launchcalendar/launchdata/launchcalendar_feed_all.json")
.header("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9");
return chain.proceed(newRequest.build());
}).addInterceptor(loggingInterceptor);
Retrofit retrofit = new Retrofit.Builder()
.client(httpClient.build())
.baseUrl(Api.base)
.addConverterFactory(GsonConverterFactory.create())
.build();
Api api = retrofit.create(Api.class);
Call<List<Article>> call = api.getArticles();
call.enqueue(new Callback<List<Article>>() {
@Override
public void onResponse(Call<List<Article>> call, Response<List<Article>> response) {
List<Article> articles = response.body();
if (articles != null) {
for (Article article : articles) {
System.out.println(response.body().toString());
System.out.println(article.getName() + "
");
}
}
}
@Override
public void onFailure(Call<List<Article>> call, Throwable t) {
}
});
}`