diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java index b5d01f6..2a43418 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java @@ -116,12 +116,10 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet; * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it * */ -public class TDGWTServiceImpl extends RemoteServiceServlet implements - TDGWTService { +public class TDGWTServiceImpl extends RemoteServiceServlet implements TDGWTService { private static final long serialVersionUID = -5707400086333186368L; - protected static Logger logger = LoggerFactory - .getLogger(TDGWTServiceImpl.class); + protected static Logger logger = LoggerFactory.getLogger(TDGWTServiceImpl.class); protected static SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); protected TabularDataService service; @@ -133,8 +131,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * {@inheritDoc} */ @Override - public void setTabResource(TabResource tabResource) - throws TDGWTServiceException { + public void setTabResource(TabResource tabResource) throws TDGWTServiceException { try { session = this.getThreadLocalRequest().getSession(); if (tabResource == null) { @@ -164,8 +161,17 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements */ @Override public TabResource getTabResourceInformation() throws TDGWTServiceException { - try { session = this.getThreadLocalRequest().getSession(); + return getTabulaResourceInformationForHttpSession(session); + } + + + public TabResource getTabResourceInformation(HttpSession session) throws TDGWTServiceException { + return getTabulaResourceInformationForHttpSession(session); + } + + private TabResource getTabulaResourceInformationForHttpSession(HttpSession session) throws TDGWTServiceException{ + try { aslSession = SessionUtil.getAslSession(session); TabResource currentTR = SessionUtil.getTabResource(session); @@ -175,19 +181,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements "CURRENT_TABULAR_RESOURCE is null"); } - ArrayList trMetadatas = getTRMetadata(currentTR - .getTrId()); + ArrayList trMetadatas = getTRMetadata(currentTR.getTrId()); updateTabResourceInformation(currentTR, trMetadatas); SessionUtil.setTabResource(session, currentTR); return currentTR; } catch (Exception e) { - logger.error( - "Error setting TabResource parameter: " - + e.getLocalizedMessage(), e); - throw new TDGWTServiceException( - "Error setting TabResource parameter: " - + e.getLocalizedMessage()); + logger.error("Error setting TabResource parameter: "+ e.getLocalizedMessage(), e); + throw new TDGWTServiceException("Error setting TabResource parameter: "+ e.getLocalizedMessage()); } }