and destroy and delete any copies you may have received.");
+
+ return body.toString();
+
+ }
+
+
+
+ /**
+ * read the portal instance name from a property file and returns it
+ */
+ private static String getPortalInstanceName() {
+ //get the portles to look for from the property file
+ Properties props = new Properties();
+ String toReturn = "";
+
+ try {
+ String propertyfile = OrganizationsUtil.getTomcatFolder()+"conf/gcube-data.properties";
+ File propsFile = new File(propertyfile);
+ FileInputStream fis = new FileInputStream(propsFile);
+ props.load( fis);
+ toReturn = props.getProperty(GATEWAY_NAME);
+ }
+ //catch exception in case properties file does not exist
+ catch(IOException e) {
+ toReturn = "D4science Gateway";
+ _log.error("gcube-data.properties file not found under $CATALINA_HOME/conf dir, returning default Portal Name " + toReturn);
+ return toReturn;
+ }
+ _log.debug("Returning Gateway Name: " + toReturn );
+ return toReturn;
+ }
+
+ /**
+ * read the sender email for notifications name from a property file and returns it
+ */
+ private static String getSenderEmail() {
+ //get the portles to look for from the property file
+ Properties props = new Properties();
+ String toReturn = "";
+
+ try {
+ String propertyfile = OrganizationsUtil.getTomcatFolder()+"conf/gcube-data.properties";
+ File propsFile = new File(propertyfile);
+ FileInputStream fis = new FileInputStream(propsFile);
+ props.load( fis);
+ toReturn = props.getProperty(SENDER_EMAIL);
+ }
+ //catch exception in case properties file does not exist
+ catch(IOException e) {
+ toReturn = "do-not-reply@d4science.org";
+ _log.error("gcube-data.properties file not found under $CATALINA_HOME/conf dir, returning default Email" + toReturn);
+ return toReturn;
+ }
+ _log.debug("Returning SENDER_EMAIL: " + toReturn );
+ return toReturn;
+ }
- /**
- * Escape an html string. Escaping data received from the client helps to
- * prevent cross-site script vulnerabilities.
- *
- * @param html the html string to escape
- * @return the escaped string
- */
- private String escapeHtml(String html) {
- if (html == null) {
- return null;
- }
- return html.replaceAll("&", "&").replaceAll("<", "<").replaceAll(
- ">", ">");
- }
}
diff --git a/src/main/java/org/gcube/portlets/user/invitefriends/shared/FieldVerifier.java b/src/main/java/org/gcube/portlets/user/invitefriends/shared/FieldVerifier.java
deleted file mode 100644
index e74df61..0000000
--- a/src/main/java/org/gcube/portlets/user/invitefriends/shared/FieldVerifier.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.gcube.portlets.user.invitefriends.shared;
-
-/**
- *
- * FieldVerifier validates that the name the user enters is valid.
- *
- *
- * This class is in the shared
packing because we use it in both
- * the client code and on the server. On the client, we verify that the name is
- * valid before sending an RPC request so the user doesn't have to wait for a
- * network round trip to get feedback. On the server, we verify that the name is
- * correct to ensure that the input is correct regardless of where the RPC
- * originates.
- *
- *
- * When creating a class that is used on both the client and the server, be sure
- * that all code is translatable and does not use native JavaScript. Code that
- * is note translatable (such as code that interacts with a database or the file
- * system) cannot be compiled into client side JavaScript. Code that uses native
- * JavaScript (such as Widgets) cannot be run on the server.
- *
- */
-public class FieldVerifier {
-
- /**
- * Verifies that the specified name is valid for our service.
- *
- * In this example, we only require that the name is at least four
- * characters. In your application, you can use more complex checks to ensure
- * that usernames, passwords, email addresses, URLs, and other fields have the
- * proper syntax.
- *
- * @param name the name to validate
- * @return true if valid, false if invalid
- */
- public static boolean isValidName(String name) {
- if (name == null) {
- return false;
- }
- return name.length() > 3;
- }
-}