我使用restlet客户端向服务器发送休息请求。如何加速restlet客户端获取响应?
public class RestHandler {
protected ClientResource resource = null;
protected Client client = null;
public void connect(final String address,
final Protocol protocol){
final Context context = new Context();
if (client == null) {
logger.info("Create Client.");
client = new Client(context, protocol);
}
resource = new ClientResource(context, new Reference(protocol, address));
resource.setNext(client);
resource.setEntityBuffering(true);
}
}
在其子类中,使用resource.get()/ post/put/delete发送休息请求。
我发现响应在第一次(5-10s)回来很慢。
然后在接下来的几个请求中它会更快。
但等待大约10分钟后,我再次发送请求,它又变得缓慢。
有什么方法可以让响应回来更快吗?
你肯定Restlets这里有问题吗? – 2015-03-31 07:54:04
使用Firefox浏览器发送休息请求要快得多。所以我认为可能有一些方法来加速restlet客户端 – Sandy 2015-03-31 08:03:43
broswer依赖关系听起来很像JavaScript AJAX问题,而不是服务器端和Restlets。 – 2015-03-31 08:07:11