Fixed code on Ckan Logout
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@129456 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a3b2acbb2a
commit
6bcc6db773
|
@ -32,6 +32,8 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
|
||||||
|
import eu.trentorise.opendata.jackan.internal.org.apache.http.HttpStatus;
|
||||||
/**
|
/**
|
||||||
* The server side implementation of the RPC service.
|
* The server side implementation of the RPC service.
|
||||||
*
|
*
|
||||||
|
@ -398,38 +400,16 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
||||||
httpCon.setRequestProperty("Content-Type", "application/x-www-form-urlencoded" );
|
httpCon.setRequestProperty("Content-Type", "application/x-www-form-urlencoded" );
|
||||||
httpCon.setRequestMethod("DELETE");
|
httpCon.setRequestMethod("DELETE");
|
||||||
httpCon.connect();
|
httpCon.connect();
|
||||||
logger.debug("Logout Completed");
|
|
||||||
|
if(httpCon.getResponseCode()==HttpStatus.SC_OK){
|
||||||
|
logger.debug("Logout Completed, response code: "+HttpStatus.SC_OK);
|
||||||
|
}else{
|
||||||
|
logger.warn("An error occurred during perfoming CKAN logout, Response status is: "+httpCon.getResponseCode());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
logger.error("An error occured during performing Logout from CKAN for: "+username +" by token: "+ckanAP.getGcubeTokenValue(), e);
|
logger.error("An error occured during performing Logout from CKAN for: "+username +" by token: "+ckanAP.getGcubeTokenValue(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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