0
我試圖在使用Response之後釋放資源,並且我使用的是org.jboss.resteasy.client.ClientResponse。 我的代碼如下。Rest Easy ClientResponse找不到符號releaseConnection()
ClientResponse<String> response = null;
final ClientRequest request = new ClientRequest(urlString);\\thiscontains username and password
request.accept(acceptType);
if (body != null) {
request.body(consumesType, body);
}
request.header("Content-Type", consumesType);
try {
restClientService.addAuthenticationHeaders(request,
userName, password);
response = restClientService.get(request);
if (response.getStatus() == HttpURLConnection.HTTP_OK) {
return true;
}
return false;
} catch (final Exception e) {
logger.error("Error occured");
return false;
} finally {
if (response != null) {
response.releaseConnection();
}
}
我當面向我使用螞蟻
[javac] C:\workspace\com\session\impl\DataSyncJobHelperBean.java:101: cannot find symbol
[javac] symbol : method releaseConnection()
[javac] location: class org.jboss.resteasy.client.ClientResponse<java.lang.String>
[javac] response.releaseConnection();
[javac] ^
請提供任何輸入,如果我缺少什麼