我想为我的Web应用程序使用的休息服务设置连接超时.我正在使用Spring的RestTemplate与我的服务交谈.我做了一些研究,我发现并使用了下面的xml(在我的应用程序xml中),我认为这是为了设置超时.我正在使用Spring 3.0.
我也看到了同样的问题这里使用RestTemplate的spring webservices的超时配置,但解决方案看起来不干净,我更喜欢通过Spring配置设置超时值
<bean id="RestOperations" class="org.springframework.web.client.RestTemplate">
<constructor-arg>
<bean class="org.springframework.http.client.CommonsClientHttpRequestFactory">
<property name="readTimeout" value="${restURL.connectionTimeout}" />
</bean>
</constructor-arg>
</bean>
Run Code Online (Sandbox Code Playgroud)
似乎无论我设置readTimeout是什么,我得到以下内容:
网络电缆断开连接: 等待大约20秒并报告以下异常:
org.springframework.web.client.ResourceAccessExcep tion:I/O错误:无主机路由:connect; 嵌套异常是java.net.NoRouteToHostException:没有到host的路由:connect
网址不正确,因此休息服务返回404: 等待大约10秒并报告以下异常:
org.springframework.web.client.HttpClientErrorException:404 Not Found
我的要求需要更短的超时时间,所以我需要能够更改这些.关于我做错了什么的任何想法?
非常感谢.
我将我们的Wicket 1.4应用程序移植到Wicket 1.5.游客现在非常不同.我想知道的是如何处理Wicket 1.5中的CONTINUAL_TRAVERSAL?现有的1.4代码如下:
public class MyFormVisitor implements IVisitor<Component, Object>, Serializable {
private static final long serialVersionUID = 7271477325583441433L;
private Set<Component> visited = new HashSet<Component>();
@Override
public Object component(Component c) {
if (!visited.contains(c)) {
visited.add(c);
c.add(new MandatoryBehavior());
c.add(new ErrorHighlightBehavior());
}
return IVisitor.CONTINUE_TRAVERSAL;
}
Run Code Online (Sandbox Code Playgroud) 我正在使用jqPlot创建图表.图表的数据点来自使用GSON构建的JSON对象.图表数据点以JavaScript数组格式构建,因此保存要发送到客户端的数据的Java对象存储数据,如下所示:
String chartDataPoints = "[[1352128861000, 0.0], [1352128801000, 0.0], [1352128741000, 0.0], [1352128681000, 0.0], [1352128621000, 0.0],...More chart points in this format ,[[x0,y0], [x1,y2]...]]";
Run Code Online (Sandbox Code Playgroud)
x点是日期.
是否可以直接从JSON对象传递此数据,就好像它是一个JavaScript数组?目前,MyJsonObject.chartDataPoints被视为String,因此jqPlot($ .jqplot('chart1',MyJsonObject.chartDataPoints)不会绘制任何内容.