diff --git a/pom.xml b/pom.xml index 6c0d3d4..178d016 100644 --- a/pom.xml +++ b/pom.xml @@ -124,9 +124,7 @@ compile - - - + org.gcube.common diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CSVImportFileServlet.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CSVImportFileServlet.java index e81c1db..49844ac 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CSVImportFileServlet.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CSVImportFileServlet.java @@ -70,13 +70,16 @@ public class CSVImportFileServlet extends HttpServlet { ServiceCredentials serviceCredentials; - String scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID); + String scopeGroupId = request.getHeader(Constants.CURR_GROUP_ID); if (scopeGroupId == null || scopeGroupId.isEmpty()) { - logger.error("CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " - + scopeGroupId); - throw new ServletException( - "CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " - + scopeGroupId); + scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID); + if (scopeGroupId == null || scopeGroupId.isEmpty()) { + logger.error("CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " + + scopeGroupId); + throw new ServletException( + "CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " + + scopeGroupId); + } } try { diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CodelistMappingUploadServlet.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CodelistMappingUploadServlet.java index 41a369e..bb135d9 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CodelistMappingUploadServlet.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CodelistMappingUploadServlet.java @@ -68,13 +68,16 @@ public class CodelistMappingUploadServlet extends HttpServlet { ServiceCredentials serviceCredentials; - String scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID); + String scopeGroupId = request.getHeader(Constants.CURR_GROUP_ID); if (scopeGroupId == null || scopeGroupId.isEmpty()) { - logger.error("CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " - + scopeGroupId); - throw new ServletException( - "CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " - + scopeGroupId); + scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID); + if (scopeGroupId == null || scopeGroupId.isEmpty()) { + logger.error("CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " + + scopeGroupId); + throw new ServletException( + "CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " + + scopeGroupId); + } } try { diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/LocalUploadServlet.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/LocalUploadServlet.java index 135c51f..a8138ee 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/LocalUploadServlet.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/LocalUploadServlet.java @@ -68,13 +68,16 @@ public class LocalUploadServlet extends HttpServlet { ServiceCredentials serviceCredentials; - String scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID); + String scopeGroupId = request.getHeader(Constants.CURR_GROUP_ID); if (scopeGroupId == null || scopeGroupId.isEmpty()) { - logger.error("CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " - + scopeGroupId); - throw new ServletException( - "CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " - + scopeGroupId); + scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID); + if (scopeGroupId == null || scopeGroupId.isEmpty()) { + logger.error("CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " + + scopeGroupId); + throw new ServletException( + "CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " + + scopeGroupId); + } } try { diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/RetrieveChartFileServlet.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/RetrieveChartFileServlet.java index 9d313d5..1aeabe8 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/RetrieveChartFileServlet.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/RetrieveChartFileServlet.java @@ -70,13 +70,16 @@ public class RetrieveChartFileServlet extends HttpServlet { @SuppressWarnings("unused") ServiceCredentials serviceCredentials; - String scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID); + String scopeGroupId = request.getHeader(Constants.CURR_GROUP_ID); if (scopeGroupId == null || scopeGroupId.isEmpty()) { - logger.error("CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " - + scopeGroupId); - throw new ServletException( - "CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " - + scopeGroupId); + scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID); + if (scopeGroupId == null || scopeGroupId.isEmpty()) { + logger.error("CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " + + scopeGroupId); + throw new ServletException( + "CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " + + scopeGroupId); + } } try { diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/RetrieveFileAndDiscoverMimeTypeServlet.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/RetrieveFileAndDiscoverMimeTypeServlet.java index 6c26df4..d06dff4 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/RetrieveFileAndDiscoverMimeTypeServlet.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/RetrieveFileAndDiscoverMimeTypeServlet.java @@ -67,13 +67,16 @@ public class RetrieveFileAndDiscoverMimeTypeServlet extends HttpServlet { @SuppressWarnings("unused") ServiceCredentials serviceCredentials; - String scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID); + String scopeGroupId = request.getHeader(Constants.CURR_GROUP_ID); if (scopeGroupId == null || scopeGroupId.isEmpty()) { - logger.error("CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " - + scopeGroupId); - throw new ServletException( - "CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " - + scopeGroupId); + scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID); + if (scopeGroupId == null || scopeGroupId.isEmpty()) { + logger.error("CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " + + scopeGroupId); + throw new ServletException( + "CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " + + scopeGroupId); + } } try { diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java index e757fb1..700ff16 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java @@ -125,7 +125,7 @@ public class SessionUtil { logger.info("No credential found in session, use test user!"); InfoLocale infoLocale = getInfoLocale(httpServletRequest, null); Locale locale = new Locale(infoLocale.getLanguage()); - @SuppressWarnings("unused") + ResourceBundle messages = ResourceBundle.getBundle( TDGWTServiceMessagesConstants.TDGWTServiceMessages, locale); diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDLogsServlet.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDLogsServlet.java index 07bc739..62f7875 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDLogsServlet.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDLogsServlet.java @@ -67,13 +67,16 @@ public class TDLogsServlet extends HttpServlet { @SuppressWarnings("unused") ServiceCredentials serviceCredentials; - String scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID); + String scopeGroupId = request.getHeader(Constants.CURR_GROUP_ID); if (scopeGroupId == null || scopeGroupId.isEmpty()) { - logger.error("CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " - + scopeGroupId); - throw new ServletException( - "CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " - + scopeGroupId); + scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID); + if (scopeGroupId == null || scopeGroupId.isEmpty()) { + logger.error("CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " + + scopeGroupId); + throw new ServletException( + "CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " + + scopeGroupId); + } } try { diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDRStudioServlet.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDRStudioServlet.java index 4c6f9b3..ee3fa93 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDRStudioServlet.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDRStudioServlet.java @@ -67,13 +67,16 @@ public class TDRStudioServlet extends HttpServlet { ServiceCredentials serviceCredentials; - String scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID); + String scopeGroupId = request.getHeader(Constants.CURR_GROUP_ID); if (scopeGroupId == null || scopeGroupId.isEmpty()) { - logger.error("CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " - + scopeGroupId); - throw new ServletException( - "CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " - + scopeGroupId); + scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID); + if (scopeGroupId == null || scopeGroupId.isEmpty()) { + logger.error("CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " + + scopeGroupId); + throw new ServletException( + "CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " + + scopeGroupId); + } } try { diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TabularDataRowsXServlet.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TabularDataRowsXServlet.java index 6fefb6d..29e4f3e 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TabularDataRowsXServlet.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TabularDataRowsXServlet.java @@ -66,13 +66,16 @@ public class TabularDataRowsXServlet extends HttpServlet { @SuppressWarnings("unused") ServiceCredentials serviceCredentials; - String scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID); + String scopeGroupId = request.getHeader(Constants.CURR_GROUP_ID); if (scopeGroupId == null || scopeGroupId.isEmpty()) { - logger.error("CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " - + scopeGroupId); - throw new ServletException( - "CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " - + scopeGroupId); + scopeGroupId = request.getParameter(Constants.CURR_GROUP_ID); + if (scopeGroupId == null || scopeGroupId.isEmpty()) { + logger.error("CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " + + scopeGroupId); + throw new ServletException( + "CURR_GROUP_ID is null, it is a mandatory parameter in custom servlet: " + + scopeGroupId); + } } try { diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/Constants.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/Constants.java index 4cf43c9..4951187 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/Constants.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/Constants.java @@ -10,8 +10,8 @@ package org.gcube.portlets.user.td.gwtservice.shared; * */ public class Constants { - public static final boolean DEBUG_MODE = true; - public static final boolean TEST_ENABLE = true; + public static final boolean DEBUG_MODE = false; + public static final boolean TEST_ENABLE = false; public static final String CURR_GROUP_ID = "CURR_GROUP_ID"; //public static final String CURR_USER_ID = "CURR_USER_ID";