0
JSONフォームhttp://httpbin.org/getを取得しようとしています。Retrofit 1.9.0すべてのフィールドにJSONが入力されない
-----------------------------------com.app.apitest.test.Args.java-----------------------------------
package com.app.apitest.test;
public class Args {
}
-----------------------------------com.app.apitest.test.Example.java-----------------------------------
package com.app.apitest.test;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Example {
@SerializedName("args")
@Expose
private Args args;
@SerializedName("headers")
@Expose
private Headers headers;
@SerializedName("origin")
@Expose
private String origin;
@SerializedName("url")
@Expose
private String url;
public Args getArgs() {
return args;
}
public void setArgs(Args args) {
this.args = args;
}
public Headers getHeaders() {
return headers;
}
public void setHeaders(Headers headers) {
this.headers = headers;
}
public String getOrigin() {
return origin;
}
public void setOrigin(String origin) {
this.origin = origin;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
-----------------------------------com.app.apitest.test.Headers.java-----------------------------------
package com.app.apitest.test;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Headers {
@SerializedName("Accept")
@Expose
private String accept;
@SerializedName("Accept-Encoding")
@Expose
private String acceptEncoding;
@SerializedName("Accept-Language")
@Expose
private String acceptLanguage;
@SerializedName("Cookie")
@Expose
private String cookie;
@SerializedName("Host")
@Expose
private String host;
@SerializedName("Referer")
@Expose
private String referer;
@SerializedName("Upgrade-Insecure-Requests")
@Expose
private String upgradeInsecureRequests;
@SerializedName("User-Agent")
@Expose
private String userAgent;
public String getAccept() {
return accept;
}
public void setAccept(String accept) {
this.accept = accept;
}
public String getAcceptEncoding() {
return acceptEncoding;
}
public void setAcceptEncoding(String acceptEncoding) {
this.acceptEncoding = acceptEncoding;
}
public String getAcceptLanguage() {
return acceptLanguage;
}
public void setAcceptLanguage(String acceptLanguage) {
this.acceptLanguage = acceptLanguage;
}
public String getCookie() {
return cookie;
}
public void setCookie(String cookie) {
this.cookie = cookie;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getReferer() {
return referer;
}
public void setReferer(String referer) {
this.referer = referer;
}
public String getUpgradeInsecureRequests() {
return upgradeInsecureRequests;
}
public void setUpgradeInsecureRequests(String upgradeInsecureRequests) {
this.upgradeInsecureRequests = upgradeInsecureRequests;
}
public String getUserAgent() {
return userAgent;
}
public void setUserAgent(String userAgent) {
this.userAgent = userAgent;
}
}
しかし、私は私のExample.classが適切に満たしていない結果だとき:私はPOJOにJSONに変換するためにhttp://www.jsonschema2pojo.org/を使用それは
{
"args": {},
"headers": {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,* /*;q=0.8",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "pl,en-US;q=0.7,en;q=0.3",
"Cookie": "_ga=GA1.2.1591535064.1485716088; _gat=1",
"Host": "httpbin.org",
"Referer": "http://httpbin.org/",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0"
},
"origin": "83.10.45.163",
"url": "http://httpbin.org/get"
}
のように見えます。いくつかのヌルフィールドがあります... SSを見てください:
何が問題なのですか?