diff --git a/src/main/java/org/gcube/portlets/user/td/server/TabularDataServiceImpl.java b/src/main/java/org/gcube/portlets/user/td/server/TabularDataServiceImpl.java index f189a53..3051484 100644 --- a/src/main/java/org/gcube/portlets/user/td/server/TabularDataServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/td/server/TabularDataServiceImpl.java @@ -3,12 +3,9 @@ package org.gcube.portlets.user.td.server; import javax.servlet.ServletException; import org.gcube.common.scope.api.ScopeProvider; -import org.gcube.portlets.user.csvimportwizardgxt3.server.csv.CSVTargetRegistry; -import org.gcube.portlets.user.csvimportwizardgxt3.server.csv.DemoCSVTarget; import org.gcube.portlets.user.td.ciw.server.CSVTDImporter; import org.gcube.portlets.user.td.client.rpc.TabularDataService; import org.gcube.portlets.user.td.importer.server.TabularDataImporterManager; -import org.gcube.portlets.user.td.shared.FieldVerifier; import com.google.gwt.user.server.rpc.RemoteServiceServlet; /** @@ -23,17 +20,17 @@ public class TabularDataServiceImpl extends RemoteServiceServlet implements Tabu @Override public void init() throws ServletException { super.init(); - + System.out.println("initializing the TabularDataImporterManager"); TabularDataImporterManager importerManager = new TabularDataImporterManager(); //importerManager.scanAvailableImporters(); importerManager.add(new CSVTDImporter()); importerManager.setupImporters(); - + //register the demo csv target //CSVTargetRegistry.getInstance().add(new DemoCSVTarget()); //System.out.println("Registered DemoCSVTarget"); - + ScopeProvider.instance.set("/gcube/devsec"); } @@ -41,37 +38,8 @@ public class TabularDataServiceImpl extends RemoteServiceServlet implements Tabu * {@inheritDoc} */ public String greetServer(String input) throws IllegalArgumentException { - // Verify that the input is valid. - if (!FieldVerifier.isValidName(input)) { - // If the input is not valid, throw an IllegalArgumentException back to - // the client. - throw new IllegalArgumentException( - "Name must be at least 4 characters long"); - } - String serverInfo = getServletContext().getServerInfo(); - String userAgent = getThreadLocalRequest().getHeader("User-Agent"); - // Escape data from the client to avoid cross-site script vulnerabilities. - input = escapeHtml(input); - userAgent = escapeHtml(userAgent); - - return "Hello, " + input + "!

I am running " + serverInfo - + ".

It looks like you are using:
" + userAgent; - } - - /** - * 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( - ">", ">"); + return "Hello"; } } diff --git a/src/main/java/org/gcube/portlets/user/td/shared/FieldVerifier.java b/src/main/java/org/gcube/portlets/user/td/shared/FieldVerifier.java deleted file mode 100644 index 5e550fc..0000000 --- a/src/main/java/org/gcube/portlets/user/td/shared/FieldVerifier.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.gcube.portlets.user.td.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; - } -}