fixed getCkanUtilsObj() method

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@129874 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-07-04 14:24:00 +00:00
parent 9f7162d05a
commit d5bf7d71c0
1 changed files with 5 additions and 20 deletions

View File

@ -71,31 +71,16 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
*/
private CKanUtils getCkanUtilsObj(){
// check into session
String currentScope = getASLSession().getScope();
HttpSession httpSession = getThreadLocalRequest().getSession();
String keyForScope = concatenateSessionKeyScope(CKAN_OBJ_KEY, currentScope);
CKanUtils instance = null;
if(httpSession.getAttribute(keyForScope) == null){
try{
logger.debug("The ckan util object was null");
instance = new CKanUtilsImpl(currentScope);
// put it into session
logger.debug("Putting object into session ");
httpSession.setAttribute(keyForScope, instance);
}catch(Exception e){
logger.error("Unable to retrieve ckan utils", e);
}
}else{
instance = (CKanUtils)httpSession.getAttribute(keyForScope);
logger.debug("Ckan utils object was into session");
try{
logger.debug("The ckan util object was null");
instance = new CKanUtilsImpl(currentScope);
}catch(Exception e){
logger.error("Unable to retrieve ckan utils", e);
}
return instance;
}
/**