嗨,我正在使用客户端 Http (apache) 和 json-simple。
我想访问json响应的属性,然后使用它们。
知道如何做到这一点吗?我读了一篇文章,但我并没有像它那样工作。
这是我的回答 json:
{"Name":"myname","Lastname":"mylastname","Age":19}
Run Code Online (Sandbox Code Playgroud)
这是我的代码java:
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet getRequest = new HttpGet(
"http://localhost:8000/responsejava");
getRequest.addHeader("accept", "application/json");
HttpResponse response = httpClient.execute(getRequest);
if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("Failed : HTTP error code : "
+ response.getStatusLine().getStatusCode());
}
BufferedReader br = new BufferedReader(
new InputStreamReader(
(response.getEntity().getContent())
)
);
StringBuilder content = new StringBuilder();
String line;
while (null != (line = br.readLine())) {
content.append(line);
}
Object obj=JSONValue.parse(content.toString());
JSONObject finalResult=(JSONObject)obj;
System.out.println(finalResult);
httpClient.getConnectionManager().shutdown();
Run Code Online (Sandbox Code Playgroud)
我打印了 null,我做错了什么?
我使用的是最新版本的Angular 2,V4.0.0,我想在我的项目中使用Chart.js库中的图形而没有太多复杂情况.
如何在我的角度项目中实现Chart.js,它不会在最终生产中给我带来问题?
我想用节点的“宽度”制作动画。
在本例中,我的节点是“AnchorPane”。
我尝试在 javafx 中制作一个导航抽屉。
没有属性“width Property()”?
new Key Value (node.width Property (), 1, WEB_EASE)
Run Code Online (Sandbox Code Playgroud)
node.widthProperty().getValue() 未找到
我的代码:
public void changeWidth(final Node node, double width) {
this.node = node;
this.timeline = TimelineBuilder.create()
.keyFrames(
new KeyFrame(Duration.millis(20),
new KeyValue( going here? , width, WEB_EASE)
)
)
.build();
setCycleDuration(Duration.seconds(5));
setDelay(Duration.seconds(0));
}
Run Code Online (Sandbox Code Playgroud)
“不透明度”属性的示例:
new KeyValue(node.opacityProperty(), 1, WEB_EASE)
Run Code Online (Sandbox Code Playgroud)
我的类 ConfigAnimationViewPane:
public class ConfigAnimationViewPane extends Transition {
protected static final Interpolator WEB_EASE = Interpolator.EASE_BOTH;
protected AnchorPane node;
protected Timeline timeline;
private boolean oldCache = false; …Run Code Online (Sandbox Code Playgroud) java ×2
angular ×1
animation ×1
chart.js ×1
gtk ×1
gtk3 ×1
html ×1
http ×1
httpresponse ×1
javafx ×1
javascript ×1
json ×1
json-simple ×1
python ×1
python-3.x ×1
transition ×1
typescript ×1