Added getResponseCode to Ckan logout
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@129455 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0ae2fe5236
commit
a3b2acbb2a
|
@ -392,7 +392,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
||||||
try {
|
try {
|
||||||
String deleteURI = ckan.buildURI();
|
String deleteURI = ckan.buildURI();
|
||||||
logger.debug("Perfoming HTTP delete to URI: "+deleteURI);
|
logger.debug("Perfoming HTTP delete to URI: "+deleteURI);
|
||||||
url = new URL(ckan.buildURI());
|
url = new URL(deleteURI);
|
||||||
HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
|
HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
|
||||||
httpCon.setDoOutput(true);
|
httpCon.setDoOutput(true);
|
||||||
httpCon.setRequestProperty("Content-Type", "application/x-www-form-urlencoded" );
|
httpCon.setRequestProperty("Content-Type", "application/x-www-form-urlencoded" );
|
||||||
|
@ -405,4 +405,31 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
URL url;
|
||||||
|
|
||||||
|
String deleteURI = "https://ckan-d-d4s.d4science.org:443/ckan-connector/gcube/service/disconnect?gcube-token=4620e6d0-2313-4f48-9d54-eb3efd01a810";
|
||||||
|
logger.debug("Perfoming HTTP delete to URI: "+deleteURI);
|
||||||
|
url = new URL(deleteURI);
|
||||||
|
HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
|
||||||
|
httpCon.setDoOutput(true);
|
||||||
|
httpCon.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
httpCon.setRequestMethod("DELETE");
|
||||||
|
httpCon.connect();
|
||||||
|
|
||||||
|
if(httpCon.getResponseCode()==200){
|
||||||
|
logger.debug("Logout Completed");
|
||||||
|
}else{
|
||||||
|
logger.warn("An error occurred during perfoming CKAN logout, Response status is: "+httpCon.getResponseCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
logger.error("An error occured during performing Logout from CKAN", e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue